<?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.IntegralClockMapper">

    <resultMap type="IntegralClock" id="IntegralClockResult">
        <result property="id"    column="id"    />
        <result property="dailyClockCredit"    column="daily_clock_credit"    />
        <result property="isExtraClock"    column="is_extra_clock"    />
        <result property="extraClockCredit"    column="extra_clock_credit"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="status"    column="status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectIntegralClockVo">
        select id, daily_clock_credit, is_extra_clock, extra_clock_credit, start_time, end_time, status, create_by, create_time, update_by, update_time, remark from integral_clock
    </sql>

    <select id="selectIntegralClockList" parameterType="IntegralClock" resultMap="IntegralClockResult">
        <include refid="selectIntegralClockVo"/>
        <where>
            <if test="dailyClockCredit != null "> and daily_clock_credit = #{dailyClockCredit}</if>
            <if test="isExtraClock != null "> and is_extra_clock = #{isExtraClock}</if>
            <if test="extraClockCredit != null "> and extra_clock_credit = #{extraClockCredit}</if>
            <if test="startTime != null "> and start_time = #{startTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

    <select id="selectIntegralClockById" parameterType="Long" resultMap="IntegralClockResult">
        <include refid="selectIntegralClockVo"/>
        where id = #{id}
    </select>

    <insert id="insertIntegralClock" parameterType="IntegralClock" useGeneratedKeys="true" keyProperty="id">
        insert into integral_clock
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dailyClockCredit != null">daily_clock_credit,</if>
            <if test="isExtraClock != null">is_extra_clock,</if>
            <if test="extraClockCredit != null">extra_clock_credit,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dailyClockCredit != null">#{dailyClockCredit},</if>
            <if test="isExtraClock != null">#{isExtraClock},</if>
            <if test="extraClockCredit != null">#{extraClockCredit},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateIntegralClock" parameterType="IntegralClock">
        update integral_clock
        <trim prefix="SET" suffixOverrides=",">
            <if test="dailyClockCredit != null">daily_clock_credit = #{dailyClockCredit},</if>
            <if test="isExtraClock != null">is_extra_clock = #{isExtraClock},</if>
            <if test="extraClockCredit != null">extra_clock_credit = #{extraClockCredit},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIntegralClockById" parameterType="Long">
        delete from integral_clock where id = #{id}
    </delete>

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