123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?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.AlbumCategoryMapper">
- <resultMap id="AlbumCategory" type="com.redxun.knowledge.album.entity.dao.AlbumCategory">
- <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
- <result property="parent" column="PARENT" jdbcType="VARCHAR"/>
- <result property="name" column="NAME" jdbcType="VARCHAR"/>
- <result property="grade" column="GRADE" jdbcType="NUMERIC"/>
- <result property="sort" column="SORT" 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">
- PK_ID,PARENT,NAME,GRADE,SORT,IS_DEL,COMPANY_ID_,
- CREATE_DEP_ID_,TENANT_ID_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_
- </sql>
- <select id="query" resultType="com.redxun.knowledge.album.entity.dao.AlbumCategory" parameterType="java.util.Map">
- select
- <include refid="COLUMNS" />
- from KM_ALBUM_CATEGORY ac
- <where>
- ac.IS_DEL = 0
- <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
- and name like ${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 SORT
- </if>
- </select>
- <update id="insertOrUpdateBySort">
- update KM_ALBUM_CATEGORY
- set SORT = SORT + 1
- where SORT >= #{sort} and PARENT = #{parent} and IS_DEL = 0
- </update>
- <select id="findAllAlbumCategory" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
- SELECT
- <include refid="COLUMNS"/>
- FROM KM_ALBUM_CATEGORY
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- and instr(NAME,#{params.name}) > 0
- </if>
- and IS_DEL = 0 and PARENT = '0'
- </where>
- ORDER BY SORT
- </select>
- <select id="findAllAlbumCategory1" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
- SELECT
- <include refid="COLUMNS"/>
- FROM KM_ALBUM_CATEGORY
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- and instr(NAME,#{params.name}) > 0
- </if>
- and IS_DEL = 0 and PARENT = '0'
- </where>
- ORDER BY SORT
- </select>
- <select id="findAllAlbumCategory2" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
- SELECT
- <include refid="COLUMNS"/>
- FROM KM_ALBUM_CATEGORY
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- and instr(NAME,#{params.name}) > 0
- </if>
- and IS_DEL = 0 and PARENT != '0' and GRADE = 2
- </where>
- ORDER BY SORT
- </select>
- <select id="listOflevel" resultType="com.redxun.knowledge.album.entity.vo.AlbumCategoryVo">
- select
- <include refid="COLUMNS"/>
- from KM_ALBUM_CATEGORY
- where GRADE = #{level} and IS_DEL = 0
- order by SORT
- </select>
- <delete id="deleteByPkId">
- update KM_ALBUM_CATEGORY
- set IS_DEL = 1
- where PK_ID = #{ids}
- </delete>
- <update id="deleteBySort">
- update KM_ALBUM_CATEGORY
- set SORT = SORT - 1
- WHERE SORT > #{sort} and PARENT = #{parent} and IS_DEL = 0
- </update>
- <select id="selectSortList" resultType="integer">
- select SORT from KM_ALBUM_CATEGORY
- where PARENT = #{parent} and IS_DEL = 0
- ORDER BY SORT
- </select>
- <update id="swapSort">
- update KM_ALBUM_CATEGORY
- set
- SORT = #{sort}
- where PK_ID = #{pkId}
- </update>
- </mapper>
|