BannerMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.mapper.BannerMapper">
  4. <resultMap id="Banner" type="com.redxun.knowledge.entity.dao.Banner">
  5. <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
  6. <result property="type" column="TYPE" jdbcType="INTEGER"/>
  7. <result property="name" column="NAME" jdbcType="VARCHAR"/>
  8. <result property="summary" column="SUMMARY" jdbcType="VARCHAR"/>
  9. <result property="bannerFile" column="BANNER_FILE" jdbcType="VARCHAR"/>
  10. <result property="knowledgeId" column="KNOWLEDGE_ID" jdbcType="VARCHAR"/>
  11. <result property="sort" column="SORT" jdbcType="INTEGER"/>
  12. <result property="enabled" column="ENABLED" jdbcType="INTEGER"/>
  13. <result property="isDel" column="IS_DEL" jdbcType="INTEGER"/>
  14. <result property="companyId" column="COMPANY_ID_" jdbcType="VARCHAR"/>
  15. <result property="createDepId" column="CREATE_DEP_ID_" jdbcType="VARCHAR"/>
  16. <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR"/>
  17. <result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
  18. <result property="createTime" column="CREATE_TIME_" jdbcType="DATE"/>
  19. <result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
  20. <result property="updateTime" column="UPDATE_TIME_" jdbcType="DATE"/>
  21. </resultMap>
  22. <sql id="COLUMNS">
  23. PK_ID,TYPE,NAME,SUMMARY,BANNER_FILE,KNOWLEDGE_ID,SORT,
  24. ENABLED,IS_DEL,COMPANY_ID_,CREATE_DEP_ID_,TENANT_ID_,
  25. CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_
  26. </sql>
  27. <select id="query" resultType="com.redxun.knowledge.entity.dao.Banner" parameterType="java.util.Map">
  28. select PK_ID,TYPE,NAME,SUMMARY,BANNER_FILE,KNOWLEDGE_ID,SORT,
  29. ENABLED,IS_DEL,COMPANY_ID_,CREATE_DEP_ID_,TENANT_ID_,
  30. CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_ from KM_BANNER
  31. <where>
  32. <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
  33. ${w.whereSql}
  34. </if>
  35. </where>
  36. <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">
  37. ORDER BY ${w.orderBySql}
  38. </if>
  39. <if test="@rx.Ognl@isEmpty(w.orderBySql)">
  40. ORDER BY PK_ID DESC
  41. </if>
  42. </select>
  43. <select id="findAllBanner" resultType="com.redxun.knowledge.entity.vo.BannerAdminVo">
  44. SELECT
  45. <include refid="COLUMNS" />
  46. FROM KM_BANNER
  47. <where>
  48. <if test="@rx.Ognl@isNotEmpty(params.name)">
  49. NAME LIKE '%' || #{params.name} || '%'
  50. </if>
  51. <if test="@rx.Ognl@isNotEmpty(params.type)">
  52. and TYPE = #{params.type}
  53. </if>
  54. <if test="@rx.Ognl@isNotEmpty(params.enabled)">
  55. and ENABLED = #{params.enabled}
  56. </if>
  57. <if test="@rx.Ognl@isNotEmpty(params.createBy)">
  58. and CREATE_BY_ LIKE '%' || #{params.createBy} || '%'
  59. </if>
  60. <if test="@rx.Ognl@isNotEmpty(params.beginTime)">
  61. and CREATE_TIME_ &gt;= TO_DATE(#{params.beginTime}, 'YYYY-MM-DD')
  62. </if>
  63. <if test="@rx.Ognl@isNotEmpty(params.endTime)">
  64. and CREATE_TIME_ &lt;= TO_DATE(#{params.endTime}, 'YYYY-MM-DD')
  65. </if>
  66. and IS_DEL = 0
  67. </where>
  68. ORDER BY SORT ASC ,ENABLED DESC
  69. <!-- <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">-->
  70. <!-- ,${w.orderBySql}-->
  71. <!-- </if>-->
  72. <!-- <if test="@rx.Ognl@isEmpty(w.orderBySql)">-->
  73. <!-- ,UPDATE_TIME_ DESC-->
  74. <!-- </if>-->
  75. </select>
  76. <delete id="deleteBanner">
  77. update KM_BANNER
  78. SET
  79. IS_DEL = 1,UPDATE_TIME_ = sysdate
  80. where PK_ID = #{pkId}
  81. </delete>
  82. <update id="swapSort">
  83. update KM_BANNER
  84. set
  85. SORT = #{sort}
  86. where PK_ID = #{bannerId}
  87. </update>
  88. <update id="insertOrUpdateBySort">
  89. update KM_BANNER
  90. set SORT = SORT + 1
  91. where SORT >= #{sort} AND IS_DEL = 0
  92. </update>
  93. <update id="deleteBySort">
  94. update KM_BANNER
  95. set SORT = SORT - 1
  96. where SORT > #{sort}
  97. </update>
  98. </mapper>