Commit 0cdd01e7 by 谢海旭

模板新增/更新 接口使用手写sql

1 parent a5fb1003
...@@ -15,4 +15,8 @@ public interface SopTplMapper extends CommonBaseMapper<SopTpl> { ...@@ -15,4 +15,8 @@ public interface SopTplMapper extends CommonBaseMapper<SopTpl> {
List<SopTplDTO> page(SopTplSearch search); List<SopTplDTO> page(SopTplSearch search);
SopTplDTO getById(@Param("tplId") String tplId); SopTplDTO getById(@Param("tplId") String tplId);
int insertCustom(SopTpl sopTpl);
int updateByPrimaryKeyCustom(SopTpl sopTpl);
} }
\ No newline at end of file \ No newline at end of file
...@@ -91,12 +91,12 @@ public class SopTplService { ...@@ -91,12 +91,12 @@ public class SopTplService {
if (StrUtil.isEmpty(tplId)) { if (StrUtil.isEmpty(tplId)) {
tplId = StrUtil.sub(SnowFlake.nextSerialNumber(), 0, 8); tplId = StrUtil.sub(SnowFlake.nextSerialNumber(), 0, 8);
sopTpl.setTplId(tplId); sopTpl.setTplId(tplId);
sopTplMapper.insert(sopTpl); sopTplMapper.insertCustom(sopTpl);
} else { } else {
sopTplNodeMapper.deleteByExample(Example.builder(SopTplNode.class).where(Sqls.custom().andEqualTo("tplId", tplId)).build()); sopTplNodeMapper.deleteByExample(Example.builder(SopTplNode.class).where(Sqls.custom().andEqualTo("tplId", tplId)).build());
sopTplLinkMapper.deleteByExample(Example.builder(SopTplLink.class).where(Sqls.custom().andEqualTo("tplId", tplId)).build()); sopTplLinkMapper.deleteByExample(Example.builder(SopTplLink.class).where(Sqls.custom().andEqualTo("tplId", tplId)).build());
sopTplMapper.updateByPrimaryKey(sopTpl); sopTplMapper.updateByPrimaryKeyCustom(sopTpl);
} }
List<SopTplNode> nodes = sopTplDTO.getNodes(); List<SopTplNode> nodes = sopTplDTO.getNodes();
......
...@@ -26,6 +26,24 @@ ...@@ -26,6 +26,24 @@
tpl_id, tpl_name, tpl_cron, tpl_remark, tpl_status, tpl_param_def, tpl_result_def, tpl_id, tpl_name, tpl_cron, tpl_remark, tpl_status, tpl_param_def, tpl_result_def,
tpl_singleton, create_time, update_time tpl_singleton, create_time, update_time
</sql> </sql>
<insert id="insertCustom">
insert into sop_tpl(
tpl_id, tpl_name, tpl_cron, tpl_remark, tpl_status, tpl_param_def, tpl_result_def, tpl_singleton
) values (
#{tplId}, #{tplName}, #{tplCron}, #{tplRemark}, #{tplStatus}, #{tplParamDef}, #{tplResultDef}, #{tplSingleton}
)
</insert>
<update id="updateByPrimaryKeyCustom">
update sop_tpl set
tpl_name = #{tplName},
tpl_cron = #{tplCron},
tpl_remark = #{tplRemark},
tpl_status = #{tplStatus},
tpl_param_def = #{tplParamDef},
tpl_result_def = #{tplResultDef},
tpl_singleton = #{tplSingleton}
where tpl_id = #{tplId}
</update>
<select id="page" resultMap="BaseResultDTOMap"> <select id="page" resultMap="BaseResultDTOMap">
select select
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!