123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <?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.user.dao.CmRelatedImageMapper">
- <resultMap type="com.caimei.modules.user.entity.CmRelatedImage" id="CmRelatedImageResult">
- <result property="id" column="id" />
- <result property="type" column="type" />
- <result property="authorId" column="authorId" />
- <result property="image" column="image" />
- <result property="delFlag" column="delFlag" />
- <result property="updateTime" column="updateTime" />
- <result property="createTime" column="createTime" />
- </resultMap>
- <sql id="selectCmRelatedImageVo">
- select
- cm_related_image.id,
- cm_related_image.type,
- cm_related_image.authorId,
- cm_related_image.image,
- cm_related_image.delFlag,
- cm_related_image.updateTime,
- cm_related_image.createTime
- </sql>
- <select id="getByCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultMap="CmRelatedImageResult">
- <include refid="selectCmRelatedImageVo"/>
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- group by cm_related_image.id
- order by cm_related_image.createTime desc
- limit 0,1
- </select>
- <select id="getCmRelatedImageList" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultMap="CmRelatedImageResult">
- <include refid="selectCmRelatedImageVo"/>
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- group by cm_related_image.id
- order by cm_related_image.createTime desc
- </select>
- <select id="getCmRelatedImageCount" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
- select count(1)
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- group by cm_related_image.id
- </select>
- <select id="getCmRelatedImageById" parameterType="String" resultMap="CmRelatedImageResult">
- <include refid="selectCmRelatedImageVo"/>
- from cm_related_image AS cm_related_image
- where cm_related_image.delFlag = 0 and cm_related_image.id = #{id}
- </select>
- <select id="getByIds" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
- select id
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- group by cm_related_image.id
- </select>
- <select id="getById" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
- select id
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- group by cm_related_image.id
- limit 0,1
- </select>
- <insert id="addCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage" useGeneratedKeys="true" keyProperty="id">
- insert into cm_related_image
- <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="image != null and image != ''">image,</if>
- <if test="delFlag != null">delFlag,</if>
- <if test="updateTime != null">updateTime,</if>
- <if test="createTime != null">createTime,</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="image != null and image != ''">#{image},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage">
- update cm_related_image
- <trim prefix="SET" suffixOverrides=",">
- <if test="type != null and type != ''">type = #{type},</if>
- <if test="authorId != null and authorId != ''">authorId = #{authorId},</if>
- <if test="image != null and image != ''">image = #{image},</if>
- <if test="delFlag != null">delFlag = #{delFlag},</if>
- <if test="updateTime != null">updateTime = #{updateTime},</if>
- <if test="createTime != null">createTime = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateDelCmRelatedImageByIds" parameterType="String">
- update cm_related_image set delFlag=#{delFlag} where id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <delete id="delCmRelatedImageById" parameterType="String">
- delete
- from cm_related_image where id = #{id}
- </delete>
- <delete id="delCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage">
- delete
- from cm_related_image AS cm_related_image
- <where>
- <if test="id != null and id != ''">
- and cm_related_image.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_image.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_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- <if test="delFlag != null "> and cm_related_image.delFlag = #{delFlag}</if>
- <if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
- <if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
- </where>
- </delete>
- <delete id="delCmRelatedImageByIds" parameterType="String">
- delete from cm_related_image where id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|