<?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.TWarehouseFeeAgreementTypeBusinessDetailFormulaMapper">
    
    <resultMap type="TWarehouseFeeAgreementTypeBusinessDetailFormula" id="TWarehouseFeeAgreementTypeBusinessDetailFormulaResult">
        <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="fWarehouseFeeAgreementTypeBusinessDetailFId"    column="f_warehouse_fee_agreement_type_business_detail_f_id"    />
        <result property="fAttribute"    column="f_attribute"    />
        <result property="fFormula"    column="f_formula"    />
        <result property="fValue"    column="f_value"    />
        <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="fCreateBy"    column="f_create_by"    />
        <result property="fRemark"    column="f_remark"    />
    </resultMap>

    <sql id="selectTWarehouseFeeAgreementTypeBusinessDetailFormulaVo">
        select f_id, f_warehouse_fee_agreement_type_f_id, f_warehouse_fee_agreement_type_business_f_id, f_warehouse_fee_agreement_type_business_detail_f_id, f_attribute, f_formula, f_value, f_del_flag, f_update_time, f_update_by, f_create_time, f_create_by, f_remark from t_warehouse_fee_agreement_type_business_detail_formula
    </sql>

    <select id="selectTWarehouseFeeAgreementTypeBusinessDetailFormulaList" parameterType="TWarehouseFeeAgreementTypeBusinessDetailFormula" resultMap="TWarehouseFeeAgreementTypeBusinessDetailFormulaResult">
        <include refid="selectTWarehouseFeeAgreementTypeBusinessDetailFormulaVo"/>
        <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="fWarehouseFeeAgreementTypeBusinessDetailFId != null "> and f_warehouse_fee_agreement_type_business_detail_f_id = #{fWarehouseFeeAgreementTypeBusinessDetailFId}</if>
            <if test="fAttribute != null "> and f_attribute = #{fAttribute}</if>
            <if test="fFormula != null "> and f_formula = #{fFormula}</if>
            <if test="fValue != null  and fValue != ''"> and f_value = #{fValue}</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="fCreateBy != null "> and f_create_by = #{fCreateBy}</if>
            <if test="fRemark != null  and fRemark != ''"> and f_remark = #{fRemark}</if>
        </where>
    </select>
    
    <select id="selectTWarehouseFeeAgreementTypeBusinessDetailFormulaById" parameterType="Long" resultMap="TWarehouseFeeAgreementTypeBusinessDetailFormulaResult">
        <include refid="selectTWarehouseFeeAgreementTypeBusinessDetailFormulaVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTWarehouseFeeAgreementTypeBusinessDetailFormula" parameterType="TWarehouseFeeAgreementTypeBusinessDetailFormula" useGeneratedKeys="true" keyProperty="fId">
        insert into t_warehouse_fee_agreement_type_business_detail_formula
        <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="fWarehouseFeeAgreementTypeBusinessDetailFId != null">f_warehouse_fee_agreement_type_business_detail_f_id,</if>
            <if test="fAttribute != null">f_attribute,</if>
            <if test="fFormula != null">f_formula,</if>
            <if test="fValue != null">f_value,</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="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="fWarehouseFeeAgreementTypeBusinessDetailFId != null">#{fWarehouseFeeAgreementTypeBusinessDetailFId},</if>
            <if test="fAttribute != null">#{fAttribute},</if>
            <if test="fFormula != null">#{fFormula},</if>
            <if test="fValue != null">#{fValue},</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="fCreateBy != null">#{fCreateBy},</if>
            <if test="fRemark != null">#{fRemark},</if>
         </trim>
    </insert>

    <update id="updateTWarehouseFeeAgreementTypeBusinessDetailFormula" parameterType="TWarehouseFeeAgreementTypeBusinessDetailFormula">
        update t_warehouse_fee_agreement_type_business_detail_formula
        <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="fWarehouseFeeAgreementTypeBusinessDetailFId != null">f_warehouse_fee_agreement_type_business_detail_f_id = #{fWarehouseFeeAgreementTypeBusinessDetailFId},</if>
            <if test="fAttribute != null">f_attribute = #{fAttribute},</if>
            <if test="fFormula != null">f_formula = #{fFormula},</if>
            <if test="fValue != null">f_value = #{fValue},</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="fCreateBy != null">f_create_by = #{fCreateBy},</if>
            <if test="fRemark != null">f_remark = #{fRemark},</if>
        </trim>
        where f_id = #{fId}
    </update>

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

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