You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
7.2 KiB

  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.gaotao.modules.sys.mapper.SysSceneExceptionRuleMapper">
  4. <select id="searchRule" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleEntity">
  5. SELECT
  6. site,
  7. bu_no,
  8. rule_code,
  9. rule_name,
  10. apply_page,
  11. apply_button,
  12. enable_flag,
  13. create_by,
  14. create_date,
  15. update_by,
  16. update_date
  17. FROM sys_scene_exception_rule
  18. <where>
  19. 1 = 1
  20. <if test="query.userName != null and query.userName != ''">
  21. AND site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
  22. AND bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
  23. </if>
  24. <if test="query.site != null and query.site != ''">
  25. AND site = #{query.site}
  26. </if>
  27. <if test="query.ruleCode != null and query.ruleCode != ''">
  28. AND rule_code LIKE '%' + #{query.ruleCode} + '%'
  29. </if>
  30. <if test="query.ruleName != null and query.ruleName != ''">
  31. AND rule_name LIKE '%' + #{query.ruleName} + '%'
  32. </if>
  33. </where>
  34. ORDER BY ISNULL(update_date, create_date) DESC, rule_code DESC
  35. </select>
  36. <select id="getEnabledRuleListByApply" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleEntity">
  37. SELECT
  38. site,
  39. bu_no,
  40. rule_code,
  41. rule_name,
  42. apply_page,
  43. apply_button,
  44. enable_flag,
  45. create_by,
  46. create_date,
  47. update_by,
  48. update_date
  49. FROM sys_scene_exception_rule
  50. WHERE site = #{site}
  51. AND bu_no = #{buNo}
  52. AND enable_flag = 'Y'
  53. AND apply_page = #{applyPage}
  54. AND apply_button = #{applyButton}
  55. ORDER BY rule_code
  56. </select>
  57. <insert id="saveRule">
  58. INSERT INTO sys_scene_exception_rule
  59. (site, bu_no, rule_code, rule_name, apply_page, apply_button, enable_flag, create_by, create_date, update_by, update_date)
  60. VALUES
  61. (#{site}, #{buNo}, #{ruleCode}, #{ruleName}, #{applyPage}, #{applyButton}, #{enableFlag}, #{createBy}, GETDATE(), #{updateBy}, GETDATE())
  62. </insert>
  63. <update id="updateRule">
  64. UPDATE sys_scene_exception_rule
  65. SET
  66. rule_name = #{ruleName},
  67. apply_page = #{applyPage},
  68. apply_button = #{applyButton},
  69. enable_flag = #{enableFlag},
  70. update_by = #{updateBy},
  71. update_date = GETDATE()
  72. WHERE site = #{site}
  73. AND bu_no = #{buNo}
  74. AND rule_code = #{ruleCode}
  75. </update>
  76. <delete id="deleteRule">
  77. DELETE FROM sys_scene_exception_rule
  78. WHERE site = #{site}
  79. AND bu_no = #{buNo}
  80. AND rule_code = #{ruleCode}
  81. </delete>
  82. <delete id="deleteConditionByRule">
  83. DELETE FROM sys_scene_exception_rule_condition
  84. WHERE site = #{site}
  85. AND bu_no = #{buNo}
  86. AND rule_code = #{ruleCode}
  87. </delete>
  88. <select id="getConditionList" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleConditionEntity">
  89. SELECT
  90. site,
  91. bu_no,
  92. rule_code,
  93. condition_no,
  94. parent_condition_no,
  95. relation_field,
  96. compare_symbol,
  97. condition_param,
  98. force_type,
  99. warning_level,
  100. animation_effect,
  101. responsibility_dept,
  102. trigger_event,
  103. create_by,
  104. create_date,
  105. update_by,
  106. update_date
  107. FROM sys_scene_exception_rule_condition
  108. WHERE site = #{site}
  109. AND bu_no = #{buNo}
  110. AND rule_code = #{ruleCode}
  111. ORDER BY
  112. CASE WHEN ISNULL(parent_condition_no, '') = '' THEN condition_no ELSE parent_condition_no END,
  113. CASE WHEN ISNULL(parent_condition_no, '') = '' THEN 0 ELSE 1 END,
  114. condition_no
  115. </select>
  116. <select id="getCondition" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleConditionEntity">
  117. SELECT
  118. site,
  119. bu_no,
  120. rule_code,
  121. condition_no,
  122. parent_condition_no,
  123. relation_field,
  124. compare_symbol,
  125. condition_param,
  126. force_type,
  127. warning_level,
  128. animation_effect,
  129. responsibility_dept,
  130. trigger_event,
  131. create_by,
  132. create_date,
  133. update_by,
  134. update_date
  135. FROM sys_scene_exception_rule_condition
  136. WHERE site = #{site}
  137. AND bu_no = #{buNo}
  138. AND rule_code = #{ruleCode}
  139. AND condition_no = #{conditionNo}
  140. </select>
  141. <select id="countConditionNo" resultType="java.lang.Integer">
  142. SELECT COUNT(1)
  143. FROM sys_scene_exception_rule_condition
  144. WHERE site = #{site}
  145. AND bu_no = #{buNo}
  146. AND rule_code = #{ruleCode}
  147. AND condition_no = #{conditionNo}
  148. </select>
  149. <insert id="saveCondition">
  150. INSERT INTO sys_scene_exception_rule_condition
  151. (site, bu_no, rule_code, condition_no, parent_condition_no, relation_field, compare_symbol,
  152. condition_param, force_type, warning_level, animation_effect, responsibility_dept, trigger_event,
  153. create_by, create_date, update_by, update_date)
  154. VALUES
  155. (#{site}, #{buNo}, #{ruleCode}, #{conditionNo}, #{parentConditionNo}, #{relationField}, #{compareSymbol},
  156. #{conditionParam}, #{forceType}, #{warningLevel}, #{animationEffect}, #{responsibilityDept}, #{triggerEvent},
  157. #{createBy}, GETDATE(), #{updateBy}, GETDATE())
  158. </insert>
  159. <update id="updateCondition">
  160. UPDATE sys_scene_exception_rule_condition
  161. SET
  162. parent_condition_no = #{parentConditionNo},
  163. relation_field = #{relationField},
  164. compare_symbol = #{compareSymbol},
  165. condition_param = #{conditionParam},
  166. force_type = #{forceType},
  167. warning_level = #{warningLevel},
  168. animation_effect = #{animationEffect},
  169. responsibility_dept = #{responsibilityDept},
  170. trigger_event = #{triggerEvent},
  171. update_by = #{updateBy},
  172. update_date = GETDATE()
  173. WHERE site = #{site}
  174. AND bu_no = #{buNo}
  175. AND rule_code = #{ruleCode}
  176. AND condition_no = #{conditionNo}
  177. </update>
  178. <delete id="deleteCondition">
  179. DELETE FROM sys_scene_exception_rule_condition
  180. WHERE site = #{site}
  181. AND bu_no = #{buNo}
  182. AND rule_code = #{ruleCode}
  183. AND condition_no = #{conditionNo}
  184. </delete>
  185. <delete id="deleteConditionWithChildren">
  186. DELETE FROM sys_scene_exception_rule_condition
  187. WHERE site = #{site}
  188. AND bu_no = #{buNo}
  189. AND rule_code = #{ruleCode}
  190. AND (condition_no = #{conditionNo} OR parent_condition_no = #{conditionNo})
  191. </delete>
  192. </mapper>