123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.redxun.knowledge.album.mapper.AlbumInfoMapper">
- <resultMap id="AlbumInfo" type="com.redxun.knowledge.album.entity.dao.AlbumInfo">
- <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
- <result property="categoryId" column="CATEGORY_ID" jdbcType="VARCHAR"/>
- <result property="name" column="NAME" jdbcType="VARCHAR"/>
- <result property="cover" column="COVER" jdbcType="VARCHAR"/>
- <result property="ownerCompanyId" column="OWNER_COMPANY_ID" jdbcType="VARCHAR"/>
- <result property="ownerDepartmentId" column="OWNER_DEPARTMENT_ID" jdbcType="VARCHAR"/>
- <result property="ownerId" column="OWNER_ID" jdbcType="VARCHAR"/>
- <result property="state" column="STATE" jdbcType="NUMERIC"/>
- <result property="views" column="VIEWS" jdbcType="NUMERIC"/>
- <result property="isDel" column="IS_DEL" jdbcType="NUMERIC"/>
- <result property="companyId" column="COMPANY_ID_" jdbcType="VARCHAR"/>
- <result property="createDepId" column="CREATE_DEP_ID_" jdbcType="VARCHAR"/>
- <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR"/>
- <result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
- <result property="createTime" column="CREATE_TIME_" jdbcType="DATE"/>
- <result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
- <result property="updateTime" column="UPDATE_TIME_" jdbcType="DATE"/>
- </resultMap>
- <sql id="COLUMNS">
- 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_,
- ai.TENANT_ID_,ai.CREATE_BY_,ai.CREATE_TIME_,ai.UPDATE_BY_,ai.UPDATE_TIME_
- </sql>
- <select id="query" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo" parameterType="java.util.Map">
- select
- <include refid="COLUMNS"/>
- from KM_ALBUM_INFO
- <where>
- <if test="@rx.Ognl@isNotEmpty(w.name)">
- NAME LIKE '%' || #{w.name} || '%'
- </if>
- <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
- and ${w.whereSql}
- </if>
- <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
- and ${w.whereSql}
- </if>
- </where>
- <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">
- ORDER BY ${w.orderBySql}
- </if>
- <if test="@rx.Ognl@isEmpty(w.orderBySql)">
- ORDER BY CREATE_TIME_ DESC
- </if>
- </select>
- <select id="findAllAlbumInfo" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo" parameterType="java.util.Map">
- select
- <include refid="COLUMNS"/>,FULLNAME_
- from KM_ALBUM_INFO ai
- JOIN LEARNING_USER_DEV.OS_USER
- ON OWNER_ID = USER_ID_
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- ai.NAME LIKE '%' || #{params.name} || '%'
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.categoryId)">
- and CATEGORY_ID IN (
- SELECT PK_ID FROM KM_ALBUM_CATEGORY c WHERE c.IS_DEL = 0
- START WITH c.PK_ID = #{params.categoryId} CONNECT BY PRIOR c.PK_ID = c.PARENT and c.IS_DEL = 0
- )
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.ownerName)">
- and FULLNAME_ LIKE '%' || #{params.ownerName} || '%'
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.createTimeStart)">
- and TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') >= #{params.createTimeStart}
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.createTimeEnd)">
- and TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') <= #{params.createTimeEnd}
- </if>
- and ai.IS_DEL = 0
- </where>
- <if test="@rx.Ognl@isNotEmpty(params.orderBySql)">
- ORDER BY ai.${w.orderBySql},ai.CREATE_TIME_ DESC
- </if>
- <if test="@rx.Ognl@isEmpty(params.orderBySql)">
- ORDER BY ai.STATE DESC, ai.CREATE_TIME_ DESC
- </if>
- </select>
- <select id="selectCountKnowledge" resultType="integer">
- select count(*) from KM_ALBUM_CATALOGUE_KNOWLEDGE
- where CATALOGUE_ID in
- (select PK_ID
- from KM_ALBUM_CATALOGUE
- where ALBUM_ID = #{albumId} and VERSION_ID = #{versionId} and IS_DEL = 0)
- and IS_DEL = 0
- </select>
- <select id="findAllAlbumInfoByOwnerIds" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo">
- select
- <include refid="COLUMNS"/>
- from KM_ALBUM_INFO ai
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- ai.NAME LIKE '%' || #{params.name} || '%'
- </if>
- and ai.owner_id = #{params.ownerIds} and ai.state = 1
- and ai.IS_DEL = 0
- </where>
- ORDER BY ai.CREATE_TIME_ DESC
- </select>
- <select id="findAllAlbumInfoByVersionState" resultType="com.redxun.knowledge.album.entity.dao.AlbumInfo">
- select
- <include refid="COLUMNS"/>
- from KM_ALBUM_INFO ai
- join KM_ALBUM_VERSION av
- on ai.PK_ID = av.ALBUM_ID
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- ai.NAME LIKE '%' || #{params.name} || '%'
- </if>
- av.STATE = #{params.versionState}
- and ai.IS_DEL = 0 and av.IS_DEL = 0 and ai.STATE = 1
- </where>
- ORDER BY ai.CREATE_TIME_ DESC
- </select>
- <delete id="deleteByIds">
- update KM_ALBUM_INFO
- set IS_DEL = 1
- where PK_ID = #{pkId}
- </delete>
- </mapper>
|