35 lines
1.9 KiB
SQL
35 lines
1.9 KiB
SQL
-- ----------------------------
|
|
-- 合同表添加合同状态字段 (PostgreSQL)
|
|
-- 说明:此脚本用于添加合同状态字段和相关字典数据
|
|
-- 请根据实际情况谨慎执行,建议先备份数据
|
|
-- ----------------------------
|
|
|
|
-- ----------------------------
|
|
-- 第一步:添加合同状态字段
|
|
-- ----------------------------
|
|
alter table biz_contract add column if not exists contract_status varchar(10) default '0';
|
|
|
|
comment on column biz_contract.contract_status is '合同状态(0草稿 1生效中 2已完成 3已终止)';
|
|
|
|
-- ----------------------------
|
|
-- 第二步:更新现有数据为生效中
|
|
-- ----------------------------
|
|
update biz_contract set contract_status = '1' where contract_status is null or contract_status = '';
|
|
|
|
-- ----------------------------
|
|
-- 第三步:添加合同状态字典类型
|
|
-- ----------------------------
|
|
insert into sys_dict_type (dict_id, tenant_id, dict_name, dict_type, status, del_flag, create_dept, create_time, remark)
|
|
values (110, '000000', '合同状态', 'biz_contract_status', '0', '0', 103, now(), '合同状态列表')
|
|
on conflict (dict_id) do nothing;
|
|
|
|
-- ----------------------------
|
|
-- 第四步:添加合同状态字典数据
|
|
-- ----------------------------
|
|
insert into sys_dict_data (dict_code, tenant_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, del_flag, create_dept, create_time, remark) VALUES
|
|
(1100, '000000', 1, '草稿', '0', 'biz_contract_status', '', 'info', 'N', '0', '0', 103, now(), '草稿'),
|
|
(1101, '000000', 2, '生效中', '1', 'biz_contract_status', '', 'primary', 'N', '0', '0', 103, now(), '生效中'),
|
|
(1102, '000000', 3, '已完成', '2', 'biz_contract_status', '', 'success', 'N', '0', '0', 103, now(), '已完成'),
|
|
(1103, '000000', 4, '已终止', '3', 'biz_contract_status', '', 'danger', 'N', '0', '0', 103, now(), '已终止')
|
|
on conflict do nothing;
|