SysDictDao.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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.sckw.system.dao.SysDictDao">
  4. <resultMap id="BaseResultMap" type="com.sckw.system.model.SysDict">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <id column="dict_id" jdbcType="BIGINT" property="dictId" />
  7. <result column="value" jdbcType="VARCHAR" property="value" />
  8. <result column="label" jdbcType="VARCHAR" property="label" />
  9. <result column="type" jdbcType="VARCHAR" property="type" />
  10. <result column="description" jdbcType="VARCHAR" property="description" />
  11. <result column="sort" jdbcType="DECIMAL" property="sort" />
  12. <result column="parent_id" jdbcType="VARCHAR" property="parentId" />
  13. <result column="url" jdbcType="VARCHAR" property="url" />
  14. <result column="remark" jdbcType="VARCHAR" property="remark" />
  15. <result column="status" jdbcType="INTEGER" property="status" />
  16. <result column="create_by" jdbcType="BIGINT" property="createBy" />
  17. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  18. <result column="update_by" jdbcType="BIGINT" property="updateBy" />
  19. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  20. <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  21. </resultMap>
  22. <sql id="Base_Column_List">
  23. id, dict_id, value, label, type, description, sort, parent_id, remark, status, create_by,
  24. create_time, update_by, update_time, del_flag, url
  25. </sql>
  26. <insert id="insert" parameterType="com.sckw.system.model.SysDict">
  27. insert into sys_dict
  28. <trim prefix="(" suffix=")" suffixOverrides=",">
  29. <if test="id != null">
  30. id,
  31. </if>
  32. <if test="dictId != null">
  33. dict_id,
  34. </if>
  35. <if test="value != null">
  36. value,
  37. </if>
  38. <if test="label != null">
  39. label,
  40. </if>
  41. <if test="type != null">
  42. type,
  43. </if>
  44. <if test="description != null">
  45. description,
  46. </if>
  47. <if test="sort != null">
  48. sort,
  49. </if>
  50. <if test="parentId != null">
  51. parent_id,
  52. </if>
  53. <if test="remark != null">
  54. remark,
  55. </if>
  56. <if test="status != null">
  57. status,
  58. </if>
  59. <if test="createBy != null">
  60. create_by,
  61. </if>
  62. <if test="createTime != null">
  63. create_time,
  64. </if>
  65. <if test="updateBy != null">
  66. update_by,
  67. </if>
  68. <if test="updateTime != null">
  69. update_time,
  70. </if>
  71. <if test="delFlag != null">
  72. del_flag,
  73. </if>
  74. <if test="url != null">
  75. url,
  76. </if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="id != null">
  80. #{id,jdbcType=BIGINT},
  81. </if>
  82. <if test="dictId != null">
  83. #{dictId,jdbcType=BIGINT},
  84. </if>
  85. <if test="value != null">
  86. #{value,jdbcType=VARCHAR},
  87. </if>
  88. <if test="label != null">
  89. #{label,jdbcType=VARCHAR},
  90. </if>
  91. <if test="type != null">
  92. #{type,jdbcType=VARCHAR},
  93. </if>
  94. <if test="description != null">
  95. #{description,jdbcType=VARCHAR},
  96. </if>
  97. <if test="sort != null">
  98. #{sort,jdbcType=DECIMAL},
  99. </if>
  100. <if test="parentId != null">
  101. #{parentId,jdbcType=VARCHAR},
  102. </if>
  103. <if test="remark != null">
  104. #{remark,jdbcType=VARCHAR},
  105. </if>
  106. <if test="status != null">
  107. #{status,jdbcType=INTEGER},
  108. </if>
  109. <if test="createBy != null">
  110. #{createBy,jdbcType=BIGINT},
  111. </if>
  112. <if test="createTime != null">
  113. #{createTime,jdbcType=TIMESTAMP},
  114. </if>
  115. <if test="updateBy != null">
  116. #{updateBy,jdbcType=BIGINT},
  117. </if>
  118. <if test="updateTime != null">
  119. #{updateTime,jdbcType=TIMESTAMP},
  120. </if>
  121. <if test="delFlag != null">
  122. #{delFlag,jdbcType=INTEGER},
  123. </if>
  124. <if test="url != null">
  125. #{url,jdbcType=VARCHAR},
  126. </if>
  127. </trim>
  128. </insert>
  129. <update id="update" parameterType="com.sckw.system.model.SysDict">
  130. update sys_dict
  131. <set>
  132. <if test="dictId != null">
  133. dict_id = #{dictId,jdbcType=BIGINT},
  134. </if>
  135. <if test="value != null">
  136. value = #{value,jdbcType=VARCHAR},
  137. </if>
  138. <if test="label != null">
  139. label = #{label,jdbcType=VARCHAR},
  140. </if>
  141. <if test="type != null">
  142. type = #{type,jdbcType=VARCHAR},
  143. </if>
  144. <if test="description != null">
  145. description = #{description,jdbcType=VARCHAR},
  146. </if>
  147. <if test="sort != null">
  148. sort = #{sort,jdbcType=DECIMAL},
  149. </if>
  150. <if test="parentId != null">
  151. parent_id = #{parentId,jdbcType=VARCHAR},
  152. </if>
  153. <if test="remark != null">
  154. remark = #{remark,jdbcType=VARCHAR},
  155. </if>
  156. <if test="status != null">
  157. status = #{status,jdbcType=INTEGER},
  158. </if>
  159. <if test="createBy != null">
  160. create_by = #{createBy,jdbcType=BIGINT},
  161. </if>
  162. <if test="createTime != null">
  163. create_time = #{createTime,jdbcType=TIMESTAMP},
  164. </if>
  165. <if test="updateBy != null">
  166. update_by = #{updateBy,jdbcType=BIGINT},
  167. </if>
  168. <if test="updateTime != null">
  169. update_time = #{updateTime,jdbcType=TIMESTAMP},
  170. </if>
  171. <if test="delFlag != null">
  172. del_flag = #{delFlag,jdbcType=INTEGER},
  173. </if>
  174. <if test="url != null">
  175. url = #{url,jdbcType=VARCHAR},
  176. </if>
  177. </set>
  178. where id = #{id,jdbcType=BIGINT}
  179. </update>
  180. <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  181. select
  182. <include refid="Base_Column_List" />
  183. from sys_dict
  184. where id = #{id,jdbcType=BIGINT}
  185. </select>
  186. <select id="findPage" resultMap="BaseResultMap" parameterType="java.util.Map" >
  187. select
  188. <include refid="Base_Column_List" />
  189. from sys_dict
  190. where del_flag = 0
  191. <if test="type != null and type != ''">
  192. and type = #{type, jdbcType=VARCHAR}
  193. </if>
  194. <if test="label != null and label != ''">
  195. and label = #{label, jdbcType=VARCHAR}
  196. </if>
  197. <if test="value != null and value != ''">
  198. and value = #{value, jdbcType=VARCHAR}
  199. </if>
  200. ORDER BY type, create_time desc
  201. </select>
  202. <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
  203. select
  204. id, value, label, type, description, remark,url
  205. from sys_dict
  206. where del_flag = 0
  207. <if test="type != null and type != ''">
  208. and type = #{type, jdbcType=VARCHAR}
  209. </if>
  210. <if test="label != null and label != ''">
  211. and label = #{label, jdbcType=VARCHAR}
  212. </if>
  213. <if test="value != null and value != ''">
  214. and value = #{value, jdbcType=VARCHAR}
  215. </if>
  216. ORDER BY sort
  217. </select>
  218. <select id="queryByType" resultType="com.sckw.system.model.SysDict">
  219. select * from sys_dict where del_flag = 0 and type = #{type}
  220. </select>
  221. <select id="queryUnitDict" resultType="com.sckw.system.model.SysDict">
  222. select *
  223. from sys_dict
  224. where del_flag = 0
  225. and dict_id = #{dictTypeId}
  226. and parent_id = #{parentId}
  227. and (value = #{value} or label = #{label})
  228. </select>
  229. <select id="queryByTypeAndValue" resultType="com.sckw.system.model.SysDict">
  230. select *
  231. from sys_dict
  232. where del_flag = 0
  233. and type = #{type}
  234. and value = #{value} limit 1
  235. </select>
  236. <select id="selectAll" resultType="com.sckw.system.model.SysDict">
  237. select *
  238. from sys_dict
  239. where del_flag = 0
  240. </select>
  241. <select id="selectByKeys" resultType="com.sckw.system.model.SysDict">
  242. select
  243. <include refid="Base_Column_List" />
  244. from sys_dict
  245. where del_flag = 0
  246. and id in
  247. <foreach collection="list" separator="," open="(" close=")" item="item">
  248. #{item}
  249. </foreach>
  250. </select>
  251. </mapper>