<?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.willalp.clockingin.mapper.HsPnsShiftMapper">

    <resultMap type="com.willalp.clockingin.domain.HsPnsShift" id="HsPnsShiftResult">
                    <result property="shiftId" column="shift_id"/>
                    <result property="shiftName" column="shift_name"/>
                    <result property="shiftType" column="shift_type"/>
                    <result property="dutyTime" column="duty_time"/>
                    <result property="offDutyTime" column="off_duty_time"/>
                    <result property="remark" column="remark"/>
                    <result property="isDelete" column="is_delete"/>
                    <result property="createBy" column="create_by"/>
                    <result property="createTime" column="create_time"/>
                    <result property="updateBy" column="update_by"/>
                    <result property="updateTime" column="update_time"/>
            </resultMap>
    
    <sql id="selectHsPnsShiftVo">
        select shift_id, shift_name, shift_type, duty_time, off_duty_time, remark, is_delete, create_by, create_time, update_by, update_time        from hs_pns_shift
    </sql>

    <select id="selectHsPnsShiftList" parameterType="HsPnsShift" resultMap="HsPnsShiftResult">
        <include refid="selectHsPnsShiftVo"/>
        <where>
            is_delete = 0
                                                                                                    <if test="shiftName != null  and shiftName != ''">
                            and shift_name like concat('%', #{shiftName}, '%')
                        </if>
                                                                                                            <if test="shiftType != null  and shiftType != ''">
                            and shift_type like concat('%', #{shiftType}, '%')
                        </if>
                                                                                                            <if test="dutyTime != null  and dutyTime != ''">
                            and duty_time = #{dutyTime}
                        </if>
                                                                                                            <if test="offDutyTime != null  and offDutyTime != ''">
                            and off_duty_time = #{offDutyTime}
                        </if>
                                                                                                                                        <if test="isDelete != null ">
                            and is_delete = #{isDelete}
                        </if>
                                                                                                                                                                        </where>
    </select>
</mapper>
