ZbZdBaseInfoDao.java 5.9 KB

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