-- 排班班次信息表
TRUNCATE TABLE dd_scheduling_shift;

-- ---------班次表数据迁移------------------
INSERT INTO `dd_scheduling_shift` (
	`shift_id`,
	`shift_no`,
	`shift_name`,
	`shift_time_begin`,
	`shift_time_end`,
	`org_code`,
	`is_enable`,
	`create_by`,
	`create_time`,
	`update_by`,
	`update_time`
) SELECT
	ID,
	SHIFT_NUM,
	SHIFT_NAME,
	SHIFT_TIME_BEGIN,
	SHIFT_TIME_END,
	ORG_CODE,
	IS_ENABLE,
	CREATE_BY,
	CREATE_DATE,
	UPDATE_BY,
	UPDATE_DATE
FROM
	sd_shift_table;


-- ------------------------------额外处理字段------------------------------

-- -----机构编码、机构名称
UPDATE dd_scheduling_shift s,sd_org_info o
SET s.org_code = o.ORGCODE_ORIG,
s.org_name = o.ORGNAME
WHERE s.org_code = o.ORGCODE;

-- -----是否跨天字段处理
UPDATE dd_scheduling_shift SET is_cross = '1'  WHERE shift_time_begin>shift_time_end;
UPDATE dd_scheduling_shift SET is_cross = '0'  WHERE shift_time_begin<shift_time_end;










