| | |
| | | UPDATE ${tableTempName} t |
| | | SET deal = 1 |
| | | where EXISTS ( |
| | | SELECT pre_merge_id from maintain_detail WHERE parent_id = ${maintainId} |
| | | SELECT pre_merge_id from maintain_detail WHERE parent_id = ${maintainFieldId} |
| | | and maintain_detail.pre_merge_id = t.id |
| | | ) |
| | | </select> |
| | |
| | | <delete id="deleteTempByMaintainId"> |
| | | DELETE FROM ${tableTempName} where EXISTS ( |
| | | SELECT pre_merge_id from maintain_detail d |
| | | where parent_id = ${maintainId} and d.pre_merge_id = ${tableTempName}.id |
| | | where parent_id = ${maintainFieldId} and d.pre_merge_id = ${tableTempName}.id |
| | | ) |
| | | </delete> |
| | | |
| | |
| | | ( |
| | | SELECT std_id from ${tableTempName} tm |
| | | LEFT JOIN maintain_detail on tm.id = maintain_detail.pre_merge_id |
| | | WHERE maintain_detail.parent_id = ${maintainId} |
| | | WHERE maintain_detail.parent_id = ${maintainFieldId} |
| | | and operate = 'create' |
| | | and tm.id = t.id |
| | | ) |
| | |
| | | <select id="insertMatintainDetailFromTemp" statementType="STATEMENT" resultType="java.lang.Integer"> |
| | | |
| | | INSERT INTO maintain_detail |
| | | SELECT md5(uuid()) as id, ${maintainId} as parent_id, ${operate} as operate, id as pre_merge_id, NOW() as create_time |
| | | SELECT md5(uuid()) as id, ${maintainFieldId} as parent_id, ${operate} as operate, id as pre_merge_id, NOW() as create_time |
| | | from ${tableTempName} m WHERE m.deal = 0 |
| | | |
| | | </select> |
| | |
| | | <select id="insertMatintainDetailFromStandrad" statementType="STATEMENT" resultType="java.lang.Integer"> |
| | | |
| | | INSERT INTO maintain_detail |
| | | SELECT md5(uuid()) as id, ${maintainId} as parent_id, 'delete' as operate, id as pre_merge_id, NOW() as create_time |
| | | SELECT md5(uuid()) as id, ${maintainFieldId} as parent_id, 'delete' as operate, id as pre_merge_id, NOW() as create_time |
| | | from ${tableTempName} m WHERE m.deal = 0 |
| | | |
| | | </select> |
| | |
| | | ( |
| | | SELECT pre_merge_id from maintain_detail |
| | | LEFT JOIN maintain on maintain.id = maintain_detail.parent_id |
| | | WHERE maintain.id = ${maintainId} |
| | | WHERE maintain.id = ${maintainFieldId} |
| | | and operate = ${operate} |
| | | and maintain_detail.pre_merge_id = t.id |
| | | ) |
| | |
| | | update ${tableTempName} |
| | | INNER JOIN maintain_detail on ${tableTempName}.id = maintain_detail.pre_merge_id |
| | | set ${updateSegment} |
| | | WHERE maintain_detail.parent_id = ${maintainId} |
| | | WHERE maintain_detail.parent_id = ${maintainFieldId} |
| | | |
| | | </select> |
| | | |
| | |
| | | |
| | | DELETE ${tableTempName} from ${tableTempName} |
| | | INNER JOIN maintain_detail on maintain_detail.pre_merge_id = ${tableTempName}.id |
| | | WHERE maintain_detail.parent_id = ${maintainId} and ${tableTempName}.std_id = ${stdId} |
| | | WHERE maintain_detail.parent_id = ${maintainFieldId} and ${tableTempName}.std_id = ${stdId} |
| | | |
| | | |
| | | </select> |