ALTER TABLE `product_oa_ask_for_leave` DROP COLUMN `is_go_out`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `flow_flag` int NULL DEFAULT NULL COMMENT '流程送办默认字段，0-待发，1-在办，2-办结' FIRST;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `cause` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请假原因' AFTER `flow_flag`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `created_by` int NOT NULL COMMENT '创建人' AFTER `cause`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `created_utc_datetime` datetime NULL DEFAULT NULL COMMENT '创建时间' AFTER `created_by`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `department_uuid` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '部门uuid' AFTER `created_utc_datetime`;


update product_oa_ask_for_leave set end_time= DATE_ADD(start_time,INTERVAL `day` DAY) WHERE end_time is null;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `end_time` datetime NOT NULL COMMENT '结束时间' AFTER `department_uuid`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `id` bigint NOT NULL COMMENT '自增主键' AFTER `end_time`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `org_level_uuid` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '公司uuid' AFTER `id`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间' AFTER `org_level_uuid`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `leave_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '请假类型' AFTER `start_time`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `updated_by` int NULL DEFAULT NULL COMMENT '修改人' AFTER `leave_type`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `updated_utc_datetime` datetime NULL DEFAULT NULL COMMENT '修改时间' AFTER `updated_by`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `uuid` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '唯一主键' AFTER `updated_utc_datetime`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `fill_in_time` datetime NULL DEFAULT NULL COMMENT '申请时间' AFTER `uuid`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `day` int NULL DEFAULT NULL COMMENT '请假时长' AFTER `fill_in_time`;

ALTER TABLE `product_oa_ask_for_leave` ADD COLUMN `user_id` int NULL DEFAULT NULL COMMENT '申请人' AFTER `day`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `day_week` int NULL DEFAULT NULL COMMENT '共计天数(含周末)' AFTER `user_id`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `accessory_uuid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '附件' AFTER `day_week`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `work_year` int NULL DEFAULT NULL COMMENT '工作年限' AFTER `accessory_uuid`;

update product_oa_ask_for_leave set join_work_time=concat(join_work_time,'-01') WHERE length(join_work_time)=7;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `join_work_time` datetime NULL DEFAULT NULL COMMENT '参加工作时间' AFTER `work_year`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `work_assignment_person` int NULL DEFAULT NULL COMMENT '本人工作交办人' AFTER `join_work_time`;

ALTER TABLE `product_oa_ask_for_leave` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键';

INSERT INTO `product_sys_datamodel_table` (uuid,created_by,created_utc_datetime,updated_by,updated_utc_datetime,org_level_uuid,table_name,table_description,table_type,table_base_view,view_sql,table_primary_key,sequence,is_international,produce_msg,container_name,view_status) SELECT 'product_sys_ask_for_leave', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', NULL, 'product_oa_ask_for_leave', '请假表申请', '1', '', NULL, 'uuid', '103', '0', NULL, NULL, NULL from DUAL where not EXISTS (select 1 from product_sys_datamodel_table  where table_name='product_oa_ask_for_leave');
UPDATE `product_sys_datamodel_table` SET  uuid = 'product_sys_ask_for_leave', created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = '2020-01-01 00:00:00', org_level_uuid = NULL, table_name = 'product_oa_ask_for_leave', table_description = '请假表申请', table_type = '1', table_base_view = '', view_sql = NULL, table_primary_key = 'uuid', sequence = '103', is_international = '0', produce_msg = NULL, view_status = NULL  WHERE table_name = 'product_oa_ask_for_leave';
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'accessory_uuid', 'file', '附件', '附件', '100', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '20', '1', '2024-10-15 17:06:26', '1', '2024-10-15 17:07:45', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='accessory_uuid');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'cause', 'string', '请假原因', '请假原因', '2000', '0', '0', '0', '0', '0', NULL, NULL, 'Leave_Type
', NULL, '2', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='cause');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'created_by', 'int', '创建人', '创建人', '11', '0', '1', '0', '0', '0', NULL, NULL, 'user_name_by_user_id', NULL, '3', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='created_by');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'created_utc_datetime', 'datetime', '创建时间', '创建时间', '0', '0', '0', '0', '0', '0', NULL, NULL, NULL, NULL, '4', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='created_utc_datetime');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'day', 'int', '请假时长', '请假时长', '20', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '15', '1', '2024-08-06 00:00:00', '1', '2024-08-06 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='day');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'day_week', 'int', '共计天数(含周末)', '共计天数(含周末)', '20', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '19', '1', '2024-10-15 16:04:23', '1', '2024-10-15 17:04:45', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='day_week');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'department_uuid', 'string', '部门uuid', '部门uuid', '80', '0', '1', '0', '0', '0', NULL, NULL, 'this_level_dept', NULL, '5', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='department_uuid');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'end_time', 'datetime', '结束时间', '结束时间', '0', '0', '1', '0', '0', '0', NULL, NULL, NULL, NULL, '6', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='end_time');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'fill_in_time', 'datetime', '申请时间', '申请时间', '0', '0', '0', '0', '0', '0', NULL, NULL, NULL, NULL, '14', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='fill_in_time');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'flow_flag', 'flowsign', '流程状态', '流程送办默认字段，0-待发，1-在办，2-办结', '2', '0', '0', '0', NULL, '0', NULL, NULL, '《flow_send_status》', NULL, '1', NULL, NULL, '1', '2024-08-06 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='flow_flag');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'id', 'pk', '自增主键', '自增主键', '11', '0', '0', '0', '0', '0', NULL, NULL, NULL, NULL, '7', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='id');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'join_work_time', 'datetime', '参加工作时间', '参加工作时间', '0', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '22', '1', '2024-10-15 17:10:20', '1', '2024-10-15 17:11:56', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='join_work_time');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'leave_type', 'string', '请假类型', '请假类型', '30', '0', '1', '0', '0', '0', NULL, NULL, NULL, NULL, '10', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='leave_type');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'manager_opinion', 'string', 'manager_opinion', 'manager_opinion', '300', '0', '0', '0', NULL, '0', NULL, NULL, NULL, NULL, '0', NULL, '2024-10-18 15:29:48', NULL, NULL, NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='manager_opinion');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'org_level_uuid', 'string', '公司uuid', '公司uuid', '80', '0', '1', '0', '0', '0', NULL, NULL, 'levels', NULL, '8', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='org_level_uuid');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'personnel_opinion', 'string', 'personnel_opinion', 'personnel_opinion', '300', '0', '0', '0', NULL, '0', NULL, NULL, NULL, NULL, '0', NULL, '2024-10-18 15:29:48', NULL, NULL, NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='personnel_opinion');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'staff_uuid', 'string', 'staff_uuid', 'staff_uuid', '80', '0', '0', '0', NULL, '0', NULL, NULL, NULL, NULL, '0', NULL, '2024-10-18 15:29:48', NULL, NULL, NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='staff_uuid');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'start_time', 'datetime', '开始时间', '开始时间', '0', '0', '0', '0', '0', '0', NULL, NULL, NULL, NULL, '9', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='start_time');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'updated_by', 'int', '修改人', '修改人', '11', '0', '0', '0', '0', '0', NULL, NULL, 'user_name_by_user_id', NULL, '11', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='updated_by');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'updated_utc_datetime', 'datetime', '修改时间', '修改时间', '0', '0', '0', '0', '0', '0', NULL, NULL, NULL, NULL, '12', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='updated_utc_datetime');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'user_id', 'int', '申请人', '申请人', '20', '0', '0', NULL, NULL, '0', NULL, NULL, 'user_name_by_user_id', NULL, '18', '1', '2024-08-06 00:00:00', '1', '2024-08-06 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='user_id');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'uuid', 'string', '唯一主键', '唯一主键', '80', '0', '1', '0', '0', '0', NULL, NULL, NULL, NULL, '13', '1', '2020-01-01 00:00:00', '1', '2020-01-01 00:00:00', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='uuid');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'work_assignment_person', 'int', '本人工作交办人', '本人工作交办人', '20', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '23', '1', '2024-10-15 17:11:56', '1', '2024-10-15 17:16:08', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='work_assignment_person');
INSERT INTO product_sys_datamodel_field (uuid,table_uuid, field_name, field_type, field_show_name, field_description, field_length, field_unit, is_required, is_unique, is_international, is_filter, field_format, related_table, field_reference, field_relation_table, field_sequence, created_by, created_utc_datetime, updated_by, updated_utc_datetime, is_more_value) SELECT uuid(), 'product_sys_ask_for_leave', 'work_year', 'int', '工作年限', '工作年限', '11', '0', '0', NULL, NULL, '0', NULL, NULL, NULL, NULL, '21', '1', '2024-10-15 17:10:20', '1', '2024-10-15 17:11:56', '0' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM product_sys_datamodel_field WHERE table_uuid = 'product_sys_ask_for_leave' and field_name='work_year');
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'accessory_uuid', field_type = 'file', field_show_name = '附件', field_description = '附件', field_length = 100, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 20, created_by = '1', created_utc_datetime = '2024-10-15 17:06:26', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'accessory_uuid';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'cause', field_type = 'string', field_show_name = '请假原因', field_description = '请假原因', field_length = 2000, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'Leave_Type
', field_relation_table = NULL, field_sequence = 2, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'cause';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'created_by', field_type = 'int', field_show_name = '创建人', field_description = '创建人', field_length = 11, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'user_name_by_user_id', field_relation_table = NULL, field_sequence = 3, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'created_by';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'created_utc_datetime', field_type = 'datetime', field_show_name = '创建时间', field_description = '创建时间', field_length = 0, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 4, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'created_utc_datetime';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'day', field_type = 'int', field_show_name = '请假时长', field_description = '请假时长', field_length = 20, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 15, created_by = '1', created_utc_datetime = '2024-08-06 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'day';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'day_week', field_type = 'int', field_show_name = '共计天数(含周末)', field_description = '共计天数(含周末)', field_length = 20, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 19, created_by = '1', created_utc_datetime = '2024-10-15 16:04:23', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'day_week';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'department_uuid', field_type = 'string', field_show_name = '部门uuid', field_description = '部门uuid', field_length = 80, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'this_level_dept', field_relation_table = NULL, field_sequence = 5, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'department_uuid';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'end_time', field_type = 'datetime', field_show_name = '结束时间', field_description = '结束时间', field_length = 0, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 6, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'end_time';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'fill_in_time', field_type = 'datetime', field_show_name = '申请时间', field_description = '申请时间', field_length = 0, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 14, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'fill_in_time';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'flow_flag', field_type = 'flowsign', field_show_name = '流程状态', field_description = '流程送办默认字段，0-待发，1-在办，2-办结', field_length = 2, field_unit = '0', is_required = 0, is_unique = 0, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = '《flow_send_status》', field_relation_table = NULL, field_sequence = 1, created_by = NULL, created_utc_datetime = NULL, updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'flow_flag';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'id', field_type = 'pk', field_show_name = '自增主键', field_description = '自增主键', field_length = 11, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 7, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'id';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'join_work_time', field_type = 'datetime', field_show_name = '参加工作时间', field_description = '参加工作时间', field_length = 0, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 22, created_by = '1', created_utc_datetime = '2024-10-15 17:10:20', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'join_work_time';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'leave_type', field_type = 'string', field_show_name = '请假类型', field_description = '请假类型', field_length = 30, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 10, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'leave_type';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'manager_opinion', field_type = 'string', field_show_name = 'manager_opinion', field_description = 'manager_opinion', field_length = 300, field_unit = '0', is_required = 0, is_unique = 0, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 0, created_by = NULL, created_utc_datetime = '2024-10-18 15:29:48', updated_by = NULL, updated_utc_datetime = now(), is_more_value = NULL WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'manager_opinion';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'org_level_uuid', field_type = 'string', field_show_name = '公司uuid', field_description = '公司uuid', field_length = 80, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'levels', field_relation_table = NULL, field_sequence = 8, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'org_level_uuid';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'personnel_opinion', field_type = 'string', field_show_name = 'personnel_opinion', field_description = 'personnel_opinion', field_length = 300, field_unit = '0', is_required = 0, is_unique = 0, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 0, created_by = NULL, created_utc_datetime = '2024-10-18 15:29:48', updated_by = NULL, updated_utc_datetime = now(), is_more_value = NULL WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'personnel_opinion';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'staff_uuid', field_type = 'string', field_show_name = 'staff_uuid', field_description = 'staff_uuid', field_length = 80, field_unit = '0', is_required = 0, is_unique = 0, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 0, created_by = NULL, created_utc_datetime = '2024-10-18 15:29:48', updated_by = NULL, updated_utc_datetime = now(), is_more_value = NULL WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'staff_uuid';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'start_time', field_type = 'datetime', field_show_name = '开始时间', field_description = '开始时间', field_length = 0, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 9, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'start_time';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'updated_by', field_type = 'int', field_show_name = '修改人', field_description = '修改人', field_length = 11, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'user_name_by_user_id', field_relation_table = NULL, field_sequence = 11, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'updated_by';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'updated_utc_datetime', field_type = 'datetime', field_show_name = '修改时间', field_description = '修改时间', field_length = 0, field_unit = '0', is_required = 0, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 12, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'updated_utc_datetime';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'user_id', field_type = 'int', field_show_name = '申请人', field_description = '申请人', field_length = 20, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = 'user_name_by_user_id', field_relation_table = NULL, field_sequence = 18, created_by = '1', created_utc_datetime = '2024-08-06 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'user_id';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'uuid', field_type = 'string', field_show_name = '唯一主键', field_description = '唯一主键', field_length = 80, field_unit = '0', is_required = 1, is_unique = 0, is_international = 0, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 13, created_by = '1', created_utc_datetime = '2020-01-01 00:00:00', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'uuid';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'work_assignment_person', field_type = 'int', field_show_name = '本人工作交办人', field_description = '本人工作交办人', field_length = 20, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 23, created_by = '1', created_utc_datetime = '2024-10-15 17:11:56', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'work_assignment_person';
UPDATE product_sys_datamodel_field SET table_uuid = 'product_sys_ask_for_leave', field_name = 'work_year', field_type = 'int', field_show_name = '工作年限', field_description = '工作年限', field_length = 11, field_unit = '0', is_required = 0, is_unique = NULL, is_international = NULL, is_filter = 0, field_format = NULL, related_table = NULL, field_reference = NULL, field_relation_table = NULL, field_sequence = 21, created_by = '1', created_utc_datetime = '2024-10-15 17:10:20', updated_by = '1', updated_utc_datetime = now(), is_more_value = 0 WHERE table_uuid = 'product_sys_ask_for_leave' AND field_name = 'work_year';
DELETE FROM `product_sys_datamodel_field` where table_uuid='product_sys_ask_for_leave' and  DATE_FORMAT(updated_utc_datetime, '%Y-%m-%d') != DATE_FORMAT(CURDATE(), '%Y-%m-%d');
DELETE FROM `product_sys_datamodel_table_index` where table_uuid='product_sys_ask_for_leave';
INSERT INTO `product_sys_datamodel_table_index` (`uuid`, `table_uuid`, `index_name`, `index_fields`, `index_type`) values ('b6594f71-7fad-11ec-a3ed-902b3470f24e','product_sys_ask_for_leave','uuid','uuid','1' );
