SysReqRulesMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.sundata.internalevaluation.configuration.mapper.SysReqRulesMapper">
  4. <resultMap id="BaseResultMap" type="com.sundata.internalevaluation.configuration.model.SysReqRules">
  5. <result column="BELONG_PRODUCT" property="belongProduct"/>
  6. <result column="RULES_CONCLUSION_TEMPLATE" property="rulesConclusionTemplate"/>
  7. <result column="RULES_NO" property="rulesNo"/>
  8. <result column="RULES_NAME" property="rulesName"/>
  9. </resultMap>
  10. <resultMap id="detailResultMap" type="com.sundata.internalevaluation.configuration.model.SysReqRules" extends="BaseResultMap">
  11. <collection column="guize_no" ofType="java.lang.String" property="ruleIds"/>
  12. <!-- <collection column="guize_no" ofType="java.lang.String" property="ruleIds"/>-->
  13. </resultMap>
  14. <!-- 表字段 -->
  15. <sql id="baseColumns">
  16. t.BELONG_PRODUCT,
  17. t.RULES_NO,
  18. t.RULES_NAME
  19. -- , t.RULE_IDS
  20. </sql>
  21. <!-- 查询全部 -->
  22. <select id="listAll" resultMap="BaseResultMap">
  23. SELECT
  24. t.BELONG_PRODUCT,
  25. t.RULES_NO,
  26. t.RULES_NAME
  27. FROM SYS_REQ_RULES t
  28. <where>
  29. <if test="rulesNo != null and rulesNo != ''">
  30. AND rules_No like concat(concat('%',#{rulesNo}),'%')
  31. </if>
  32. <if test="rulesName != null and rulesName != ''">
  33. AND rules_Name like concat(concat('%',#{rulesName}),'%')
  34. </if>
  35. <if test="belongProduct != null and belongProduct != ''">
  36. AND belong_Product like concat(concat('%',#{belongProduct}),'%')
  37. </if>
  38. </where>
  39. </select>
  40. <!-- 根据主键获取单条记录 -->
  41. <!--
  42. SELECT
  43. r.rules_no,
  44. r.rules_name,
  45. r.BELONG_PRODUCT,
  46. rr.rule_no as guize_no
  47. FROM SYS_REQ_RULES r
  48. left join SYS_REQ_RULE_RULES rr on r.rules_no = rr.rules_no
  49. WHERE r.RULES_NO = #{rulesNo}
  50. -->
  51. <!-- <select id="getById" resultMap="detailResultMap" parameterType="java.lang.String">-->
  52. <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.String">
  53. SELECT
  54. r.rules_no,
  55. r.rules_name,
  56. r.rules_Conclusion_Template,
  57. r.BELONG_PRODUCT
  58. FROM SYS_REQ_RULES r
  59. WHERE r.RULES_NO = #{rulesNo}
  60. </select>
  61. <select id="selectRuleByRulesNo" resultType="java.lang.String" parameterType="java.lang.String">
  62. select rule_no from SYS_REQ_RULE_RULES where RULES_NO = #{rulesNo}
  63. </select>
  64. <select id="selectRulesByRuleNo" resultType="java.lang.String" parameterType="java.lang.String">
  65. select rules_no from SYS_REQ_RULE_RULES where RULE_NO = #{ruleNo}
  66. </select>
  67. <!-- 插入不为NULL的字段 -->
  68. <insert id="insertIgnoreNull" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules"
  69. keyProperty="rulesNo" keyColumn="RULES_NO" useGeneratedKeys="true"
  70. >
  71. INSERT INTO SYS_REQ_RULES
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="belongProduct != null">
  74. BELONG_PRODUCT,
  75. </if>
  76. <if test="rulesConclusionTemplate != null">
  77. rules_Conclusion_Template,
  78. </if>
  79. <if test="rulesNo != null">
  80. RULES_NO,
  81. </if>
  82. <if test="rulesName != null">
  83. RULES_NAME,
  84. </if>
  85. <!-- <if test="ruleIds != null">-->
  86. <!-- RULE_IDS,-->
  87. <!-- </if>-->
  88. </trim>
  89. <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
  90. <if test="belongProduct != null">
  91. #{belongProduct},
  92. </if>
  93. <if test="rulesConclusionTemplate != null">
  94. #{rulesConclusionTemplate},
  95. </if>
  96. <if test="rulesNo != null">
  97. #{rulesNo},
  98. </if>
  99. <if test="rulesName != null">
  100. #{rulesName},
  101. </if>
  102. <!-- <if test="ruleIds != null">-->
  103. <!-- #{ruleIds},-->
  104. <!-- </if>-->
  105. </trim>
  106. </insert>
  107. <!-- 更新不为NULL的字段 -->
  108. <update id="updateIgnoreNull" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules">
  109. UPDATE SYS_REQ_RULES
  110. <set>
  111. <if test="belongProduct != null">
  112. BELONG_PRODUCT=#{belongProduct},
  113. </if>
  114. <if test="rulesConclusionTemplate != null">
  115. rules_Conclusion_Template=#{rulesConclusionTemplate},
  116. </if>
  117. <if test="rulesName != null">
  118. RULES_NAME=#{rulesName},
  119. </if>
  120. <!-- <if test="ruleIds != null">-->
  121. <!-- RULE_IDS=#{ruleIds},-->
  122. <!-- </if>-->
  123. </set>
  124. WHERE RULES_NO = #{rulesNo}
  125. </update>
  126. <!-- 根据主键删除记录 -->
  127. <delete id="delete" parameterType="com.sundata.internalevaluation.configuration.model.SysReqRules">
  128. delete
  129. from sys_req_rules
  130. WHERE RULES_NO = #{rulesNo}
  131. </delete>
  132. <delete id="deleteAssociateRuleByRulesNo" parameterType="java.lang.String">
  133. delete
  134. from sys_req_rule_rules
  135. WHERE RULES_NO = #{rulesNo}
  136. </delete>
  137. <insert id="insertAssociateRule"
  138. parameterType="java.util.List">
  139. INSERT ALL
  140. <foreach collection="associateRules" index="id" item="item">
  141. INTO sys_req_rule_rules(RULE_NO, RULES_NO)
  142. VALUES ( #{item.ruleNo}, #{item.rulesNo})
  143. </foreach>
  144. SELECT 1 FROM dual
  145. </insert>
  146. <!-- 规则集生成字典 -->
  147. <select id="selectRulesToDictContent" resultType="com.sundata.admin.nounmanage.model.DictContent">
  148. select RULES_NO as id, RULES_NAME as text from SYS_REQ_RULES
  149. </select>
  150. </mapper>