AlbumInfoMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.AlbumInfoMapper">
  4. <resultMap id="AlbumInfo" type="com.redxun.knowledge.album.entity.dao.AlbumInfo">
  5. <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
  6. <result property="categoryId" column="CATEGORY_ID" jdbcType="VARCHAR"/>
  7. <result property="name" column="NAME" jdbcType="VARCHAR"/>
  8. <result property="cover" column="COVER" jdbcType="VARCHAR"/>
  9. <result property="ownerCompanyId" column="OWNER_COMPANY_ID" jdbcType="VARCHAR"/>
  10. <result property="ownerDepartmentId" column="OWNER_DEPARTMENT_ID" jdbcType="VARCHAR"/>
  11. <result property="ownerId" column="OWNER_ID" jdbcType="VARCHAR"/>
  12. <result property="state" column="STATE" jdbcType="NUMERIC"/>
  13. <result property="views" column="VIEWS" jdbcType="NUMERIC"/>
  14. <result property="isDel" column="IS_DEL" jdbcType="NUMERIC"/>
  15. <result property="companyId" column="COMPANY_ID_" jdbcType="VARCHAR"/>
  16. <result property="createDepId" column="CREATE_DEP_ID_" jdbcType="VARCHAR"/>
  17. <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR"/>
  18. <result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
  19. <result property="createTime" column="CREATE_TIME_" jdbcType="DATE"/>
  20. <result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
  21. <result property="updateTime" column="UPDATE_TIME_" jdbcType="DATE"/>
  22. </resultMap>
  23. <sql id="COLUMNS">
  24. distinct ai.PK_ID as pkId,CATEGORY_ID,NAME,COVER,OWNER_COMPANY_ID,OWNER_DEPARTMENT_ID,OWNER_ID,ai.STATE as state,VIEWS,ai.IS_DEL,ai.COMPANY_ID_,ai.CREATE_DEP_ID_,
  25. ai.TENANT_ID_,ai.CREATE_BY_,ai.CREATE_TIME_,ai.UPDATE_BY_,ai.UPDATE_TIME_
  26. </sql>
  27. <select id="query" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo" parameterType="java.util.Map">
  28. select
  29. <include refid="COLUMNS"/>
  30. from KM_ALBUM_INFO
  31. <where>
  32. <if test="@rx.Ognl@isNotEmpty(w.name)">
  33. NAME LIKE '%' || #{w.name} || '%'
  34. </if>
  35. <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
  36. and ${w.whereSql}
  37. </if>
  38. <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
  39. and ${w.whereSql}
  40. </if>
  41. </where>
  42. <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">
  43. ORDER BY ${w.orderBySql}
  44. </if>
  45. <if test="@rx.Ognl@isEmpty(w.orderBySql)">
  46. ORDER BY CREATE_TIME_ DESC
  47. </if>
  48. </select>
  49. <select id="findAllAlbumInfo" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo" parameterType="java.util.Map">
  50. select
  51. <include refid="COLUMNS"/>,FULLNAME_
  52. from KM_ALBUM_INFO ai
  53. JOIN LEARNING_USER_DEV.OS_USER
  54. ON OWNER_ID = USER_ID_
  55. <where>
  56. <if test="@rx.Ognl@isNotEmpty(params.name)">
  57. ai.NAME LIKE '%' || #{params.name} || '%'
  58. </if>
  59. <if test="@rx.Ognl@isNotEmpty(params.categoryId)">
  60. and CATEGORY_ID IN (
  61. SELECT PK_ID FROM KM_ALBUM_CATEGORY c WHERE c.IS_DEL = 0
  62. START WITH c.PK_ID = #{params.categoryId} CONNECT BY PRIOR c.PK_ID = c.PARENT and c.IS_DEL = 0
  63. )
  64. </if>
  65. <if test="@rx.Ognl@isNotEmpty(params.ownerName)">
  66. and FULLNAME_ LIKE '%' || #{params.ownerName} || '%'
  67. </if>
  68. <if test="@rx.Ognl@isNotEmpty(params.createTimeStart)">
  69. and TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') &gt;= #{params.createTimeStart}
  70. </if>
  71. <if test="@rx.Ognl@isNotEmpty(params.createTimeEnd)">
  72. and TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') &lt;= #{params.createTimeEnd}
  73. </if>
  74. and ai.IS_DEL = 0
  75. </where>
  76. <if test="@rx.Ognl@isNotEmpty(params.orderBySql)">
  77. ORDER BY ai.${w.orderBySql},ai.CREATE_TIME_ DESC
  78. </if>
  79. <if test="@rx.Ognl@isEmpty(params.orderBySql)">
  80. ORDER BY ai.STATE DESC, ai.CREATE_TIME_ DESC
  81. </if>
  82. </select>
  83. <select id="selectCountKnowledge" resultType="integer">
  84. select count(*) from KM_ALBUM_CATALOGUE_KNOWLEDGE
  85. where CATALOGUE_ID in
  86. (select PK_ID
  87. from KM_ALBUM_CATALOGUE
  88. where ALBUM_ID = #{albumId} and VERSION_ID = #{versionId} and IS_DEL = 0)
  89. and IS_DEL = 0
  90. </select>
  91. <select id="findAllAlbumInfoByOwnerIds" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo">
  92. select
  93. <include refid="COLUMNS"/>
  94. from KM_ALBUM_INFO ai
  95. <where>
  96. <if test="@rx.Ognl@isNotEmpty(params.name)">
  97. ai.NAME LIKE '%' || #{params.name} || '%'
  98. </if>
  99. and ai.owner_id = #{params.ownerIds} and ai.state = 1
  100. and ai.IS_DEL = 0
  101. </where>
  102. ORDER BY ai.CREATE_TIME_ DESC
  103. </select>
  104. <select id="findAllAlbumInfoByVersionState" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo">
  105. select
  106. <include refid="COLUMNS"/>
  107. from KM_ALBUM_INFO ai
  108. join KM_ALBUM_VERSION av
  109. on ai.PK_ID = av.ALBUM_ID
  110. <where>
  111. <if test="@rx.Ognl@isNotEmpty(params.name)">
  112. ai.NAME LIKE '%' || #{params.name} || '%'
  113. </if>
  114. av.STATE = #{params.versionState}
  115. and ai.IS_DEL = 0 and av.IS_DEL = 0 and ai.STATE = 1
  116. </where>
  117. ORDER BY ai.CREATE_TIME_ DESC
  118. </select>
  119. <delete id="deleteByIds">
  120. update KM_ALBUM_INFO
  121. set IS_DEL = 1
  122. where PK_ID = #{pkId}
  123. </delete>
  124. </mapper>