feat: Add job fair region type to models, database, and migration scripts
This commit is contained in:
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_address" VARCHAR(500),
|
||||
"job_fair_type" VARCHAR(10),
|
||||
"job_fair_region_type" VARCHAR(10),
|
||||
"job_fair_start_time" TIMESTAMP,
|
||||
"job_fair_end_time" TIMESTAMP,
|
||||
"job_fair_host_unit" VARCHAR(200),
|
||||
@@ -47,6 +48,7 @@ CREATE TABLE "public_job_fair" (
|
||||
|
||||
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_region_type" IS '区域类型 1-疆内 2-疆外 3-师市以内 4-师市以外';
|
||||
COMMENT ON COLUMN "public_job_fair"."latitude" IS '纬度';
|
||||
COMMENT ON COLUMN "public_job_fair"."longitude" IS '经度';
|
||||
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_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_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");
|
||||
|
||||
Reference in New Issue
Block a user