123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?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.caimei.modules.landing.mapper.CmBrandLandingMapper">
- <resultMap type="CmBrandLanding" id="CmBrandLandingResult">
- <result property="id" column="id" />
- <result property="authUserId" column="authUserId" />
- <result property="type" column="type" />
- <result property="levelType" column="levelType" />
- <result property="authorId" column="authorId" />
- <result property="headPcBanner" column="headPcBanner" />
- <result property="headAppBanner" column="headAppBanner" />
- <result property="jumpStatus" column="jumpStatus" />
- <result property="jumpPcPicture" column="jumpPcPicture" />
- <result property="jumpAppPicture" column="jumpAppPicture" />
- <result property="jumpLink" column="jumpLink" />
- <result property="title" column="title" />
- <result property="content" column="content" />
- <result property="video" column="video" />
- <result property="sort" column="sort" />
- <result property="pcStatus" column="pcStatus" />
- <result property="appStatus" column="appStatus" />
- <result property="delFlag" column="delFlag" />
- <result property="updateTime" column="updateTime" />
- <result property="addTime" column="addTime" />
- <result property="pv" column="pv"/>
- </resultMap>
- <sql id="selectCmBrandLandingVo">
- select a.id,
- a.authUserId,
- a.type,
- a.levelType,
- a.authorId,
- a.headPcBanner,
- a.headAppBanner,
- a.jumpStatus,
- a.jumpPcPicture,
- a.jumpAppPicture,
- a.jumpLink,
- a.jumpAppLink,
- a.title,
- a.content,
- a.video,
- a.sort,
- a.pcStatus,
- a.appStatus,
- a.delFlag,
- a.updateTime,
- a.addTime,
- a.productId,
- a.bookStatus,
- a.bookStartDate,
- a.bookEndDate,
- a.auditStatus,
- a.auditTime,
- a.failReason,
- a.publishSource
- </sql>
- <select id="selectCmBrandLandingList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
- <include refid="selectCmBrandLandingVo"/>
- <if test="statisticsType != null and statisticsType != ''">
- ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = #{statisticsType} and a.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
- </if>
- from cm_brand_landing a
- <where>delFlag = 0
- <if test="id != null and id != ''">and id = #{id}</if>
- <if test="authUserId != null ">and authUserId = #{authUserId}</if>
- <if test="type != null ">and type = #{type}</if>
- <if test="levelType != null ">and levelType = #{levelType}</if>
- <if test="authorId != null ">and authorId = #{authorId}</if>
- <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
- <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
- <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
- <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
- <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
- <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
- <if test="title != null and title != ''"> and title = #{title}</if>
- <if test="content != null and content != ''"> and content = #{content}</if>
- <if test="video != null and video != ''"> and video = #{video}</if>
- <if test="sort != null "> and sort = #{sort}</if>
- <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
- <if test="appStatus != null "> and appStatus = #{appStatus}</if>
- <if test="delFlag != null "> and delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and updateTime = #{updateTime}</if>
- <if test="addTime != null "> and addTime = #{addTime}</if>
- <if test="publishSource != null "> and publishSource = #{publishSource}</if>
- </where>
- order by sort desc
- </select>
- <select id="findList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
- <include refid="selectCmBrandLandingVo"/>
- <if test="statisticsType != null and statisticsType != ''">
- ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = #{statisticsType} and a.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
- </if>
- ,(select s.name from shop s where s.userId=a.authUserId) as shopName
- from cm_brand_landing a
- <where>delFlag = 0
- <if test="id != null and id != ''">and id = #{id}</if>
- <if test="authUserId != null ">and authUserId = #{authUserId}</if>
- <if test="type != null ">and type = #{type}</if>
- <if test="levelType != null ">and levelType = #{levelType}</if>
- <if test="authorId != null ">and authorId = #{authorId}</if>
- <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
- <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
- <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
- <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
- <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
- <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
- <if test="title != null and title != ''"> and title = #{title}</if>
- <if test="content != null and content != ''"> and content = #{content}</if>
- <if test="video != null and video != ''"> and video = #{video}</if>
- <if test="sort != null "> and sort = #{sort}</if>
- <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
- <if test="appStatus != null "> and appStatus = #{appStatus}</if>
- <if test="delFlag != null "> and delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and updateTime = #{updateTime}</if>
- <if test="addTime != null "> and addTime = #{addTime}</if>
- <if test="publishSource != null "> and publishSource = #{publishSource}</if>
- </where>
- order by pcStatus desc, sort desc ,addTime desc
- </select>
- <select id="selectCmBrandLandingById" parameterType="String" resultMap="CmBrandLandingResult">
- <include refid="selectCmBrandLandingVo"/>
- ,p.name productName,p.mainImage productImage
- FROM cm_brand_landing a
- left join product p on p.productId=a.productId
- where id = #{id} and delFlag = 0
- </select>
- <select id="getById" parameterType="CmBrandLanding" resultType="String">
- select id
- from cm_brand_landing AS cm_brand_landing
- <where> cm_brand_landing.delFlag = 0
- <if test="id != null and id != ''">
- and cm_brand_landing.id
- = #{id}
- </if>
- <if test="type != null and type != ''">
- and cm_brand_landing.type
- = #{type}
- </if>
- <if test="authUserId != null "> and cm_brand_landing.authUserId = #{authUserId}</if>
- <if test="levelType != null and levelType != ''">
- and cm_brand_landing.levelType = #{levelType}
- </if>
- <if test="authorId != null and authorId != ''"> and cm_brand_landing.authorId = #{authorId}</if>
- <if test="headPcBanner != null and headPcBanner != ''"> and cm_brand_landing.headPcBanner = #{headPcBanner}</if>
- <if test="headAppBanner != null and headAppBanner != ''"> and cm_brand_landing.headAppBanner = #{headAppBanner}</if>
- <if test="jumpStatus != null "> and cm_brand_landing.jumpStatus = #{jumpStatus}</if>
- <if test="jumpPcPicture != null and jumpPcPicture != ''"> and cm_brand_landing.jumpPcPicture = #{jumpPcPicture}</if>
- <if test="jumpAppPicture != null and jumpAppPicture != ''"> and cm_brand_landing.jumpAppPicture = #{jumpAppPicture}</if>
- <if test="jumpLink != null and jumpLink != ''"> and cm_brand_landing.jumpLink = #{jumpLink}</if>
- <if test="title != null and title != ''"> and cm_brand_landing.title = #{title}</if>
- <if test="content != null and content != ''"> and cm_brand_landing.content = #{content}</if>
- <if test="video != null and video != ''"> and cm_brand_landing.video = #{video}</if>
- <if test="sort != null "> and cm_brand_landing.sort = #{sort}</if>
- <if test="pcStatus != null "> and cm_brand_landing.pcStatus = #{pcStatus}</if>
- <if test="appStatus != null "> and cm_brand_landing.appStatus = #{appStatus}</if>
- <if test="delFlag != null "> and cm_brand_landing.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_brand_landing.updateTime = #{updateTime}</if>
- <if test="addTime != null "> and cm_brand_landing.addTime = #{addTime}</if>
- </where>
- group by cm_brand_landing.id
- order by cm_brand_landing.addTime desc
- limit 0,1
- </select>
- <select id="findBigSort" resultType="java.lang.String">
- SELECT sort FROM cm_brand_landing ORDER BY sort DESC LIMIT 1
- </select>
- <select id="getLandingCount" resultType="int">
- SELECT count(1)
- FROM cm_brand_landing
- where auditStatus=2 and pcStatus!=0 and appStatus!=0
- AND bookStartDate <![CDATA[ >= ]]> #{bookStartDate} AND bookEndDate <![CDATA[ <= ]]> #{bookEndDate}
- <if test="type != null"> and type =#{type}</if>
- <if test="id != null"> and id !=#{id}</if>
- </select>
- <update id="updateSort">
- update cm_brand_landing set sort=#{sort}
- where id= #{id}
- </update>
- <insert id="insertCmBrandLanding" parameterType="CmBrandLanding" useGeneratedKeys="true" keyProperty="id">
- insert into cm_brand_landing
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="authUserId != null">authUserId,</if>
- <if test="type != null">type,</if>
- <if test="levelType != null "> levelType,</if>
- <if test="authorId != null "> authorId,</if>
- <if test="headPcBanner != null">headPcBanner,</if>
- <if test="headAppBanner != null">headAppBanner,</if>
- <if test="jumpStatus != null">jumpStatus,</if>
- <if test="jumpPcPicture != null">jumpPcPicture,</if>
- <if test="jumpAppPicture != null">jumpAppPicture,</if>
- <if test="jumpLink != null">jumpLink,</if>
- <if test="jumpAppLink != null">jumpAppLink,</if>
- <if test="title != null">title,</if>
- <if test="content != null">content,</if>
- <if test="video != null">video,</if>
- <if test="sort != null">sort,</if>
- <if test="pcStatus != null">pcStatus,</if>
- <if test="appStatus != null">appStatus,</if>
- <if test="delFlag != null">delFlag,</if>
- <if test="updateTime != null">updateTime,</if>
- <if test="addTime != null">addTime,</if>
- <if test="productId != null">productId,</if>
- <if test="bookStatus != null">bookStatus,</if>
- <if test="bookStartDate != null">bookStartDate,</if>
- <if test="bookEndDate != null">bookEndDate,</if>
- <if test="auditStatus != null">auditStatus,</if>
- <if test="auditTime != null">auditTime,</if>
- <if test="failReason != null and failReason != ''">failReason,</if>
- <if test="publishSource != null">publishSource,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="authUserId != null">#{authUserId},</if>
- <if test="type != null">#{type},</if>
- <if test="levelType != null "> #{levelType},</if>
- <if test="authorId != null "> #{authorId},</if>
- <if test="headPcBanner != null">#{headPcBanner},</if>
- <if test="headAppBanner != null">#{headAppBanner},</if>
- <if test="jumpStatus != null">#{jumpStatus},</if>
- <if test="jumpPcPicture != null">#{jumpPcPicture},</if>
- <if test="jumpAppPicture != null">#{jumpAppPicture},</if>
- <if test="jumpLink != null">#{jumpLink},</if>
- <if test="jumpAppLink != null">#{jumpAppLink},</if>
- <if test="title != null">#{title},</if>
- <if test="content != null">#{content},</if>
- <if test="video != null">#{video},</if>
- <if test="sort != null">#{sort},</if>
- <if test="pcStatus != null">#{pcStatus},</if>
- <if test="appStatus != null">#{appStatus},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="addTime != null">#{addTime},</if>
- <if test="productId != null">#{productId},</if>
- <if test="bookStatus != null">#{bookStatus},</if>
- <if test="bookStartDate != null">#{bookStartDate},</if>
- <if test="bookEndDate != null">#{bookEndDate},</if>
- <if test="auditStatus != null">#{auditStatus},</if>
- <if test="auditTime != null">#{auditTime},</if>
- <if test="failReason != null and failReason != ''">#{failReason},</if>
- <if test="publishSource != null">#{publishSource},</if>
- </trim>
- </insert>
- <update id="updateCmBrandLanding" parameterType="CmBrandLanding">
- update cm_brand_landing
- <trim prefix="SET" suffixOverrides=",">
- <if test="authUserId != null">authUserId = #{authUserId},</if>
- <if test="type != null">type = #{type},</if>
- <if test="levelType != null "> levelType = #{levelType},</if>
- <if test="authorId != null "> authorId = #{authorId},</if>
- <if test="headPcBanner != null">headPcBanner = #{headPcBanner},</if>
- <if test="headAppBanner != null">headAppBanner = #{headAppBanner},</if>
- <if test="jumpStatus != null">jumpStatus = #{jumpStatus},</if>
- <if test="jumpPcPicture != null">jumpPcPicture = #{jumpPcPicture},</if>
- <if test="jumpAppPicture != null">jumpAppPicture = #{jumpAppPicture},</if>
- <if test="jumpLink != null">jumpLink = #{jumpLink},</if>
- <if test="jumpAppLink != null">jumpAppLink = #{jumpAppLink},</if>
- <if test="title != null">title = #{title},</if>
- <if test="content != null">content = #{content},</if>
- <if test="video != null">video = #{video},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="pcStatus != null">pcStatus = #{pcStatus},</if>
- <if test="appStatus != null">appStatus = #{appStatus},</if>
- <if test="delFlag != null">delFlag = #{delFlag},</if>
- <if test="updateTime != null">updateTime = #{updateTime},</if>
- <if test="addTime != null">addTime = #{addTime},</if>
- <if test="productId != null">productId = #{productId},</if>
- <if test="bookStatus != null">bookStatus = #{bookStatus},</if>
- <if test="bookStartDate != null">bookStartDate = #{bookStartDate},</if>
- <if test="bookEndDate != null">bookEndDate = #{bookEndDate},</if>
- <if test="auditStatus != null">auditStatus = #{auditStatus},</if>
- <if test="auditTime != null">auditTime = #{auditTime},</if>
- <if test="failReason != null and failReason != ''">failReason = #{failReason},</if>
- <if test="publishSource != null">publishSource = #{publishSource},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCmBrandLandingById" parameterType="String">
- delete from cm_brand_landing where id = #{id}
- </delete>
- <delete id="delCmBrandLandingByAuthorId" parameterType="String">
- delete from cm_brand_landing where authorId = #{authorId}
- </delete>
- <delete id="deleteCmBrandLandingByIds" parameterType="String">
- delete from cm_brand_landing where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|