SysDictDao.xml 7.5 KB

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