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

    <resultMap type="com.willalp.control.domain.HsControlLog" id="HsControlLogResult">
        <result property="controlLogId" column="control_log_id"/>
        <result property="useNoId" column="use_no_id"/>
        <result property="useDescribe" column="use_describe"/>
        <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="selectHsControlLogVo">
        select control_log_id,
               use_no_id,
               use_describe,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_control_log
    </sql>

    <select id="selectHsControlLogList" parameterType="HsControlLog" resultMap="HsControlLogResult">
        <include refid="selectHsControlLogVo"/>
        <where>
            is_delete = 0
            <if test="useNoId != null  and useNoId != ''">
                  and use_no_id = #{useNoId}
            </if>
            <if test="useDescribe != null  and useDescribe != ''">
                  and use_describe = #{useDescribe}
            </if>
        </where>
    </select>
    <select id="selectLogListByUseNoIdAndDate" resultMap="HsControlLogResult">
        SELECT control_log_id,
        use_no_id,
        use_describe,
        create_time
        from hs_control_log
        <where>
            create_time like concat(#{date,jdbcType=VARCHAR}, '%')
                             AND
            is_delete = 0
                             AND
            use_no_id = #{useNoId,jdbcType=BIGINT}
        </where>
    </select>
</mapper>
