ArtCatMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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.zhyc.xps.sys.mapper.ArtCatMapper">
  4. <resultMap id="ArtCatDtoMap" type="com.zhyc.xps.sys.dto.ArtCatDto">
  5. <result column="art_cat_id" property="artCatId" jdbcType="BIGINT" />
  6. <result column="art_cat_title" property="artCatTitle" jdbcType="VARCHAR"/>
  7. <result column="art_cat_desc" property="artCatDesc" jdbcType="VARCHAR"/>
  8. <result column="parent_id" property="parentId" jdbcType="BIGINT" />
  9. <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
  10. <result column="root_id" property="rootId" jdbcType="BIGINT" />
  11. <result column="node_left" property="nodeLeft" jdbcType="BIGINT" />
  12. <result column="node_right" property="nodeRight" jdbcType="BIGINT" />
  13. <result column="node_level" property="nodeLevel" jdbcType="BIGINT" />
  14. <result column="is_leaf" property="isLeaf" jdbcType="BIGINT" />
  15. </resultMap>
  16. <sql id="ArtCatDto_Cols">
  17. art_cat_id,
  18. art_cat_title,
  19. art_cat_desc,
  20. parent_id,
  21. is_fixed,
  22. root_id,
  23. node_left,
  24. node_right,
  25. node_level,
  26. is_leaf
  27. </sql>
  28. <!--根据ID获取信息-->
  29. <select id="getById" resultMap="ArtCatDtoMap">
  30. SELECT
  31. <include refid="ArtCatDto_Cols"/>
  32. FROM art_cat
  33. WHERE 1 = 1
  34. <if test="ocId != null">
  35. AND oc_id = #{ocId ,jdbcType=BIGINT}
  36. </if>
  37. <if test="artCatId != null">
  38. AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
  39. </if>
  40. </select>
  41. <!--分页查询-->
  42. <select id="getByPage" parameterType="java.util.Map" resultMap="ArtCatDtoMap">
  43. SELECT
  44. <include refid="ArtCatDto_Cols"/>
  45. FROM art_cat
  46. WHERE 1 = 1 AND deleted_flag = 0
  47. <if test="ocId != null">
  48. AND oc_id = #{ocId ,jdbcType=BIGINT}
  49. </if>
  50. <if test="keywords != null and keywords != ''">
  51. and art_cat_title like "%"#{keywords}"%"
  52. </if>
  53. <if test="nodeLeft != null and nodeRight != null">
  54. <![CDATA[
  55. AND node_left > #{nodeLeft ,jdbcType=BIGINT}
  56. AND node_right < #{nodeRight ,jdbcType=BIGINT}
  57. ]]>
  58. </if>
  59. ORDER BY art_cat_id ASC
  60. </select>
  61. <!--列表查询-->
  62. <select id="getByList" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
  63. SELECT
  64. <include refid="ArtCatDto_Cols"/>
  65. FROM art_cat
  66. WHERE 1 = 1 AND deleted_flag = 0
  67. <if test="ocId != null">
  68. AND oc_id = #{ocId ,jdbcType=BIGINT}
  69. </if>
  70. <if test="keywords != null and keywords != ''">
  71. AND art_cat_title like "%"#{keywords}"%"
  72. </if>
  73. <if test="nodeLeft != null and nodeRight != null">
  74. <![CDATA[
  75. AND node_left > #{nodeLeft ,jdbcType=BIGINT}
  76. AND node_right < #{nodeRight ,jdbcType=BIGINT}
  77. ]]>
  78. </if>
  79. </select>
  80. <!--列表查询一级结点-->
  81. <select id="getRootByList" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
  82. SELECT
  83. <include refid="ArtCatDto_Cols"/>
  84. FROM art_cat
  85. WHERE 1 = 1 AND deleted_flag = 0 AND parent_id = 0
  86. <if test="ocId != null">
  87. AND oc_id = #{ocId ,jdbcType=BIGINT}
  88. </if>
  89. <if test="keywords != null and keywords != ''">
  90. AND art_cat_title like "%"#{keywords}"%"
  91. </if>
  92. <if test="nodeLeft != null and nodeRight != null">
  93. <![CDATA[
  94. AND node_left > #{nodeLeft ,jdbcType=BIGINT}
  95. AND node_right < #{nodeRight ,jdbcType=BIGINT}
  96. ]]>
  97. </if>
  98. </select>
  99. <!--分页查询-->
  100. <select id="getByPageWithRoot" parameterType="java.util.Map" resultMap="ArtCatDtoMap">
  101. SELECT
  102. <include refid="ArtCatDto_Cols"/>
  103. FROM art_cat
  104. WHERE 1 = 1 AND deleted_flag = 0
  105. <if test="ocId != null">
  106. AND oc_id = #{ocId ,jdbcType=BIGINT}
  107. </if>
  108. <if test="keywords != null and keywords != ''">
  109. and art_cat_title like "%"#{keywords}"%"
  110. </if>
  111. <if test="nodeLeft != null and nodeRight != null">
  112. <![CDATA[
  113. AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
  114. AND node_right <= #{nodeRight ,jdbcType=BIGINT}
  115. ]]>
  116. </if>
  117. ORDER BY art_cat_id ASC
  118. </select>
  119. <!--列表查询-->
  120. <select id="getByListWithRoot" resultMap="ArtCatDtoMap" parameterType="java.util.Map">
  121. SELECT
  122. <include refid="ArtCatDto_Cols"/>
  123. FROM art_cat
  124. WHERE 1 = 1 AND deleted_flag = 0
  125. <if test="ocId != null">
  126. AND oc_id = #{ocId ,jdbcType=BIGINT}
  127. </if>
  128. <if test="keywords != null and keywords != ''">
  129. AND art_cat_title like "%"#{keywords}"%"
  130. </if>
  131. <if test="nodeLeft != null and nodeRight != null">
  132. <![CDATA[
  133. AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
  134. AND node_right <= #{nodeRight ,jdbcType=BIGINT}
  135. ]]>
  136. </if>
  137. </select>
  138. <insert id="create" parameterType="com.zhyc.xps.sys.entity.ArtCat">
  139. INSERT INTO art_cat
  140. <trim prefix="(" suffix=")" suffixOverrides=",">
  141. <if test="ocId != null">
  142. oc_id,
  143. </if>
  144. <if test="artCatId != null">
  145. art_cat_id,
  146. </if>
  147. <if test="artCatTitle != null and artCatTitle != ''">
  148. art_cat_title,
  149. </if>
  150. <if test="artCatDesc != null and artCatDesc != ''">
  151. art_cat_desc,
  152. </if>
  153. <if test="isFixed != null">
  154. is_fixed,
  155. </if>
  156. <if test="parentId != null">
  157. parent_id,
  158. </if>
  159. <if test="rootId != null">
  160. root_id,
  161. </if>
  162. <if test="nodeLeft != null">
  163. node_left,
  164. </if>
  165. <if test="nodeRight != null">
  166. node_right,
  167. </if>
  168. <if test="nodeLevel != null">
  169. node_level,
  170. </if>
  171. <if test="isLeaf != null">
  172. is_leaf,
  173. </if>
  174. <if test="createdBy != null">
  175. created_by,
  176. </if>
  177. <if test="createdAt != null">
  178. created_at,
  179. </if>
  180. </trim>
  181. <trim prefix="values (" suffix=")" suffixOverrides=",">
  182. <if test="ocId != null">
  183. #{ocId ,jdbcType=BIGINT},
  184. </if>
  185. <if test="artCatId != null">
  186. #{artCatId ,jdbcType=BIGINT},
  187. </if>
  188. <if test="artCatTitle != null and artCatTitle !=''">
  189. #{artCatTitle ,jdbcType=VARCHAR},
  190. </if>
  191. <if test="artCatDesc != null and artCatDesc !=''">
  192. #{artCatDesc ,jdbcType=VARCHAR},
  193. </if>
  194. <if test="isFixed != null">
  195. #{isFixed ,jdbcType=BIGINT},
  196. </if>
  197. <if test="parentId != null">
  198. #{parentId ,jdbcType=BIGINT},
  199. </if>
  200. <if test="rootId != null">
  201. #{rootId ,jdbcType=BIGINT},
  202. </if>
  203. <if test="nodeLeft != null">
  204. #{nodeLeft ,jdbcType=BIGINT},
  205. </if>
  206. <if test="nodeRight != null">
  207. #{nodeRight ,jdbcType=BIGINT},
  208. </if>
  209. <if test="nodeLevel != null">
  210. #{nodeLevel ,jdbcType=BIGINT},
  211. </if>
  212. <if test="isLeaf != null">
  213. #{isLeaf ,jdbcType=BIGINT},
  214. </if>
  215. <if test="createdBy != null">
  216. #{createdBy ,jdbcType=BIGINT},
  217. </if>
  218. <if test="createdAt != null">
  219. #{createdAt ,jdbcType=TIMESTAMP},
  220. </if>
  221. </trim>
  222. </insert>
  223. <!--更新-->
  224. <update id="update" parameterType="com.zhyc.xps.sys.entity.ArtCat">
  225. UPDATE art_cat
  226. <trim suffixOverrides=",">
  227. <set>
  228. <if test="artCatTitle != null and artCatTitle != ''">
  229. art_cat_title = #{artCatTitle, jdbcType=VARCHAR},
  230. </if>
  231. <if test="artCatDesc != null and artCatDesc != ''">
  232. art_cat_desc = #{artCatDesc, jdbcType=VARCHAR},
  233. </if>
  234. <if test="isFixed != null">
  235. is_fixed = #{isFixed ,jdbcType=BIGINT},
  236. </if>
  237. <if test="parentId != null">
  238. parent_id = #{parentId ,jdbcType=BIGINT},
  239. </if>
  240. <if test="rootId != null">
  241. root_id = #{rootId ,jdbcType=BIGINT},
  242. </if>
  243. <if test="nodeLeft != null">
  244. node_left = #{nodeLeft ,jdbcType=BIGINT},
  245. </if>
  246. <if test="nodeRight != null">
  247. node_right = #{nodeRight ,jdbcType=BIGINT},
  248. </if>
  249. <if test="nodeLevel != null">
  250. node_level = #{nodeLevel ,jdbcType=BIGINT},
  251. </if>
  252. <if test="isLeaf != null">
  253. is_leaf = #{isLeaf ,jdbcType=BIGINT},
  254. </if>
  255. <if test="updatedBy != null ">
  256. updated_by = #{updatedBy ,jdbcType=BIGINT},
  257. </if>
  258. <if test="updatedAt != null">
  259. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  260. </if>
  261. </set>
  262. </trim>
  263. WHERE 1 = 1
  264. <if test="ocId != null">
  265. AND oc_id = #{ocId ,jdbcType=BIGINT}
  266. </if>
  267. <if test="artCatId != null">
  268. AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
  269. </if>
  270. </update>
  271. <!--删除-->
  272. <update id="delete" parameterType="java.util.Map">
  273. UPDATE art_cat
  274. <trim suffixOverrides=",">
  275. <set>
  276. <if test="deletedFlag != null">
  277. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  278. </if>
  279. <if test="deletedTime != null">
  280. deleted_time = #{deletedTime,jdbcType=VARCHAR},
  281. </if>
  282. <if test="deletedBy != null">
  283. deleted_by = #{deletedBy,jdbcType=BIGINT},
  284. </if>
  285. </set>
  286. </trim>
  287. WHERE 1 = 1
  288. <if test="ocId != null">
  289. AND oc_id = #{ocId ,jdbcType=BIGINT}
  290. </if>
  291. <if test="artCatId != null">
  292. AND art_cat_id = #{artCatId ,jdbcType=BIGINT}
  293. </if>
  294. <if test="nodeLeft != null and nodeRight != null">
  295. <![CDATA[
  296. AND node_left >= #{nodeLeft ,jdbcType=BIGINT}
  297. AND node_right <= #{nodeRight ,jdbcType=BIGINT}
  298. ]]>
  299. </if>
  300. </update>
  301. </mapper>