123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- <?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.info.dao.CmRelatedMapper">
- <resultMap type="CmRelated" id="CmRelatedResult">
- <result property="id" column="id" />
- <result property="type" column="type" />
- <result property="authorId" column="authorId" />
- <result property="relatedId" column="relatedId" />
- <result property="delFlag" column="delFlag" />
- <result property="updateTime" column="updateTime" />
- <result property="createTime" column="createTime" />
- <result property="sort" column="sort" />
- </resultMap>
- <sql id="selectCmRelatedVo">
- select
- cm_related.id,
- cm_related.type,
- cm_related.authorId,
- cm_related.relatedId,
- cm_related.delFlag,
- cm_related.updateTime,
- cm_related.createTime,
- cm_related.sort
- </sql>
- <select id="getByCmRelated" parameterType="CmRelated" resultMap="CmRelatedResult">
- <include refid="selectCmRelatedVo"/>
- from cm_related AS cm_related
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toUpperCase().indexOf('=')!=-1">
- <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- </where>
- group by cm_related.id
- order by cm_related.createTime desc
- limit 0,1
- </select>
- <select id="findList" parameterType="CmRelated" resultMap="CmRelatedResult">
- <include refid="selectCmRelatedVo"/>
- from cm_related AS cm_related
- <if test="info != null">
- left join info AS info on cm_related.relatedId=info.id
- </if>
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toUpperCase().indexOf('=')!=-1">
- <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- -- info
- <if test="info != null ">
- <if test="info.id != null and info.id != ''">
- and info.id
- = #{info.id}
- </if>
- <if test="info.typeId != null and info.typeId != ''">
- and info.typeId
- = #{info.typeId}
- </if>
- <if test="info.title != null and info.title != ''"> and info.title = #{info.title}</if>
- <if test="info.label != null and info.label != ''"> and info.label = #{info.label}</if>
- <if test="info.publisher != null and info.publisher != ''"> and info.publisher = #{info.publisher}</if>
- <if test="info.source != null and info.source != ''"> and info.source = #{info.source}</if>
- <if test="info.publishSource != null "> and info.publishSource = #{info.publishSource}</if>
- <if test="info.shopId != null "> and info.shopId = #{info.shopId}</if>
- <if test="info.keyword != null and info.keyword != ''"> and info.keyword = #{info.keyword}</if>
- <if test="info.recommendContent != null and info.recommendContent != ''"> and info.recommendContent = #{info.recommendContent}</if>
- <if test="info.infoContent != null and info.infoContent != ''"> and info.infoContent = #{info.infoContent}</if>
- <if test="info.guidanceImage != null and info.guidanceImage != ''"> and info.guidanceImage = #{info.guidanceImage}</if>
- <if test="info.homePageImage != null and info.homePageImage != ''"> and info.homePageImage = #{info.homePageImage}</if>
- <if test="info.pubdate != null "> and info.pubdate = #{info.pubdate}</if>
- <if test="info.recommendStatus != null and info.recommendStatus != ''"> and info.recommendStatus = #{info.recommendStatus}</if>
- <if test="info.enabledStatus != null and info.enabledStatus != ''"> and info.enabledStatus = #{info.enabledStatus}</if>
- <if test="info.basePraise != null "> and info.basePraise = #{info.basePraise}</if>
- <if test="info.basePv != null "> and info.basePv = #{info.basePv}</if>
- <if test="info.priorityIndex != null "> and info.priorityIndex = #{info.priorityIndex}</if>
- <if test="info.auditStatus != null "> and info.auditStatus = #{info.auditStatus}</if>
- <if test="info.onlineStatus != null "> and info.onlineStatus = #{info.onlineStatus}</if>
- <if test="info.failReason != null and info.failReason != ''"> and info.failReason = #{info.failReason}</if>
- <if test="info.createBy != null and info.createBy != ''"> and info.createBy = #{info.createBy}</if>
- <if test="info.createDate != null "> and info.createDate = #{info.createDate}</if>
- <if test="info.updateBy != null and info.updateBy != ''"> and info.updateBy = #{info.updateBy}</if>
- <if test="info.updateDate != null "> and info.updateDate = #{info.updateDate}</if>
- <if test="info.topPosition != null "> and info.topPosition = #{info.topPosition}</if>
- <if test="info.labelIds != null and info.labelIds != ''"> and info.labelIds = #{info.labelIds}</if>
- <if test="info.relatedLabels != null and info.relatedLabels != ''"> and info.relatedLabels = #{info.relatedLabels}</if>
- <if test="info.delFlag != null "> and info.delFlag = #{info.delFlag}</if>
- <if test="info.autoStatus != null "> and info.autoStatus = #{info.autoStatus}</if>
- <if test="info.startPubDate != null and info.startPubDate != ''">
- AND info.pubdate <![CDATA[ >= ]]> #{info.startPubDate}
- </if>
- <if test="info.endPubDate != null and info.endPubDate != ''">
- AND info.pubdate <![CDATA[ <= ]]> #{info.endPubDate}
- </if>
- </if>
- </where>
- group by cm_related.id
- order by cm_related.sort asc,cm_related.createTime desc
- </select>
- <select id="getCmRelatedList" parameterType="CmRelated" resultMap="CmRelatedResult">
- <include refid="selectCmRelatedVo"/>
- from cm_related AS cm_related
- <if test="info != null">
- left join info AS info on cm_related.relatedId=info.id
- </if>
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toUpperCase().indexOf('=')!=-1">
- <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- -- info
- <if test="info != null ">
- <if test="info.id != null and info.id != ''">
- and info.id
- = #{info.id}
- </if>
- <if test="info.typeId != null and info.typeId != ''">
- and info.typeId
- = #{info.typeId}
- </if>
- <if test="info.title != null and info.title != ''"> and info.title = #{info.title}</if>
- <if test="info.label != null and info.label != ''"> and info.label = #{info.label}</if>
- <if test="info.publisher != null and info.publisher != ''"> and info.publisher = #{info.publisher}</if>
- <if test="info.source != null and info.source != ''"> and info.source = #{info.source}</if>
- <if test="info.publishSource != null "> and info.publishSource = #{info.publishSource}</if>
- <if test="info.shopId != null "> and info.shopId = #{info.shopId}</if>
- <if test="info.keyword != null and info.keyword != ''"> and info.keyword = #{info.keyword}</if>
- <if test="info.recommendContent != null and info.recommendContent != ''"> and info.recommendContent = #{info.recommendContent}</if>
- <if test="info.infoContent != null and info.infoContent != ''"> and info.infoContent = #{info.infoContent}</if>
- <if test="info.guidanceImage != null and info.guidanceImage != ''"> and info.guidanceImage = #{info.guidanceImage}</if>
- <if test="info.homePageImage != null and info.homePageImage != ''"> and info.homePageImage = #{info.homePageImage}</if>
- <if test="info.pubdate != null "> and info.pubdate = #{info.pubdate}</if>
- <if test="info.recommendStatus != null and info.recommendStatus != ''"> and info.recommendStatus = #{info.recommendStatus}</if>
- <if test="info.enabledStatus != null and info.enabledStatus != ''"> and info.enabledStatus = #{info.enabledStatus}</if>
- <if test="info.basePraise != null "> and info.basePraise = #{info.basePraise}</if>
- <if test="info.basePv != null "> and info.basePv = #{info.basePv}</if>
- <if test="info.priorityIndex != null "> and info.priorityIndex = #{info.priorityIndex}</if>
- <if test="info.auditStatus != null "> and info.auditStatus = #{info.auditStatus}</if>
- <if test="info.onlineStatus != null "> and info.onlineStatus = #{info.onlineStatus}</if>
- <if test="info.failReason != null and info.failReason != ''"> and info.failReason = #{info.failReason}</if>
- <if test="info.createBy != null and info.createBy != ''"> and info.createBy = #{info.createBy}</if>
- <if test="info.createDate != null "> and info.createDate = #{info.createDate}</if>
- <if test="info.updateBy != null and info.updateBy != ''"> and info.updateBy = #{info.updateBy}</if>
- <if test="info.updateDate != null "> and info.updateDate = #{info.updateDate}</if>
- <if test="info.topPosition != null "> and info.topPosition = #{info.topPosition}</if>
- <if test="info.labelIds != null and info.labelIds != ''"> and info.labelIds = #{info.labelIds}</if>
- <if test="info.relatedLabels != null and info.relatedLabels != ''"> and info.relatedLabels = #{info.relatedLabels}</if>
- <if test="info.delFlag != null "> and info.delFlag = #{info.delFlag}</if>
- <if test="info.autoStatus != null "> and info.autoStatus = #{info.autoStatus}</if>
- <if test="info.startPubDate != null and info.startPubDate != ''">
- AND info.pubdate <![CDATA[ >= ]]> #{info.startPubDate}
- </if>
- <if test="info.endPubDate != null and info.endPubDate != ''">
- AND info.pubdate <![CDATA[ <= ]]> #{info.endPubDate}
- </if>
- </if>
- </where>
- group by cm_related.id
- order by cm_related.sort asc,cm_related.createTime desc
- </select>
- <select id="getCmRelatedCount" parameterType="CmRelated" resultType="String">
- select count(1)
- from cm_related AS cm_related
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toUpperCase().indexOf('=')!=-1">
- <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- </where>
- group by cm_related.id
- </select>
- <select id="getCmRelatedById" parameterType="String" resultMap="CmRelatedResult">
- <include refid="selectCmRelatedVo"/>
- from cm_related AS cm_related
- where cm_related.delFlag = 0 and cm_related.id = #{id}
- </select>
- <select id="getByIds" parameterType="CmRelated" resultType="String">
- select id
- from cm_related AS cm_related
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toUpperCase().indexOf('=')!=-1">
- <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- </where>
- group by cm_related.id
- </select>
- <select id="getById" parameterType="CmRelated" resultType="String">
- select id
- from cm_related AS cm_related
- <where> cm_related.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related.id
- <if test="id.toString().toUpperCase().indexOf('=')==-1">
- = #{id}
- </if>
- <if test="id.toString().toUpperCase().indexOf('=')!=-1">
- <if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
- #{idIn}
- </foreach>
- </if>
- </if>
- <if test="type != null and type != ''">
- and cm_related.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related.authorId = #{authorId}</if>
- <if test="relatedId != null and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
- <if test="delFlag != null "> and cm_related.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related.createTime = #{createTime}</if>
- <if test="sort != null "> and cm_related.sort = #{sort}</if>
- </where>
- group by cm_related.id
- limit 0,1
- </select>
- <insert id="addCmRelated" parameterType="CmRelated" useGeneratedKeys="true" keyProperty="id">
- insert into cm_related
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">id,</if>
- <if test="type != null and type != ''">type,</if>
- <if test="authorId != null and authorId != ''">authorId,</if>
- <if test="relatedId != null and relatedId != ''">relatedId,</if>
- <if test="delFlag != null">delFlag,</if>
- <if test="updateTime != null">updateTime,</if>
- <if test="createTime != null">createTime,</if>
- <if test="sort != null">sort,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null and id != ''">#{id},</if>
- <if test="type != null and type != ''">#{type},</if>
- <if test="authorId != null and authorId != ''">#{authorId},</if>
- <if test="relatedId != null and relatedId != ''">#{relatedId},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="sort != null">#{sort},</if>
- </trim>
- </insert>
- <update id="updateCmRelated" parameterType="CmRelated">
- update cm_related
- <trim prefix="SET" suffixOverrides=",">
- <if test="type != null and type != ''">type = #{type},</if>
- <if test="authorId != null and authorId != ''">authorId = #{authorId},</if>
- <if test="relatedId != null and relatedId != ''">relatedId = #{relatedId},</if>
- <if test="delFlag != null">delFlag = #{delFlag},</if>
- <if test="updateTime != null">updateTime = #{updateTime},</if>
- <if test="createTime != null">createTime = #{createTime},</if>
- <if test="sort != null">sort = #{sort},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateDelCmRelatedByIds" parameterType="String">
- update cm_related set delFlag=#{delFlag} where id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <delete id="delCmRelatedById" parameterType="String">
- delete
- from cm_related where id = #{id}
- </delete>
- <delete id="delCmRelatedByAuthorId" parameterType="String">
- delete
- from cm_related where type = #{type} and authorId = #{authorId}
- </delete>
- <delete id="delCmRelatedByIds" parameterType="String">
- delete from cm_related where id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|