<?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.flow.mapper.HsPurchaseFlowRecordMapper">

    <resultMap type="com.willalp.flow.domain.HsPurchaseFlowRecord" id="HsPurchaseFlowRecordResult">
                    <result property="id" column="id"/>
                    <result property="title" column="title"/>
                    <result property="whatUse" column="what_use"/>
                    <result property="goodsType" column="goods_type"/>
                    <result property="goodsName" column="goods_name"/>
                    <result property="goodsGg" column="goods_gg"/>
                    <result property="wantUseAmount" column="want_use_amount"/>
                    <result property="ygUnitPrice" column="yg_unit_price"/>
                    <result property="ygTotalPrices" column="yg_total_prices"/>
                    <result property="purchaseStatus" column="purchase_status"/>
                    <result property="photos" column="photos"/>
                    <result property="involveFile" column="involve_file"/>
                    <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="selectHsPurchaseFlowRecordVo">
        select id, title, what_use, goods_type, goods_name, goods_gg, want_use_amount, yg_unit_price, yg_total_prices, purchase_status, photos, involve_file, dept_id, apply_user_name, is_delete, create_by, create_time, update_by, update_time, remark        from hs_purchase_flow_record
    </sql>

    <select id="selectHsPurchaseFlowRecordList" parameterType="HsPurchaseFlowRecord" resultMap="HsPurchaseFlowRecordResult">
        <include refid="selectHsPurchaseFlowRecordVo"/>
        <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="goodsType != null  and goodsType != ''">
                            and goods_type = #{goodsType}
                        </if>
                                                                                                            <if test="goodsName != null  and goodsName != ''">
                            and goods_name like concat('%', #{goodsName}, '%')
                        </if>
                                                                                                            <if test="goodsGg != null  and goodsGg != ''">
                            and goods_gg = #{goodsGg}
                        </if>
                                                                                                            <if test="wantUseAmount != null ">
                            and want_use_amount = #{wantUseAmount}
                        </if>
                                                                                                            <if test="ygUnitPrice != null ">
                            and yg_unit_price = #{ygUnitPrice}
                        </if>
                                                                                                            <if test="ygTotalPrices != null  and ygTotalPrices != ''">
                            and yg_total_prices = #{ygTotalPrices}
                        </if>
                                                                                                            <if test="purchaseStatus != null  and purchaseStatus != ''">
                            and purchase_status = #{purchaseStatus}
                        </if>
                                                                                                            <if test="photos != null  and photos != ''">
                            and photos = #{photos}
                        </if>
                                                                                                            <if test="involveFile != null  and involveFile != ''">
                            and involve_file = #{involveFile}
                        </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>
