<?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.device.mapper.HsDeviceScrapFlowRecordMapper">

    <resultMap type="com.willalp.device.domain.HsDeviceScrapFlowRecord" id="HsDeviceScrapFlowRecordResult">
                    <result property="id" column="id"/>
                    <result property="title" column="title"/>
                    <result property="whatUse" column="what_use"/>
                    <result property="deviceType" column="device_type"/>
                    <result property="deviceName" column="device_name"/>
                    <result property="deviceGg" column="device_gg"/>
                    <result property="scrapType" column="scrap_type"/>
                    <result property="depositLoca" column="deposit_loca"/>
                    <result property="repairsStatus" column="repairs_status"/>
                    <result property="photos" column="photos"/>
                    <result property="deptId" column="dept_id"/>
                    <result property="applyUserName" column="apply_user_name"/>
                    <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="selectHsDeviceScrapFlowRecordVo">
        select id, title, what_use, device_type, device_name, device_gg, scrap_type, deposit_loca, repairs_status, photos, dept_id, apply_user_name, is_delete, create_by, create_time, update_by, update_time, remark        from hs_device_scrap_flow_record
    </sql>

    <select id="selectHsDeviceScrapFlowRecordList" parameterType="HsDeviceScrapFlowRecord" resultMap="HsDeviceScrapFlowRecordResult">
        <include refid="selectHsDeviceScrapFlowRecordVo"/>
        <where>
            is_delete = 0
                                                                                                    <if test="title != null  and title != ''">
                            and title = #{title}
                        </if>
                                                                                                            <if test="whatUse != null  and whatUse != ''">
                            and what_use = #{whatUse}
                        </if>
                                                                                                            <if test="deviceType != null  and deviceType != ''">
                            and device_type = #{deviceType}
                        </if>
                                                                                                            <if test="deviceName != null  and deviceName != ''">
                            and device_name like concat('%', #{deviceName}, '%')
                        </if>
                                                                                                            <if test="deviceGg != null  and deviceGg != ''">
                            and device_gg = #{deviceGg}
                        </if>
                                                                                                            <if test="scrapType != null  and scrapType != ''">
                            and scrap_type = #{scrapType}
                        </if>
                                                                                                            <if test="depositLoca != null  and depositLoca != ''">
                            and deposit_loca = #{depositLoca}
                        </if>
                                                                                                            <if test="repairsStatus != null  and repairsStatus != ''">
                            and repairs_status = #{repairsStatus}
                        </if>
                                                                                                            <if test="photos != null  and photos != ''">
                            and photos = #{photos}
                        </if>
                                                                                                            <if test="deptId != null  and deptId != ''">
                            and dept_id = #{deptId}
                        </if>
                                                                                                            <if test="applyUserName != null  and applyUserName != ''">
                            and apply_user_name like concat('%', #{applyUserName}, '%')
                        </if>
                                                                                                                                                                                                                                </where>
    </select>
</mapper>
