<?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.control.mapper.HsControlTimingMapper">

    <resultMap type="com.willalp.control.domain.HsControlTiming" id="HsControlTimingResult">
        <result property="timingId" column="timing_id"/>
        <result property="userId" column="user_id"/>
        <result property="useNoId" column="use_no_id"/>
        <result property="cycle" column="cycle"/>
        <result property="startTime" column="start_time"/>
        <result property="endTime" column="end_time"/>
        <result property="state" column="state"/>
        <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"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectHsControlTimingVo">
        select timing_id,
               user_id,
               `cycle`,
               start_time,
               end_time,
               state,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_control_timing
    </sql>

    <select id="selectHsControlTimingList" parameterType="HsControlTiming" resultMap="HsControlTimingResult">
        <include refid="selectHsControlTimingVo"/>
        <where>
            is_delete = 0
            <if test="userId != null ">
                  and user_id = #{userId}
            </if>
            <if test="useNoId != null ">
                  and use_no_id = #{useNoId}
            </if>
            <if test="startTime != null ">
                  and start_time = #{startTime}
            </if>
            <if test="endTime != null ">
                  and end_time = #{endTime}
            </if>
            <if test="state != null ">
                  and state = #{state}
                        </if>
        </where>
    </select>
</mapper>
