123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?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.mapper.BannerMapper">
- <resultMap id="Banner" type="com.redxun.knowledge.entity.dao.Banner">
- <id property="pkId" column="PK_ID" jdbcType="VARCHAR"/>
- <result property="type" column="TYPE" jdbcType="INTEGER"/>
- <result property="name" column="NAME" jdbcType="VARCHAR"/>
- <result property="summary" column="SUMMARY" jdbcType="VARCHAR"/>
- <result property="bannerFile" column="BANNER_FILE" jdbcType="VARCHAR"/>
- <result property="knowledgeId" column="KNOWLEDGE_ID" jdbcType="VARCHAR"/>
- <result property="sort" column="SORT" jdbcType="INTEGER"/>
- <result property="enabled" column="ENABLED" jdbcType="INTEGER"/>
- <result property="isDel" column="IS_DEL" jdbcType="INTEGER"/>
- <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,TYPE,NAME,SUMMARY,BANNER_FILE,KNOWLEDGE_ID,SORT,
- ENABLED,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.entity.dao.Banner" parameterType="java.util.Map">
- select PK_ID,TYPE,NAME,SUMMARY,BANNER_FILE,KNOWLEDGE_ID,SORT,
- ENABLED,IS_DEL,COMPANY_ID_,CREATE_DEP_ID_,TENANT_ID_,
- CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_ from KM_BANNER
- <where>
- <if test="@rx.Ognl@isNotEmpty(w.whereSql)">
- ${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 PK_ID DESC
- </if>
- </select>
- <select id="findAllBanner" resultType="com.redxun.knowledge.entity.vo.BannerAdminVo">
- SELECT
- <include refid="COLUMNS" />
- FROM KM_BANNER
- <where>
- <if test="@rx.Ognl@isNotEmpty(params.name)">
- NAME LIKE '%' || #{params.name} || '%'
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.type)">
- and TYPE = #{params.type}
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.enabled)">
- and ENABLED = #{params.enabled}
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.createBy)">
- and CREATE_BY_ LIKE '%' || #{params.createBy} || '%'
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.beginTime)">
- and CREATE_TIME_ >= TO_DATE(#{params.beginTime}, 'YYYY-MM-DD')
- </if>
- <if test="@rx.Ognl@isNotEmpty(params.endTime)">
- and CREATE_TIME_ <= TO_DATE(#{params.endTime}, 'YYYY-MM-DD')
- </if>
- and IS_DEL = 0
- </where>
- ORDER BY SORT ASC ,ENABLED DESC
- <!-- <if test="@rx.Ognl@isNotEmpty(w.orderBySql)">-->
- <!-- ,${w.orderBySql}-->
- <!-- </if>-->
- <!-- <if test="@rx.Ognl@isEmpty(w.orderBySql)">-->
- <!-- ,UPDATE_TIME_ DESC-->
- <!-- </if>-->
- </select>
- <delete id="deleteBanner">
- update KM_BANNER
- SET
- IS_DEL = 1,UPDATE_TIME_ = sysdate
- where PK_ID = #{pkId}
- </delete>
- <update id="swapSort">
- update KM_BANNER
- set
- SORT = #{sort}
- where PK_ID = #{bannerId}
- </update>
- <update id="insertOrUpdateBySort">
- update KM_BANNER
- set SORT = SORT + 1
- where SORT >= #{sort} AND IS_DEL = 0
- </update>
- <update id="deleteBySort">
- update KM_BANNER
- set SORT = SORT - 1
- where SORT > #{sort}
- </update>
- </mapper>
|