SysDictDataMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zkqy.system.mapper.SysDictDataMapper">
  6. <resultMap type="SysDictData" id="SysDictDataResult">
  7. <id property="dictCode" column="dict_code" />
  8. <result property="dictSort" column="dict_sort" />
  9. <result property="dictLabel" column="dict_label" />
  10. <result property="dictValue" column="dict_value" />
  11. <result property="dictType" column="dict_type" />
  12. <result property="cssClass" column="css_class" />
  13. <result property="listClass" column="list_class" />
  14. <result property="isDefault" column="is_default" />
  15. <result property="status" column="status" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectDictDataVo">
  22. select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
  23. from sys_dict_data
  24. </sql>
  25. <select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
  26. <include refid="selectDictDataVo"/>
  27. <where>
  28. <if test="dictType != null and dictType != ''">
  29. AND dict_type = #{dictType}
  30. </if>
  31. <if test="dictLabel != null and dictLabel != ''">
  32. AND dict_label like concat('%', #{dictLabel}, '%')
  33. </if>
  34. <if test="status != null and status != ''">
  35. AND status = #{status}
  36. </if>
  37. </where>
  38. order by dict_sort asc
  39. </select>
  40. <select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
  41. <include refid="selectDictDataVo"/>
  42. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  43. </select>
  44. <sql id="selectDictDataVoBpm">
  45. select dict_code,
  46. dict_sort,
  47. dict_label,
  48. dict_value,
  49. dict_type,
  50. css_class,
  51. list_class,
  52. is_default,
  53. status,
  54. create_by,
  55. create_time,
  56. remark
  57. from {DBNAME}.sys_dict_data
  58. </sql>
  59. <select id="selectDictDataListBpm" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  60. resultMap="SysDictDataResult">
  61. <include refid="selectDictDataVoBpm"/>
  62. <where>
  63. <if test="dictType != null and dictType != ''">
  64. AND dict_type = #{dictType}
  65. </if>
  66. <if test="dictLabel != null and dictLabel != ''">
  67. AND dict_label like concat('%', #{dictLabel}, '%')
  68. </if>
  69. <if test="status != null and status != ''">
  70. AND status = #{status}
  71. </if>
  72. </where>
  73. order by dict_sort asc
  74. </select>
  75. <select id="selectDictLabel" resultType="String">
  76. select dict_label from sys_dict_data
  77. where dict_type = #{dictType} and dict_value = #{dictValue}
  78. </select>
  79. <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
  80. <include refid="selectDictDataVo"/>
  81. where dict_code = #{dictCode}
  82. </select>
  83. <select id="countDictDataByType" resultType="Integer">
  84. select count(1) from sys_dict_data where dict_type=#{dictType}
  85. </select>
  86. <delete id="deleteDictDataById" parameterType="Long">
  87. delete from sys_dict_data where dict_code = #{dictCode}
  88. </delete>
  89. <delete id="deleteDictDataByIds" parameterType="Long">
  90. delete from sys_dict_data where dict_code in
  91. <foreach collection="array" item="dictCode" open="(" separator="," close=")">
  92. #{dictCode}
  93. </foreach>
  94. </delete>
  95. <update id="updateDictData" parameterType="SysDictData">
  96. update sys_dict_data
  97. <set>
  98. <if test="dictSort != null">dict_sort = #{dictSort},</if>
  99. <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  100. <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  101. <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  102. <if test="cssClass != null">css_class = #{cssClass},</if>
  103. <if test="listClass != null">list_class = #{listClass},</if>
  104. <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  105. <if test="status != null">status = #{status},</if>
  106. <if test="remark != null">remark = #{remark},</if>
  107. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  108. update_time = sysdate()
  109. </set>
  110. where dict_code = #{dictCode}
  111. </update>
  112. <update id="updateDictDataType" parameterType="String">
  113. update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
  114. </update>
  115. <insert id="insertDictData" parameterType="SysDictData">
  116. insert into sys_dict_data(
  117. <if test="dictSort != null">dict_sort,</if>
  118. <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  119. <if test="dictValue != null and dictValue != ''">dict_value,</if>
  120. <if test="dictType != null and dictType != ''">dict_type,</if>
  121. <if test="cssClass != null and cssClass != ''">css_class,</if>
  122. <if test="listClass != null and listClass != ''">list_class,</if>
  123. <if test="isDefault != null and isDefault != ''">is_default,</if>
  124. <if test="status != null">status,</if>
  125. <if test="remark != null and remark != ''">remark,</if>
  126. <if test="createBy != null and createBy != ''">create_by,</if>
  127. create_time
  128. )values(
  129. <if test="dictSort != null">#{dictSort},</if>
  130. <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  131. <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  132. <if test="dictType != null and dictType != ''">#{dictType},</if>
  133. <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
  134. <if test="listClass != null and listClass != ''">#{listClass},</if>
  135. <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  136. <if test="status != null">#{status},</if>
  137. <if test="remark != null and remark != ''">#{remark},</if>
  138. <if test="createBy != null and createBy != ''">#{createBy},</if>
  139. sysdate()
  140. )
  141. </insert>
  142. </mapper>