From 2893347bf72477c4d108e8589a0f61e3e97a990c Mon Sep 17 00:00:00 2001 From: kimi <kimi42345@gmail.com> Date: 星期三, 27 五月 2020 09:56:56 +0800 Subject: [PATCH] bak 更新后 --- src/main/resources/mapping/MasterModifiedMapper.xml | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapping/MasterModifiedMapper.xml b/src/main/resources/mapping/MasterModifiedMapper.xml index 97387b4..c95b44e 100644 --- a/src/main/resources/mapping/MasterModifiedMapper.xml +++ b/src/main/resources/mapping/MasterModifiedMapper.xml @@ -4,7 +4,39 @@ <select id="selectByTableMasterId" resultType="java.util.Map" statementType="STATEMENT" > - select * from master_modified where table_name = #{tableName} and master_id = #{fields} + select * from master_modified where table_name = ${tableName} and master_id = ${masterId} + </select> + + + <insert id="insertUserByTableNameUserId" statementType="STATEMENT" > + INSERT INTO master_modified (id, table_name, master_id, ${userId}) SELECT UUID_SHORT() as id, ${tableName} as table_name, a.id as master_id, ${fieldStr} as ${userId} from + ( + SELECT temp.id from maintain_detail LEFT JOIN + ${recordTableName} temp on temp.id = maintain_detail.pre_merge_id + WHERE maintain_detail.parent_id = ${maintainId} + ) a + </insert> + + <insert id="insertJsonByTableNameUserId" statementType="STATEMENT" > + INSERT INTO master_modified (id, table_name, master_id, pre_record ) SELECT UUID_SHORT() as id, ${tableName} as table_name, a.id as master_id, ${jsonStr} as pre_record from + ( + SELECT temp.id from maintain_detail LEFT JOIN + ${recordTableName} temp on temp.id = maintain_detail.pre_merge_id + WHERE maintain_detail.parent_id = ${maintainId} + ) a + </insert> + + + <select id="selectByMaintainId" resultType="java.util.Map" statementType="STATEMENT" > + SELECT * from master_modified + WHERE EXISTS + ( + select id from + (SELECT std_id as id from maintain_detail LEFT JOIN + ${recoedTableName} temp on temp.id = maintain_detail.pre_merge_id + WHERE maintain_detail.parent_id = ${maintainId}) + a + where a.id = master_modified.master_id) </select> </mapper> -- Gitblit v1.8.0