feat: Add job fair region type to models, database, and migration scripts
This commit is contained in:
@@ -136,6 +136,10 @@ public class CmsJobController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Job job)
|
public AjaxResult add(@RequestBody Job job)
|
||||||
{
|
{
|
||||||
|
AjaxResult companyCheck = bindRecruitingCompany(job, false);
|
||||||
|
if (companyCheck != null) {
|
||||||
|
return companyCheck;
|
||||||
|
}
|
||||||
// 校验描述中的敏感词
|
// 校验描述中的敏感词
|
||||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||||
if (!sensitiveWords.isEmpty()) {
|
if (!sensitiveWords.isEmpty()) {
|
||||||
@@ -156,6 +160,10 @@ public class CmsJobController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody Job job)
|
public AjaxResult edit(@RequestBody Job job)
|
||||||
{
|
{
|
||||||
|
AjaxResult companyCheck = bindRecruitingCompany(job, true);
|
||||||
|
if (companyCheck != null) {
|
||||||
|
return companyCheck;
|
||||||
|
}
|
||||||
// 校验描述中的敏感词
|
// 校验描述中的敏感词
|
||||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||||
if (!sensitiveWords.isEmpty()) {
|
if (!sensitiveWords.isEmpty()) {
|
||||||
@@ -165,6 +173,52 @@ public class CmsJobController extends BaseController
|
|||||||
return toAjax(jobService.updateJob(job));
|
return toAjax(jobService.updateJob(job));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定岗位的招聘公司。
|
||||||
|
*
|
||||||
|
* <p>企业账号的招聘公司由登录账号确定,前端无需也不能指定;管理员仍须传入其选择的公司。
|
||||||
|
* 同时同步公司名称,避免隐藏企业端表单字段后产生 company_name 为空的岗位数据。</p>
|
||||||
|
*
|
||||||
|
* @param job 岗位信息
|
||||||
|
* @param editing 是否为修改岗位
|
||||||
|
* @return 校验失败时的响应,校验通过时返回 {@code null}
|
||||||
|
*/
|
||||||
|
private AjaxResult bindRecruitingCompany(Job job, boolean editing)
|
||||||
|
{
|
||||||
|
Company company;
|
||||||
|
if (RoleUtils.isCompanyAdmin()) {
|
||||||
|
company = companyService.queryCodeCompany(RoleUtils.getCurrentUseridCard());
|
||||||
|
if (company == null) {
|
||||||
|
return AjaxResult.error("未查询到当前企业信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editing) {
|
||||||
|
if (job.getJobId() == null) {
|
||||||
|
return AjaxResult.error("jobId不能为空");
|
||||||
|
}
|
||||||
|
Job existingJob = jobService.selectJobByJobId(job.getJobId());
|
||||||
|
if (existingJob == null) {
|
||||||
|
return AjaxResult.error("岗位不存在");
|
||||||
|
}
|
||||||
|
if (!Objects.equals(company.getCompanyId(), existingJob.getCompanyId())) {
|
||||||
|
return AjaxResult.error("无权修改其他企业的岗位");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (job.getCompanyId() == null) {
|
||||||
|
return AjaxResult.error("请选择招聘公司");
|
||||||
|
}
|
||||||
|
company = companyService.selectCompanyByCompanyId(job.getCompanyId());
|
||||||
|
if (company == null) {
|
||||||
|
return AjaxResult.error("招聘公司不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
job.setCompanyId(company.getCompanyId());
|
||||||
|
job.setCompanyName(company.getName());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除岗位
|
* 删除岗位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ public class PublicJobFair implements Serializable {
|
|||||||
@ApiModelProperty("招聘会类型")
|
@ApiModelProperty("招聘会类型")
|
||||||
private String jobFairType;
|
private String jobFairType;
|
||||||
|
|
||||||
|
@ApiModelProperty("区域类型(1-疆内 2-疆外 3-师市以内 4-师市以外)")
|
||||||
|
private String jobFairRegionType;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@ApiModelProperty("招聘会开始时间")
|
@ApiModelProperty("招聘会开始时间")
|
||||||
private Date jobFairStartTime;
|
private Date jobFairStartTime;
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ public class PublicJobFairDetail implements Serializable {
|
|||||||
@ApiModelProperty("招聘会类型 1-线上 2-线下")
|
@ApiModelProperty("招聘会类型 1-线上 2-线下")
|
||||||
private Integer jobFairType;
|
private Integer jobFairType;
|
||||||
|
|
||||||
|
@ApiModelProperty("区域类型(1-疆内 2-疆外 3-师市以内 4-师市以外)")
|
||||||
|
private String jobFairRegionType;
|
||||||
|
|
||||||
@ApiModelProperty("纬度")
|
@ApiModelProperty("纬度")
|
||||||
private BigDecimal latitude;
|
private BigDecimal latitude;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ public class PublicJobFairQuery implements Serializable {
|
|||||||
@ApiModelProperty("招聘会类型")
|
@ApiModelProperty("招聘会类型")
|
||||||
private String jobFairType;
|
private String jobFairType;
|
||||||
|
|
||||||
|
@ApiModelProperty("区域类型")
|
||||||
|
private String jobFairRegionType;
|
||||||
|
|
||||||
@ApiModelProperty("招聘会举办时间(格式:yyyy-MM-dd)")
|
@ApiModelProperty("招聘会举办时间(格式:yyyy-MM-dd)")
|
||||||
private String zphjbsj;
|
private String zphjbsj;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<result property="jobFairTitle" column="job_fair_title"/>
|
<result property="jobFairTitle" column="job_fair_title"/>
|
||||||
<result property="jobFairAddress" column="job_fair_address"/>
|
<result property="jobFairAddress" column="job_fair_address"/>
|
||||||
<result property="jobFairType" column="job_fair_type"/>
|
<result property="jobFairType" column="job_fair_type"/>
|
||||||
|
<result property="jobFairRegionType" column="job_fair_region_type"/>
|
||||||
<result property="jobFairStartTime" column="job_fair_start_time"/>
|
<result property="jobFairStartTime" column="job_fair_start_time"/>
|
||||||
<result property="jobFairEndTime" column="job_fair_end_time"/>
|
<result property="jobFairEndTime" column="job_fair_end_time"/>
|
||||||
<result property="jobFairHostUnit" column="job_fair_host_unit"/>
|
<result property="jobFairHostUnit" column="job_fair_host_unit"/>
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
<result property="jobFairStartTime" column="job_fair_start_time"/>
|
<result property="jobFairStartTime" column="job_fair_start_time"/>
|
||||||
<result property="jobFairEndTime" column="job_fair_end_time"/>
|
<result property="jobFairEndTime" column="job_fair_end_time"/>
|
||||||
<result property="jobFairType" column="job_fair_type"/>
|
<result property="jobFairType" column="job_fair_type"/>
|
||||||
|
<result property="jobFairRegionType" column="job_fair_region_type"/>
|
||||||
<result property="latitude" column="latitude"/>
|
<result property="latitude" column="latitude"/>
|
||||||
<result property="longitude" column="longitude"/>
|
<result property="longitude" column="longitude"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@@ -76,7 +78,8 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPublicJobFairVo">
|
<sql id="selectPublicJobFairVo">
|
||||||
select job_fair_id, job_fair_title, job_fair_address, job_fair_type, job_fair_start_time, job_fair_end_time,
|
select job_fair_id, job_fair_title, job_fair_address, job_fair_type, job_fair_region_type,
|
||||||
|
job_fair_start_time, job_fair_end_time,
|
||||||
job_fair_host_unit, job_fair_help_unit, job_fair_organize_unit, job_fair_introduction, job_fair_remark,
|
job_fair_host_unit, job_fair_help_unit, job_fair_organize_unit, job_fair_introduction, job_fair_remark,
|
||||||
job_fair_phone, job_fair_image, job_fair_area_image, create_by, create_time, update_by, update_time,
|
job_fair_phone, job_fair_image, job_fair_area_image, create_by, create_time, update_by, update_time,
|
||||||
job_fair_venue_id, job_fair_sign_up_start_time, job_fair_sign_up_end_time, enterprise_num, booth_num,
|
job_fair_venue_id, job_fair_sign_up_start_time, job_fair_sign_up_end_time, enterprise_num, booth_num,
|
||||||
@@ -94,6 +97,9 @@
|
|||||||
<if test="query.jobFairType != null and query.jobFairType != ''">
|
<if test="query.jobFairType != null and query.jobFairType != ''">
|
||||||
and job_fair_type = #{query.jobFairType}
|
and job_fair_type = #{query.jobFairType}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="query.jobFairRegionType != null and query.jobFairRegionType != ''">
|
||||||
|
and job_fair_region_type = #{query.jobFairRegionType}
|
||||||
|
</if>
|
||||||
<if test="query.zphjbsj != null and query.zphjbsj != ''">
|
<if test="query.zphjbsj != null and query.zphjbsj != ''">
|
||||||
and to_char(job_fair_start_time, 'YYYY-MM-DD') <= #{query.zphjbsj}
|
and to_char(job_fair_start_time, 'YYYY-MM-DD') <= #{query.zphjbsj}
|
||||||
and to_char(job_fair_end_time, 'YYYY-MM-DD') >= #{query.zphjbsj}
|
and to_char(job_fair_end_time, 'YYYY-MM-DD') >= #{query.zphjbsj}
|
||||||
@@ -104,7 +110,7 @@
|
|||||||
|
|
||||||
<select id="selectPublicJobFairDetailById" resultMap="DetailResult">
|
<select id="selectPublicJobFairDetailById" resultMap="DetailResult">
|
||||||
select job_fair_id, job_fair_title, job_fair_address, job_fair_introduction,
|
select job_fair_id, job_fair_title, job_fair_address, job_fair_introduction,
|
||||||
job_fair_start_time, job_fair_end_time, job_fair_type, latitude, longitude
|
job_fair_start_time, job_fair_end_time, job_fair_type, job_fair_region_type, latitude, longitude
|
||||||
from public_job_fair
|
from public_job_fair
|
||||||
where job_fair_id = #{jobFairId} and del_flag = '0'
|
where job_fair_id = #{jobFairId} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
@@ -205,7 +211,7 @@
|
|||||||
|
|
||||||
<insert id="insertPublicJobFair">
|
<insert id="insertPublicJobFair">
|
||||||
insert into public_job_fair (
|
insert into public_job_fair (
|
||||||
job_fair_id, job_fair_title, job_fair_address, job_fair_type,
|
job_fair_id, job_fair_title, job_fair_address, job_fair_type, job_fair_region_type,
|
||||||
job_fair_start_time, job_fair_end_time, job_fair_host_unit, job_fair_help_unit,
|
job_fair_start_time, job_fair_end_time, job_fair_host_unit, job_fair_help_unit,
|
||||||
job_fair_organize_unit, job_fair_introduction, job_fair_remark, job_fair_phone,
|
job_fair_organize_unit, job_fair_introduction, job_fair_remark, job_fair_phone,
|
||||||
job_fair_image, job_fair_area_image, job_fair_venue_id,
|
job_fair_image, job_fair_area_image, job_fair_venue_id,
|
||||||
@@ -214,7 +220,7 @@
|
|||||||
job_fair_category, is_cross_domain, cross_domain_cities, latitude, longitude,
|
job_fair_category, is_cross_domain, cross_domain_cities, latitude, longitude,
|
||||||
create_by, create_time, del_flag
|
create_by, create_time, del_flag
|
||||||
) values (
|
) values (
|
||||||
#{jobFairId}, #{jobFairTitle}, #{jobFairAddress}, #{jobFairType},
|
#{jobFairId}, #{jobFairTitle}, #{jobFairAddress}, #{jobFairType}, #{jobFairRegionType},
|
||||||
#{jobFairStartTime}, #{jobFairEndTime}, #{jobFairHostUnit}, #{jobFairHelpUnit},
|
#{jobFairStartTime}, #{jobFairEndTime}, #{jobFairHostUnit}, #{jobFairHelpUnit},
|
||||||
#{jobFairOrganizeUnit}, #{jobFairIntroduction}, #{jobFairRemark}, #{jobFairPhone},
|
#{jobFairOrganizeUnit}, #{jobFairIntroduction}, #{jobFairRemark}, #{jobFairPhone},
|
||||||
#{jobFairImage}, #{jobFairAreaImage}, #{jobFairVenueId},
|
#{jobFairImage}, #{jobFairAreaImage}, #{jobFairVenueId},
|
||||||
@@ -231,6 +237,7 @@
|
|||||||
<if test="jobFairTitle != null">job_fair_title = #{jobFairTitle},</if>
|
<if test="jobFairTitle != null">job_fair_title = #{jobFairTitle},</if>
|
||||||
<if test="jobFairAddress != null">job_fair_address = #{jobFairAddress},</if>
|
<if test="jobFairAddress != null">job_fair_address = #{jobFairAddress},</if>
|
||||||
<if test="jobFairType != null">job_fair_type = #{jobFairType},</if>
|
<if test="jobFairType != null">job_fair_type = #{jobFairType},</if>
|
||||||
|
<if test="jobFairRegionType != null">job_fair_region_type = #{jobFairRegionType},</if>
|
||||||
<if test="jobFairStartTime != null">job_fair_start_time = #{jobFairStartTime},</if>
|
<if test="jobFairStartTime != null">job_fair_start_time = #{jobFairStartTime},</if>
|
||||||
<if test="jobFairEndTime != null">job_fair_end_time = #{jobFairEndTime},</if>
|
<if test="jobFairEndTime != null">job_fair_end_time = #{jobFairEndTime},</if>
|
||||||
<if test="jobFairHostUnit != null">job_fair_host_unit = #{jobFairHostUnit},</if>
|
<if test="jobFairHostUnit != null">job_fair_host_unit = #{jobFairHostUnit},</if>
|
||||||
|
|||||||
76
sql/migration_public_job_fair_region_type.sql
Normal file
76
sql/migration_public_job_fair_region_type.sql
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
-- 线上招聘会区域类型
|
||||||
|
-- 高Go / PostgreSQL 兼容;可重复执行。
|
||||||
|
-- 字典值:1-疆内、2-疆外、3-师市以内、4-师市以外。
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE "shz"."public_job_fair"
|
||||||
|
ADD COLUMN IF NOT EXISTS "job_fair_region_type" VARCHAR(10);
|
||||||
|
|
||||||
|
COMMENT ON COLUMN "shz"."public_job_fair"."job_fair_region_type"
|
||||||
|
IS '区域类型 1-疆内 2-疆外 3-师市以内 4-师市以外';
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "idx_public_job_fair_region_type"
|
||||||
|
ON "shz"."public_job_fair" ("job_fair_region_type");
|
||||||
|
|
||||||
|
INSERT INTO "shz"."sys_dict_type" (
|
||||||
|
"dict_id", "dict_name", "dict_type", "status", "create_by", "create_time", "remark"
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
(SELECT COALESCE(MAX("dict_id"), 0) + 1 FROM "shz"."sys_dict_type"),
|
||||||
|
'线上招聘会区域类型',
|
||||||
|
'job_fair_region_type',
|
||||||
|
'0',
|
||||||
|
'system',
|
||||||
|
NOW(),
|
||||||
|
'线上招聘会管理使用'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM "shz"."sys_dict_type"
|
||||||
|
WHERE "dict_type" = 'job_fair_region_type'
|
||||||
|
);
|
||||||
|
|
||||||
|
WITH seed("dict_sort", "dict_label", "dict_value", "list_class", "is_default") AS (
|
||||||
|
VALUES
|
||||||
|
(1, '疆内', '1', 'primary', 'N'),
|
||||||
|
(2, '疆外', '2', 'warning', 'N'),
|
||||||
|
(3, '师市以内', '3', 'success', 'N'),
|
||||||
|
(4, '师市以外', '4', 'default', 'N')
|
||||||
|
),
|
||||||
|
new_rows AS (
|
||||||
|
SELECT
|
||||||
|
ROW_NUMBER() OVER (ORDER BY seed."dict_sort") AS rn,
|
||||||
|
seed.*
|
||||||
|
FROM seed
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM "shz"."sys_dict_data" data
|
||||||
|
WHERE data."dict_type" = 'job_fair_region_type'
|
||||||
|
AND data."dict_value" = seed."dict_value"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
base AS (
|
||||||
|
SELECT COALESCE(MAX("dict_code"), 0) AS max_code
|
||||||
|
FROM "shz"."sys_dict_data"
|
||||||
|
)
|
||||||
|
INSERT INTO "shz"."sys_dict_data" (
|
||||||
|
"dict_code", "dict_sort", "dict_label", "dict_value", "dict_type",
|
||||||
|
"css_class", "list_class", "is_default", "status", "create_by", "create_time", "remark"
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
base.max_code + new_rows.rn,
|
||||||
|
new_rows."dict_sort",
|
||||||
|
new_rows."dict_label",
|
||||||
|
new_rows."dict_value",
|
||||||
|
'job_fair_region_type',
|
||||||
|
NULL,
|
||||||
|
new_rows."list_class",
|
||||||
|
new_rows."is_default",
|
||||||
|
'0',
|
||||||
|
'system',
|
||||||
|
NOW(),
|
||||||
|
'线上招聘会区域类型'
|
||||||
|
FROM new_rows
|
||||||
|
CROSS JOIN base;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
@@ -17,6 +17,7 @@ CREATE TABLE "public_job_fair" (
|
|||||||
"job_fair_title" VARCHAR(500),
|
"job_fair_title" VARCHAR(500),
|
||||||
"job_fair_address" VARCHAR(500),
|
"job_fair_address" VARCHAR(500),
|
||||||
"job_fair_type" VARCHAR(10),
|
"job_fair_type" VARCHAR(10),
|
||||||
|
"job_fair_region_type" VARCHAR(10),
|
||||||
"job_fair_start_time" TIMESTAMP,
|
"job_fair_start_time" TIMESTAMP,
|
||||||
"job_fair_end_time" TIMESTAMP,
|
"job_fair_end_time" TIMESTAMP,
|
||||||
"job_fair_host_unit" VARCHAR(200),
|
"job_fair_host_unit" VARCHAR(200),
|
||||||
@@ -47,6 +48,7 @@ CREATE TABLE "public_job_fair" (
|
|||||||
|
|
||||||
COMMENT ON TABLE "public_job_fair" IS '公共招聘会信息表';
|
COMMENT ON TABLE "public_job_fair" IS '公共招聘会信息表';
|
||||||
COMMENT ON COLUMN "public_job_fair"."job_fair_type" IS '招聘会类型 1-线上 2-线下';
|
COMMENT ON COLUMN "public_job_fair"."job_fair_type" IS '招聘会类型 1-线上 2-线下';
|
||||||
|
COMMENT ON COLUMN "public_job_fair"."job_fair_region_type" IS '区域类型 1-疆内 2-疆外 3-师市以内 4-师市以外';
|
||||||
COMMENT ON COLUMN "public_job_fair"."latitude" IS '纬度';
|
COMMENT ON COLUMN "public_job_fair"."latitude" IS '纬度';
|
||||||
COMMENT ON COLUMN "public_job_fair"."longitude" IS '经度';
|
COMMENT ON COLUMN "public_job_fair"."longitude" IS '经度';
|
||||||
COMMENT ON COLUMN "public_job_fair"."del_flag" IS '删除标志(0正常 2删除)';
|
COMMENT ON COLUMN "public_job_fair"."del_flag" IS '删除标志(0正常 2删除)';
|
||||||
@@ -104,6 +106,7 @@ COMMENT ON TABLE "public_job_fair_signup" IS '招聘会-用户报名表';
|
|||||||
|
|
||||||
-- 创建索引
|
-- 创建索引
|
||||||
CREATE INDEX "idx_public_job_fair_type" ON "public_job_fair"("job_fair_type");
|
CREATE INDEX "idx_public_job_fair_type" ON "public_job_fair"("job_fair_type");
|
||||||
|
CREATE INDEX "idx_public_job_fair_region_type" ON "public_job_fair"("job_fair_region_type");
|
||||||
CREATE INDEX "idx_public_job_fair_start_time" ON "public_job_fair"("job_fair_start_time");
|
CREATE INDEX "idx_public_job_fair_start_time" ON "public_job_fair"("job_fair_start_time");
|
||||||
CREATE INDEX "idx_public_job_fair_company_fair_id" ON "public_job_fair_company"("job_fair_id");
|
CREATE INDEX "idx_public_job_fair_company_fair_id" ON "public_job_fair_company"("job_fair_id");
|
||||||
CREATE INDEX "idx_public_job_fair_company_company_id" ON "public_job_fair_company"("company_id");
|
CREATE INDEX "idx_public_job_fair_company_company_id" ON "public_job_fair_company"("company_id");
|
||||||
|
|||||||
Reference in New Issue
Block a user