|
@@ -0,0 +1,443 @@
|
|
|
+<?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>
|