<?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.ruoyi.feeagreement.mapper.TWarehouseFeeAgreementTypeBusinessDetailMapper">

    <resultMap type="TWarehouseFeeAgreementTypeBusinessDetail" id="TWarehouseFeeAgreementTypeBusinessDetailResult">
        <result property="fId"    column="f_id"    />
        <result property="fWarehouseFeeAgreementTypeFId"    column="f_warehouse_fee_agreement_type_f_id"    />
        <result property="fWarehouseFeeAgreementTypeBusinessFId"    column="f_warehouse_fee_agreement_type_business_f_id"    />
        <result property="fFeeUnitId"    column="f_fee_unit_id"    />
        <result property="fFreeNum"    column="f_free_num"    />
        <result property="fSize"    column="f_size"    />
        <result property="fBoxModel"    column="f_box_model"    />
        <result property="fNum"    column="f_num"    />
        <result property="fPrice"    column="f_price"    />
        <result property="fCurrency"    column="f_currency"    />
        <result property="fIsContract"    column="f_is_contract"    />
        <result property="fDelFlag"    column="f_del_flag"    />
        <result property="fUpdateTime"    column="f_update_time"    />
        <result property="fUpdateBy"    column="f_update_by"    />
        <result property="fCreateTime"    column="f_create_time"    />
        <result property="fRate"    column="f_rate"    />
        <result property="fMaxAmount"    column="f_max_amount"    />
        <result property="fCreateBy"    column="f_create_by"    />
        <result property="fRemark"    column="f_remark"    />
    </resultMap>

    <sql id="selectTWarehouseFeeAgreementTypeBusinessDetailVo">
        select f_id, f_warehouse_fee_agreement_type_f_id, f_warehouse_fee_agreement_type_business_f_id, f_fee_unit_id, f_free_num, f_size, f_box_model, f_num, f_price, f_currency, f_is_contract, f_del_flag, f_update_time, f_update_by, f_create_time, f_rate, f_max_amount, f_create_by, f_remark from t_warehouse_fee_agreement_type_business_detail
    </sql>

    <select id="selectTWarehouseFeeAgreementTypeBusinessDetailList" parameterType="TWarehouseFeeAgreementTypeBusinessDetail" resultMap="TWarehouseFeeAgreementTypeBusinessDetailResult">
        <include refid="selectTWarehouseFeeAgreementTypeBusinessDetailVo"/>
        <where>
            <if test="fWarehouseFeeAgreementTypeFId != null "> and f_warehouse_fee_agreement_type_f_id = #{fWarehouseFeeAgreementTypeFId}</if>
            <if test="fWarehouseFeeAgreementTypeBusinessFId != null "> and f_warehouse_fee_agreement_type_business_f_id = #{fWarehouseFeeAgreementTypeBusinessFId}</if>
            <if test="fFeeUnitId != null "> and f_fee_unit_id = #{fFeeUnitId}</if>
            <if test="fFreeNum != null "> and f_free_num = #{fFreeNum}</if>
            <if test="fSize != null "> and f_size = #{fSize}</if>
            <if test="fBoxModel != null "> and f_box_model = #{fBoxModel}</if>
            <if test="fNum != null "> and f_num = #{fNum}</if>
            <if test="fPrice != null "> and f_price = #{fPrice}</if>
            <if test="fCurrency != null  and fCurrency != ''"> and f_currency = #{fCurrency}</if>
            <if test="fIsContract != null  and fIsContract != ''"> and f_is_contract = #{fIsContract}</if>
            <if test="fDelFlag != null "> and f_del_flag = #{fDelFlag}</if>
            <if test="fUpdateTime != null "> and f_update_time = #{fUpdateTime}</if>
            <if test="fUpdateBy != null "> and f_update_by = #{fUpdateBy}</if>
            <if test="fCreateTime != null "> and f_create_time = #{fCreateTime}</if>
            <if test="fRate != null "> and f_rate = #{fRate}</if>
            <if test="fMaxAmount != null "> and f_max_amount = #{fMaxAmount}</if>
            <if test="fCreateBy != null "> and f_create_by = #{fCreateBy}</if>
            <if test="fRemark != null  and fRemark != ''"> and f_remark = #{fRemark}</if>
        </where>
    </select>

    <select id="selectTWarehouseFeeAgreementTypeBusinessDetailById" parameterType="Long" resultMap="TWarehouseFeeAgreementTypeBusinessDetailResult">
        <include refid="selectTWarehouseFeeAgreementTypeBusinessDetailVo"/>
        where f_id = #{fId}
    </select>

    <insert id="insertTWarehouseFeeAgreementTypeBusinessDetail" parameterType="TWarehouseFeeAgreementTypeBusinessDetail" useGeneratedKeys="true" keyProperty="fId">
        insert into t_warehouse_fee_agreement_type_business_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fWarehouseFeeAgreementTypeFId != null">f_warehouse_fee_agreement_type_f_id,</if>
            <if test="fWarehouseFeeAgreementTypeBusinessFId != null">f_warehouse_fee_agreement_type_business_f_id,</if>
            <if test="fFeeUnitId != null">f_fee_unit_id,</if>
            <if test="fFreeNum != null">f_free_num,</if>
            <if test="fSize != null">f_size,</if>
            <if test="fBoxModel != null">f_box_model,</if>
            <if test="fNum != null">f_num,</if>
            <if test="fPrice != null">f_price,</if>
            <if test="fCurrency != null">f_currency,</if>
            <if test="fIsContract != null">f_is_contract,</if>
            <if test="fDelFlag != null">f_del_flag,</if>
            <if test="fUpdateTime != null">f_update_time,</if>
            <if test="fUpdateBy != null">f_update_by,</if>
            <if test="fCreateTime != null">f_create_time,</if>
            <if test="fRate != null">f_rate,</if>
            <if test="fMaxAmount != null">f_max_amount,</if>
            <if test="fCreateBy != null">f_create_by,</if>
            <if test="fRemark != null">f_remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fWarehouseFeeAgreementTypeFId != null">#{fWarehouseFeeAgreementTypeFId},</if>
            <if test="fWarehouseFeeAgreementTypeBusinessFId != null">#{fWarehouseFeeAgreementTypeBusinessFId},</if>
            <if test="fFeeUnitId != null">#{fFeeUnitId},</if>
            <if test="fFreeNum != null">#{fFreeNum},</if>
            <if test="fSize != null">#{fSize},</if>
            <if test="fBoxModel != null">#{fBoxModel},</if>
            <if test="fNum != null">#{fNum},</if>
            <if test="fPrice != null">#{fPrice},</if>
            <if test="fCurrency != null">#{fCurrency},</if>
            <if test="fIsContract != null">#{fIsContract},</if>
            <if test="fDelFlag != null">#{fDelFlag},</if>
            <if test="fUpdateTime != null">#{fUpdateTime},</if>
            <if test="fUpdateBy != null">#{fUpdateBy},</if>
            <if test="fCreateTime != null">#{fCreateTime},</if>
            <if test="fRate != null">#{fRate},</if>
            <if test="fMaxAmount != null">#{fMaxAmount},</if>
            <if test="fCreateBy != null">#{fCreateBy},</if>
            <if test="fRemark != null">#{fRemark},</if>
        </trim>
    </insert>

    <update id="updateTWarehouseFeeAgreementTypeBusinessDetail" parameterType="TWarehouseFeeAgreementTypeBusinessDetail">
        update t_warehouse_fee_agreement_type_business_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="fWarehouseFeeAgreementTypeFId != null">f_warehouse_fee_agreement_type_f_id = #{fWarehouseFeeAgreementTypeFId},</if>
            <if test="fWarehouseFeeAgreementTypeBusinessFId != null">f_warehouse_fee_agreement_type_business_f_id = #{fWarehouseFeeAgreementTypeBusinessFId},</if>
            <if test="fFeeUnitId != null">f_fee_unit_id = #{fFeeUnitId},</if>
            <if test="fFreeNum != null">f_free_num = #{fFreeNum},</if>
            <if test="fSize != null">f_size = #{fSize},</if>
            <if test="fBoxModel != null">f_box_model = #{fBoxModel},</if>
            <if test="fNum != null">f_num = #{fNum},</if>
            <if test="fPrice != null">f_price = #{fPrice},</if>
            <if test="fCurrency != null">f_currency = #{fCurrency},</if>
            <if test="fIsContract != null">f_is_contract = #{fIsContract},</if>
            <if test="fDelFlag != null">f_del_flag = #{fDelFlag},</if>
            <if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
            <if test="fUpdateBy != null">f_update_by = #{fUpdateBy},</if>
            <if test="fCreateTime != null">f_create_time = #{fCreateTime},</if>
            <if test="fRate != null">f_rate = #{fRate},</if>
            <if test="fMaxAmount != null">f_max_amount = #{fMaxAmount},</if>
            <if test="fCreateBy != null">f_create_by = #{fCreateBy},</if>
            <if test="fRemark != null">f_remark = #{fRemark},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTWarehouseFeeAgreementTypeBusinessDetailById" parameterType="Long">
        delete from t_warehouse_fee_agreement_type_business_detail where f_id = #{fId}
    </delete>

    <delete id="deleteTWarehouseFeeAgreementTypeBusinessDetailByIds" parameterType="String">
        delete from t_warehouse_fee_agreement_type_business_detail where f_id in
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>

</mapper>