<?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.orderManagement.finance.mapper.FTmsaccbillsitemsMapper">

    <resultMap type="FTmsaccbillsitems" id="FTmsaccbillsitemsResult">
        <result property="id"    column="id"    />
        <result property="fPid"    column="f_pid"    />
        <result property="fActId"    column="f_act_id"    />
        <result property="fSrcid"    column="f_srcid"    />
        <result property="orderNo"    column="order_no"    />
        <result property="fSrcpid"    column="f_srcpid"    />
        <result property="dc"    column="dc"    />
        <result property="fSrcdc"    column="f_srcdc"    />
        <result property="amtOrg"    column="amt_org"    />
        <result property="fLineno"    column="f_lineno"    />
        <result property="amtStl"    column="amt_stl"    />
        <result property="fFeeid"    column="f_feeid"    />
        <result property="amtBlc"    column="amt_blc"    />
        <result property="amtCur"    column="amt_cur"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="fAmt"    column="f_amt"    />
        <result property="createBy"    column="create_by"    />
        <result property="fAmtdr"    column="f_amtdr"    />
        <result property="createTime"    column="create_time"    />
        <result property="fAmtStl"    column="f_amt_stl"    />
        <result property="updateBy"    column="update_by"    />
        <result property="fAmtBlc"    column="f_amt_blc"    />
        <result property="updateTime"    column="update_time"    />
        <result property="fStatus"    column="f_status"    />
        <result property="fRemarks"    column="f_remarks"    />
    </resultMap>

    <sql id="selectFTmsaccbillsitemsVo">
        select id, f_pid, f_act_id, f_srcid, order_no, f_srcpid, dc, f_srcdc, amt_org, f_lineno, amt_stl, f_feeid, amt_blc, amt_cur, del_flag, f_amt, create_by, f_amtdr, create_time, f_amt_stl, update_by, f_amt_blc, update_time, f_status, f_remarks from F_TMSACCBILLSITEMS
    </sql>

    <select id="selectFTmsaccbillsitemsList" parameterType="FTmsaccbillsitems" resultMap="FTmsaccbillsitemsResult">
        <include refid="selectFTmsaccbillsitemsVo"/>
        <where>
            <if test="fPid != null "> and f_pid = #{fPid}</if>
            <if test="fActId != null "> and f_act_id = #{fActId}</if>
            <if test="fSrcid != null "> and f_srcid = #{fSrcid}</if>
            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="fSrcpid != null "> and f_srcpid = #{fSrcpid}</if>
            <if test="dc != null  and dc != ''"> and dc = #{dc}</if>
            <if test="fSrcdc != null  and fSrcdc != ''"> and f_srcdc = #{fSrcdc}</if>
            <if test="amtOrg != null "> and amt_org = #{amtOrg}</if>
            <if test="fLineno != null "> and f_lineno = #{fLineno}</if>
            <if test="amtStl != null "> and amt_stl = #{amtStl}</if>
            <if test="fFeeid != null "> and f_feeid = #{fFeeid}</if>
            <if test="amtBlc != null "> and amt_blc = #{amtBlc}</if>
            <if test="amtCur != null "> and amt_cur = #{amtCur}</if>
            <if test="fAmt != null "> and f_amt = #{fAmt}</if>
            <if test="fAmtdr != null "> and f_amtdr = #{fAmtdr}</if>
            <if test="fAmtStl != null "> and f_amt_stl = #{fAmtStl}</if>
            <if test="fAmtBlc != null "> and f_amt_blc = #{fAmtBlc}</if>
            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
            <if test="fRemarks != null  and fRemarks != ''"> and f_remarks = #{fRemarks}</if>
        </where>
    </select>
    
    <select id="selectFTmsaccbillsitemsById" parameterType="Long" resultMap="FTmsaccbillsitemsResult">
        <include refid="selectFTmsaccbillsitemsVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertFTmsaccbillsitems" parameterType="FTmsaccbillsitems" useGeneratedKeys="true" keyProperty="id">
        insert into F_TMSACCBILLSITEMS
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fPid != null">f_pid,</if>
            <if test="fActId != null">f_act_id,</if>
            <if test="fSrcid != null">f_srcid,</if>
            <if test="orderNo != null">order_no,</if>
            <if test="fSrcpid != null">f_srcpid,</if>
            <if test="dc != null">dc,</if>
            <if test="fSrcdc != null">f_srcdc,</if>
            <if test="amtOrg != null">amt_org,</if>
            <if test="fLineno != null">f_lineno,</if>
            <if test="amtStl != null">amt_stl,</if>
            <if test="fFeeid != null">f_feeid,</if>
            <if test="amtBlc != null">amt_blc,</if>
            <if test="amtCur != null">amt_cur,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="fAmt != null">f_amt,</if>
            <if test="createBy != null">create_by,</if>
            <if test="fAmtdr != null">f_amtdr,</if>
            <if test="createTime != null">create_time,</if>
            <if test="fAmtStl != null">f_amt_stl,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="fAmtBlc != null">f_amt_blc,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="fRemarks != null">f_remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fPid != null">#{fPid},</if>
            <if test="fActId != null">#{fActId},</if>
            <if test="fSrcid != null">#{fSrcid},</if>
            <if test="orderNo != null">#{orderNo},</if>
            <if test="fSrcpid != null">#{fSrcpid},</if>
            <if test="dc != null">#{dc},</if>
            <if test="fSrcdc != null">#{fSrcdc},</if>
            <if test="amtOrg != null">#{amtOrg},</if>
            <if test="fLineno != null">#{fLineno},</if>
            <if test="amtStl != null">#{amtStl},</if>
            <if test="fFeeid != null">#{fFeeid},</if>
            <if test="amtBlc != null">#{amtBlc},</if>
            <if test="amtCur != null">#{amtCur},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="fAmt != null">#{fAmt},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="fAmtdr != null">#{fAmtdr},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="fAmtStl != null">#{fAmtStl},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="fAmtBlc != null">#{fAmtBlc},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="fRemarks != null">#{fRemarks},</if>
        </trim>
    </insert>

    <update id="updateFTmsaccbillsitems" parameterType="FTmsaccbillsitems">
        update F_TMSACCBILLSITEMS
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="fActId != null">f_act_id = #{fActId},</if>
            <if test="fSrcid != null">f_srcid = #{fSrcid},</if>
            <if test="orderNo != null">order_no = #{orderNo},</if>
            <if test="fSrcpid != null">f_srcpid = #{fSrcpid},</if>
            <if test="dc != null">dc = #{dc},</if>
            <if test="fSrcdc != null">f_srcdc = #{fSrcdc},</if>
            <if test="amtOrg != null">amt_org = #{amtOrg},</if>
            <if test="fLineno != null">f_lineno = #{fLineno},</if>
            <if test="amtStl != null">amt_stl = #{amtStl},</if>
            <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
            <if test="amtBlc != null">amt_blc = #{amtBlc},</if>
            <if test="amtCur != null">amt_cur = #{amtCur},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="fAmt != null">f_amt = #{fAmt},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="fAmtStl != null">f_amt_stl = #{fAmtStl},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="fAmtBlc != null">f_amt_blc = #{fAmtBlc},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFTmsaccbillsitemsById" parameterType="Long">
        delete from F_TMSACCBILLSITEMS where id = #{id}
    </delete>

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

    <delete id="deleteByFPid" parameterType="Long">
        delete from F_TMSACCBILLSITEMS where f_pid = #{fId}
    </delete>

    <update id="tfeeDoFollowUpdate" parameterType="Long">
        update
            F_TMSACCBILLSITEMS
        set f_status = #{fettle}
        where
            f_pid = #{fPid}
    </update>
</mapper>