ZbZdBaseInfoDao.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package thyyxxk.webserver.dao.his.targetmanagement;
  2. import org.apache.ibatis.annotations.Insert;
  3. import org.apache.ibatis.annotations.Mapper;
  4. import org.apache.ibatis.annotations.Param;
  5. import org.apache.ibatis.annotations.Select;
  6. import org.apache.ibatis.annotations.Update;
  7. import thyyxxk.webserver.entity.targetmanagement.TargetDictTree;
  8. import thyyxxk.webserver.entity.targetmanagement.TargetManagement;
  9. import thyyxxk.webserver.entity.targetmanagement.ZbZdBaseInfo;
  10. import java.util.List;
  11. /**
  12. * @description: 指标字典
  13. * @author: hsh
  14. * @date: 2023/5/30 17:24
  15. **/
  16. @Mapper
  17. public interface ZbZdBaseInfoDao {
  18. @Select("<script> " +
  19. "select zb.* from zb_zd_base_info zb " +
  20. "where zb.state = 'Y' " +
  21. "<if test='id != null'> " +
  22. " and zb.id = #{id} " +
  23. "</if>" +
  24. "<if test='pid != null'> " +
  25. " and zb.pid = #{pid} " +
  26. "</if>" +
  27. "</script>")
  28. List<ZbZdBaseInfo> selectZbZdBaseInfo(TargetManagement dto);
  29. @Select("<script> " +
  30. "select zb.* from zb_zd_base_info zb " +
  31. "where zb.state = 'Y' " +
  32. " and zb.id = #{id} " +
  33. " and zb.pid = #{pid} " +
  34. "</script>")
  35. ZbZdBaseInfo selectZbZdBaseInfoById(TargetManagement target);
  36. @Select("<script> " +
  37. " with zb_tree_view as " +
  38. "( " +
  39. "select z1.id,z1.name,z1.pid,z1.sort,z1.score " +
  40. "from zb_zd_base_info z1 " +
  41. "where z1.id = 'B' and z1.state = 'Y' " +
  42. "union all " +
  43. "select z2.id,z2.name,z2.pid,z2.sort,z2.score " +
  44. "from zb_zd_base_info z2, zb_tree_view " +
  45. "where z2.pid = zb_tree_view.id and z2.state = 'Y' " +
  46. ") " +
  47. "select tree.id, tree.name as label, tree.pid, tree.sort, tree.score " +
  48. "from zb_tree_view tree " +
  49. "order by len(case when charindex('-', tree.sort) = 0 then tree.sort else substring(tree.sort,1,charindex('-',tree.sort)-1) end) " +
  50. "</script>")
  51. List<TargetDictTree> selectTargetDictTree(TargetManagement dto);
  52. @Insert("insert into zb_zd_base_info (id, name, pid, sort, score, ratio, type, state, open_time, dept, dept_code, " +
  53. "op, op_id, definition, method, score_rule, source, is_leaf, child_id, mom_id) " +
  54. "values (#{id},#{name},#{pid},#{sort},#{score},#{ratio},#{type},#{state},#{openTime},#{dept},#{deptCode}, " +
  55. "#{op},#{opId},#{definition},#{method},#{scoreRule},#{source},#{isLeaf},#{childId},#{momId})")
  56. int saveZbZdBaseInfo(ZbZdBaseInfo zbZdBaseInfo);
  57. @Update("<script>" +
  58. "update zb_zd_base_info " +
  59. "<trim prefix=\"set\" suffixOverrides=\",\">" +
  60. "<if test=\"id != null\">" +
  61. "id = #{id}, " +
  62. "</if>" +
  63. "<if test=\"name != null \">" +
  64. "name = #{name}, " +
  65. "</if>" +
  66. "<if test=\"pid != null\">" +
  67. "pid = #{pid}, " +
  68. "</if>" +
  69. "<if test=\"sort != null\">" +
  70. "sort = #{sort}, " +
  71. "</if>" +
  72. "<if test=\"score != null\">" +
  73. "score = #{score}, " +
  74. "</if>" +
  75. "<if test=\"ratio != null\">" +
  76. "ratio = #{ratio}, " +
  77. "</if>" +
  78. "<if test=\"type != null\">" +
  79. "type = #{type}, " +
  80. "</if>" +
  81. "<if test=\"state != null\">" +
  82. "state = #{state}, " +
  83. "</if>" +
  84. "<if test=\"openTime != null\">" +
  85. "open_time = #{openTime}, " +
  86. "</if>" +
  87. "<if test=\"dept != null\">" +
  88. "dept = #{dept}, " +
  89. "</if>" +
  90. "<if test=\"deptCode != null\">" +
  91. "dept_code = #{deptCode}, " +
  92. "</if>" +
  93. "<if test=\"op != null\">" +
  94. "op = #{op}, " +
  95. "</if>" +
  96. "<if test=\"opId != null\">" +
  97. "op_id = #{opId}, " +
  98. "</if>" +
  99. "<if test=\"definition != null\">" +
  100. "definition = #{definition}, " +
  101. "</if>" +
  102. "<if test=\"method != null\">" +
  103. "method = #{method}, " +
  104. "</if>" +
  105. "<if test=\"scoreRule != null\">" +
  106. "score_rule = #{scoreRule}, " +
  107. "</if>" +
  108. "<if test=\"source != null\">" +
  109. "source = #{source}, " +
  110. "</if>" +
  111. "<if test=\"isLeaf != null\">" +
  112. "is_leaf = #{isLeaf}, " +
  113. "</if>" +
  114. "<if test=\"childId != null\">" +
  115. "child_id = #{childId}, " +
  116. "</if>" +
  117. "<if test=\"momId != null\">" +
  118. "mom_id = #{momId}, " +
  119. "</if>" +
  120. "</trim>" +
  121. "where id = #{id} and pid = #{pid} and state = 'Y' " +
  122. "</script>")
  123. int updateZbZdBaseInfo(ZbZdBaseInfo zbZdBaseInfo);
  124. @Update("<script> " +
  125. " delete from zb_zd_base_info where id = #{id} and pid = #{pid} " +
  126. "</script>")
  127. int deleteTargetDictById(@Param("id") String id, @Param("pid") String pid);
  128. @Update("<script> " +
  129. " update zb_zd_base_info " +
  130. "<trim prefix=\"set\" suffixOverrides=\",\">" +
  131. "<if test=\"childId != null\">" +
  132. "child_id = #{childId}, " +
  133. "</if>" +
  134. "<if test=\"momId != null \">" +
  135. "mom_id = #{momId}, " +
  136. "</if>" +
  137. "</trim>" +
  138. " where id = #{id} and pid = #{pid} and state = 'Y' " +
  139. "</script>")
  140. void updateZbZdBaseInfoCalcId(@Param("id") String id, @Param("pid") String pid, @Param("childId") String calcId, @Param("momId") String momId);
  141. }