<?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.flossom.common.core.mapper.WxClockImgMapper">
    
    <resultMap type="WxClockImg" id="WxClockImgResult">
        <result property="id"    column="id"    />
        <result property="userClockId"    column="user_clock_id"    />
        <result property="clockImg"    column="clock_img"    />
        <result property="status"    column="status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectWxClockImgVo">
        select id, user_clock_id, clock_img, status, create_by, create_time from wx_clock_img
    </sql>

    <select id="selectWxClockImgList" parameterType="WxClockImg" resultMap="WxClockImgResult">
        <include refid="selectWxClockImgVo"/>
        <where>  
            <if test="userClockId != null "> and user_clock_id = #{userClockId}</if>
            <if test="clockImg != null  and clockImg != ''"> and clock_img = #{clockImg}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectWxClockImgById" parameterType="Long" resultMap="WxClockImgResult">
        <include refid="selectWxClockImgVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertWxClockImg" parameterType="WxClockImg" useGeneratedKeys="true" keyProperty="id">
        insert into wx_clock_img
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userClockId != null">user_clock_id,</if>
            <if test="clockImg != null">clock_img,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userClockId != null">#{userClockId},</if>
            <if test="clockImg != null">#{clockImg},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateWxClockImg" parameterType="WxClockImg">
        update wx_clock_img
        <trim prefix="SET" suffixOverrides=",">
            <if test="userClockId != null">user_clock_id = #{userClockId},</if>
            <if test="clockImg != null">clock_img = #{clockImg},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteWxClockImgById" parameterType="Long">
        delete from wx_clock_img where id = #{id}
    </delete>

    <delete id="deleteByUserClockId" parameterType="Long">
        delete from wx_clock_img where user_clock_id = #{userClockId}
    </delete>

    <delete id="deleteWxClockImgByIds" parameterType="String">
        delete from wx_clock_img where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>