AlbumCategoryMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.redxun.knowledge.album.mapper.AlbumCategoryMapper">
  4. <resultMap id="AlbumCategory" type="com.redxun.knowledge.album.entity.dao.AlbumCategory">
  5. <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
  6. <result property="parent" column="PARENT" jdbcType="VARCHAR"/>
  7. <result property="name" column="NAME" jdbcType="VARCHAR"/>
  8. <result property="grade" column="GRADE" jdbcType="NUMERIC"/>
  9. <result property="sort" column="SORT" jdbcType="NUMERIC"/>
  10. <result property="isDel" column="IS_DEL" jdbcType="NUMERIC"/>
  11. <result property="companyId" column="COMPANY_ID_" jdbcType="VARCHAR"/>
  12. <result property="createDepId" column="CREATE_DEP_ID_" jdbcType="VARCHAR"/>
  13. <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR"/>
  14. <result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
  15. <result property="createTime" column="CREATE_TIME_" jdbcType="DATE"/>
  16. <result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
  17. <result property="updateTime" column="UPDATE_TIME_" jdbcType="DATE"/>
  18. </resultMap>
  19. <sql id="COLUMNS">
  20. PK_ID,PARENT,NAME,GRADE,SORT,IS_DEL,COMPANY_ID_,
  21. CREATE_DEP_ID_,TENANT_ID_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_
  22. </sql>
  23. <select id="query" resultType="com.redxun.knowledge.album.entity.dao.AlbumCategory" parameterType="java.util.Map">
  24. select
  25. <include refid="COLUMNS" />
  26. from KM_ALBUM_CATEGORY ac
  27. <where>
  28. ac.IS_DEL = 0
  29. <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
  30. and name like ${w.whereSql}
  31. </if>
  32. </where>
  33. <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">
  34. ORDER BY ${w.orderBySql}
  35. </if>
  36. <if test="@rx.Ognl@isEmpty(w.orderBySql)">
  37. ORDER BY SORT
  38. </if>
  39. </select>
  40. <update id="insertOrUpdateBySort">
  41. update KM_ALBUM_CATEGORY
  42. set SORT = SORT + 1
  43. where SORT >= #{sort} and PARENT = #{parent} and IS_DEL = 0
  44. </update>
  45. <select id="findAllAlbumCategory" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
  46. SELECT
  47. <include refid="COLUMNS"/>
  48. FROM KM_ALBUM_CATEGORY
  49. <where>
  50. <if test="@rx.Ognl@isNotEmpty(params.name)">
  51. and instr(NAME,#{params.name}) > 0
  52. </if>
  53. and IS_DEL = 0 and PARENT = '0'
  54. </where>
  55. ORDER BY SORT
  56. </select>
  57. <select id="findAllAlbumCategory1" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
  58. SELECT
  59. <include refid="COLUMNS"/>
  60. FROM KM_ALBUM_CATEGORY
  61. <where>
  62. <if test="@rx.Ognl@isNotEmpty(params.name)">
  63. and instr(NAME,#{params.name}) > 0
  64. </if>
  65. and IS_DEL = 0 and PARENT = '0'
  66. </where>
  67. ORDER BY SORT
  68. </select>
  69. <select id="findAllAlbumCategory2" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
  70. SELECT
  71. <include refid="COLUMNS"/>
  72. FROM KM_ALBUM_CATEGORY
  73. <where>
  74. <if test="@rx.Ognl@isNotEmpty(params.name)">
  75. and instr(NAME,#{params.name}) > 0
  76. </if>
  77. and IS_DEL = 0 and PARENT != '0' and GRADE = 2
  78. </where>
  79. ORDER BY SORT
  80. </select>
  81. <select id="listOflevel" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
  82. select
  83. <include refid="COLUMNS"/>
  84. from KM_ALBUM_CATEGORY
  85. where GRADE = #{level} and IS_DEL = 0
  86. order by SORT
  87. </select>
  88. <delete id="deleteByPkId">
  89. update KM_ALBUM_CATEGORY
  90. set IS_DEL = 1
  91. where PK_ID = #{ids}
  92. </delete>
  93. <update id="deleteBySort">
  94. update KM_ALBUM_CATEGORY
  95. set SORT = SORT - 1
  96. WHERE SORT > #{sort} and PARENT = #{parent} and IS_DEL = 0
  97. </update>
  98. <select id="selectSortList" resultType="integer">
  99. select SORT from KM_ALBUM_CATEGORY
  100. where PARENT = #{parent} and IS_DEL = 0
  101. ORDER BY SORT
  102. </select>
  103. <update id="swapSort">
  104. update KM_ALBUM_CATEGORY
  105. set
  106. SORT = #{sort}
  107. where PK_ID = #{pkId}
  108. </update>
  109. </mapper>