SysDictDataMapper.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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="com.zkqy.common.core.domain.entity.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,
  23. dict_sort,
  24. dict_label,
  25. dict_value,
  26. dict_type,
  27. css_class,
  28. list_class,
  29. is_default,
  30. status,
  31. create_by,
  32. create_time,
  33. remark
  34. from {DBNAME}.sys_dict_data
  35. </sql>
  36. <sql id="selectDictDataVoTwo">
  37. select dict_code,
  38. dict_sort,
  39. dict_label,
  40. dict_value,
  41. dict_type,
  42. css_class,
  43. list_class,
  44. is_default,
  45. status,
  46. create_by,
  47. create_time,
  48. remark
  49. from `ry-vue-call`.sys_dict_data
  50. </sql>
  51. <sql id="selectDictDataVoSan">
  52. select dict_value
  53. from sys_dict_data
  54. </sql>
  55. <sql id="selectDictDataVoBpm">
  56. select dict_code,
  57. dict_sort,
  58. dict_label,
  59. dict_value,
  60. dict_type,
  61. css_class,
  62. list_class,
  63. is_default,
  64. status,
  65. create_by,
  66. create_time,
  67. remark
  68. from {DBNAME}.sys_dict_data
  69. </sql>
  70. <select id="selectDictDataList" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  71. resultMap="SysDictDataResult">
  72. <include refid="selectDictDataVo"/>
  73. <where>
  74. <if test="dictType != null and dictType != ''">
  75. AND dict_type = #{dictType}
  76. </if>
  77. <if test="dictLabel != null and dictLabel != ''">
  78. AND dict_label like concat('%', #{dictLabel}, '%')
  79. </if>
  80. <if test="status != null and status != ''">
  81. AND status = #{status}
  82. </if>
  83. </where>
  84. order by dict_sort asc
  85. </select>
  86. <select id="selectDictDataListTwo" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  87. resultMap="SysDictDataResult">
  88. <include refid="selectDictDataVoTwo"/>
  89. <where>
  90. <if test="dictType != null and dictType != ''">
  91. AND dict_type = #{dictType}
  92. </if>
  93. <if test="dictLabel != null and dictLabel != ''">
  94. AND dict_label like concat('%', #{dictLabel}, '%')
  95. </if>
  96. <if test="status != null and status != ''">
  97. AND status = #{status}
  98. </if>
  99. </where>
  100. order by dict_sort asc
  101. </select>
  102. <select id="selectDictDataListBpm" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  103. resultMap="SysDictDataResult">
  104. <include refid="selectDictDataVoBpm"/>
  105. <where>
  106. <if test="dictType != null and dictType != ''">
  107. AND dict_type = #{dictType}
  108. </if>
  109. <if test="dictLabel != null and dictLabel != ''">
  110. AND dict_label like concat('%', #{dictLabel}, '%')
  111. </if>
  112. <if test="status != null and status != ''">
  113. AND status = #{status}
  114. </if>
  115. </where>
  116. order by dict_sort asc
  117. </select>
  118. <select id="selectDictDataByType" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  119. resultMap="SysDictDataResult">
  120. <include refid="selectDictDataVo"/>
  121. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  122. </select>
  123. <select id="selectDictDataByTypeAll" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  124. resultMap="SysDictDataResult">
  125. <include refid="selectDictDataVoTwo"/>
  126. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  127. </select>
  128. <select id="selectDictDataByTypeAllTenant" parameterType="com.zkqy.common.core.domain.entity.SysDictData"
  129. resultMap="SysDictDataResult">
  130. <include refid="selectDictDataVo"/>
  131. where status = '0' and dict_type = #{dictType} order by dict_sort asc
  132. </select>
  133. <select id="selectDictLabel" resultType="String">
  134. select dict_label
  135. from {DBNAME}.sys_dict_data
  136. where dict_type = #{dictType}
  137. and dict_value = #{dictValue}
  138. </select>
  139. <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
  140. <include refid="selectDictDataVo"/>
  141. where dict_code = #{dictCode}
  142. </select>
  143. <select id="countDictDataByType" resultType="Integer">
  144. select count(1)
  145. from {DBNAME}.sys_dict_data
  146. where dict_type=#{dictType}
  147. </select>
  148. <select id="selectDictDataByDictLabel" parameterType="string" resultType="string">
  149. select dict_value
  150. from {DBNAME}.sys_dict_data
  151. where dict_label = #{dictLabel}
  152. </select>
  153. <select id="selectDictDataByDictLabelfjqydb" parameterType="string" resultType="string">
  154. select dict_value
  155. from fjqydb.sys_dict_data
  156. where dict_label = #{dictLabel}
  157. </select>
  158. <delete id="deleteDictDataById" parameterType="Long">
  159. delete
  160. from {DBNAME}.sys_dict_data
  161. where dict_code = #{dictCode}
  162. </delete>
  163. <delete id="deleteDictDataByIds" parameterType="Long">
  164. delete from {DBNAME}.sys_dict_data where dict_code in
  165. <foreach collection="array" item="dictCode" open="(" separator="," close=")">
  166. #{dictCode}
  167. </foreach>
  168. </delete>
  169. <update id="updateDictData" parameterType="com.zkqy.common.core.domain.entity.SysDictData">
  170. update {DBNAME}.sys_dict_data
  171. <set>
  172. <if test="dictSort != null">dict_sort = #{dictSort},</if>
  173. <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  174. <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  175. <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
  176. <if test="cssClass != null">css_class = #{cssClass},</if>
  177. <if test="listClass != null">list_class = #{listClass},</if>
  178. <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
  179. <if test="status != null">status = #{status},</if>
  180. <if test="remark != null">remark = #{remark},</if>
  181. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  182. update_time = sysdate()
  183. </set>
  184. where dict_code = #{dictCode}
  185. </update>
  186. <update id="updateDictDataType" parameterType="String">
  187. update {DBNAME}.sys_dict_data
  188. set dict_type = #{newDictType}
  189. where dict_type = #{oldDictType}
  190. </update>
  191. <insert id="insertDictData" parameterType="com.zkqy.common.core.domain.entity.SysDictData">
  192. insert into {DBNAME}.sys_dict_data(
  193. <if test="dictSort != null">dict_sort,</if>
  194. <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  195. <if test="dictValue != null and dictValue != ''">dict_value,</if>
  196. <if test="dictType != null and dictType != ''">dict_type,</if>
  197. <if test="cssClass != null and cssClass != ''">css_class,</if>
  198. <if test="listClass != null and listClass != ''">list_class,</if>
  199. <if test="isDefault != null and isDefault != ''">is_default,</if>
  200. <if test="status != null">status,</if>
  201. <if test="remark != null and remark != ''">remark,</if>
  202. <if test="createBy != null and createBy != ''">create_by,</if>
  203. create_time
  204. )values(
  205. <if test="dictSort != null">#{dictSort},</if>
  206. <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  207. <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  208. <if test="dictType != null and dictType != ''">#{dictType},</if>
  209. <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
  210. <if test="listClass != null and listClass != ''">#{listClass},</if>
  211. <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
  212. <if test="status != null">#{status},</if>
  213. <if test="remark != null and remark != ''">#{remark},</if>
  214. <if test="createBy != null and createBy != ''">#{createBy},</if>
  215. sysdate()
  216. )
  217. </insert>
  218. </mapper>