<?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.ruoyi.system.mapper.WorkerSignMapper">
    
    <resultMap type="WorkerSign" id="WorkerSignResult">
        <result property="id"    column="id"    />
        <result property="uid"    column="uid"    />
        <result property="time"    column="time"    />
        <result property="createdAt"    column="created_at"    />
        <result property="updatedAt"    column="updated_at"    />
    </resultMap>

    <sql id="selectWorkerSignVo">
        select id, uid, time, created_at, updated_at from worker_sign
    </sql>

    <select id="selectWorkerSignList" parameterType="WorkerSign" resultMap="WorkerSignResult">
        <include refid="selectWorkerSignVo"/>
        <where>  
            <if test="uid != null  and uid != ''"> and uid = #{uid}</if>
            <if test="time != null "> and time = #{time}</if>
            <if test="createdAt != null "> and created_at = #{createdAt}</if>
            <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
        </where>
    </select>
    
    <select id="selectWorkerSignById" parameterType="Long" resultMap="WorkerSignResult">
        <include refid="selectWorkerSignVo"/>
        where id = #{id}
    </select>

    <insert id="insertWorkerSign" parameterType="WorkerSign" useGeneratedKeys="true" keyProperty="id">
        insert into worker_sign
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uid != null and uid != ''">uid,</if>
            <if test="time != null">time,</if>
            <if test="createdAt != null">created_at,</if>
            <if test="updatedAt != null">updated_at,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uid != null and uid != ''">#{uid},</if>
            <if test="time != null">#{time},</if>
            <if test="createdAt != null">#{createdAt},</if>
            <if test="updatedAt != null">#{updatedAt},</if>
         </trim>
    </insert>

    <update id="updateWorkerSign" parameterType="WorkerSign">
        update worker_sign
        <trim prefix="SET" suffixOverrides=",">
            <if test="uid != null and uid != ''">uid = #{uid},</if>
            <if test="time != null">time = #{time},</if>
            <if test="createdAt != null">created_at = #{createdAt},</if>
            <if test="updatedAt != null">updated_at = #{updatedAt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteWorkerSignById" parameterType="Long">
        delete from worker_sign where id = #{id}
    </delete>

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