118 lines
3.6 KiB
XML
118 lines
3.6 KiB
XML
<?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.ruoyi.content.mapper.GalleryQueryMapper">
|
|
<resultMap id="BaseResultMap" type="com.ruoyi.content.domain.GalleryPicInfo" >
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
This element was generated on Mon Jun 11 10:57:31 CST 2018.
|
|
-->
|
|
<id column="PIC_ID" property="picId" jdbcType="INTEGER" />
|
|
<result column="IMG_URL" property="imgUrl" jdbcType="VARCHAR" />
|
|
<result column="PIC_AD_ID" property="picAdId" jdbcType="VARCHAR" />
|
|
<result column="PIC_STATE" property="picState" jdbcType="VARCHAR" />
|
|
<result column="COMPANY_ID" property="companyId" jdbcType="VARCHAR" />
|
|
<result column="CREATE_DATE" property="createDate" jdbcType="VARCHAR" />
|
|
<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR" />
|
|
<result column="CREATE_USER" property="createUser" jdbcType="VARCHAR" />
|
|
<result column="UPDATE_DATE" property="updateDate" jdbcType="VARCHAR" />
|
|
<result column="UPDATE_TIME" property="updateTime" jdbcType="VARCHAR" />
|
|
</resultMap>
|
|
|
|
<sql id="adTitleSQL">
|
|
SELECT ad.PIC_AD_NAME
|
|
FROM cms_pic_ad_info ad
|
|
WHERE ad.PIC_AD_ID = pi.PIC_AD_ID
|
|
</sql>
|
|
<select id="selectAllWithLimit"
|
|
resultMap="BaseResultMap">
|
|
SELECT
|
|
pi.PIC_ID,
|
|
pi.IMG_URL,
|
|
(
|
|
<include refid="adTitleSQL" />
|
|
) as PIC_AD_ID,
|
|
pi.PIC_STATE,
|
|
pi.COMPANY_ID,
|
|
pi.CREATE_DATE,
|
|
pi.CREATE_TIME,
|
|
pi.CREATE_USER,
|
|
pi.UPDATE_DATE,
|
|
pi.UPDATE_TIME
|
|
FROM cms_gallery_pic_info pi
|
|
WHERE
|
|
1=1
|
|
<if test="companyId != null and companyId !=''">
|
|
and pi.COMPANY_ID = #{companyId,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="branchId != null and branchId !=''">
|
|
and pi.BRANCH_ID like CONCAT(CONCAT('%',#{branchId,jdbcType=VARCHAR},'%'))
|
|
</if>
|
|
<if test="picState != null">
|
|
and pi.PIC_STATE in
|
|
<foreach collection="picState" item="picState" index="index"
|
|
open="(" close=")" separator=",">
|
|
#{picState}
|
|
</foreach>
|
|
|
|
</if>
|
|
<if test="picId != null and picId.size() > 0">
|
|
and pi.PIC_ID in
|
|
<foreach collection="picId" item="picId" index="index"
|
|
open="(" close=")" separator=",">
|
|
#{picId}
|
|
</foreach>
|
|
</if>
|
|
order by pi.CREATE_DATE DESC,pi.CREATE_TIME DESC, pi.UPDATE_DATE
|
|
DESC,pi.UPDATE_TIME DESC
|
|
limit
|
|
#{startRow,jdbcType=DECIMAL},#{rows,jdbcType=DECIMAL}
|
|
</select>
|
|
|
|
<select id="selectChannelId" resultType="java.lang.String" parameterType="java.lang.Integer" >
|
|
SELECT distinct CHANNEL_ID
|
|
FROM cms_gallery_channel
|
|
WHERE PIC_ID = #{picId,jdbcType=INTEGER} and STATE = '0'
|
|
</select>
|
|
|
|
<select id="selectAllPicInfo"
|
|
resultMap="BaseResultMap">
|
|
SELECT
|
|
pi.PIC_ID,
|
|
pi.IMG_URL,
|
|
(
|
|
<include refid="adTitleSQL" />
|
|
) as PIC_AD_ID,
|
|
pi.PIC_STATE,
|
|
pi.COMPANY_ID,
|
|
pi.CREATE_DATE,
|
|
pi.CREATE_TIME,
|
|
pi.CREATE_USER,
|
|
pi.UPDATE_DATE,
|
|
pi.UPDATE_TIME
|
|
FROM cms_gallery_pic_info pi
|
|
WHERE
|
|
1=1
|
|
<if test="companyId != null and companyId !=''">
|
|
and pi.COMPANY_ID = #{companyId,jdbcType=VARCHAR}
|
|
</if>
|
|
<if test="branchId != null and branchId !=''">
|
|
and pi.BRANCH_ID like CONCAT(CONCAT('%',#{branchId,jdbcType=VARCHAR},'%'))
|
|
</if>
|
|
<if test="picState != null">
|
|
and pi.PIC_STATE in
|
|
<foreach collection="picState" item="picState" index="index"
|
|
open="(" close=")" separator=",">
|
|
#{picState}
|
|
</foreach>
|
|
|
|
</if>
|
|
<if test="picId != null and picId.size() > 0">
|
|
and pi.PIC_ID in
|
|
<foreach collection="picId" item="picId" index="index"
|
|
open="(" close=")" separator=",">
|
|
#{picId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
</mapper> |