一、复制同表数据,不做修改 INSERT INTO 表名 (字段)SELECT 字段 FROM 表名 WHERE 条件; 二、复制同表数据同时作出修改 insert id="initializationTaskRules" parameterType="LgsOperationTaskRules" INSERT INT
一、复制同表数据,不做修改
INSERT INTO 表名 (字段)SELECT 字段 FROM 表名 WHERE 条件;二、复制同表数据同时作出修改
<insert id="initializationTaskRules" parameterType="LgsOperationTaskRules"> INSERT INTO lgs_operation_task_rules ( is_initialization, task_name, task_rules, date_interval, reminder_date, executive_role, task_describe, subtask, site_id ) SELECT is_initialization, task_name, task_rules, date_interval, reminder_date, executive_role, task_describe, subtask, #{siteId} AS site_id FROM lgs_operation_task_rules r WHERE r.is_initialization = 1 AND r.site_id IS NULL </insert>