<?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.financeBudget.mapper.FinanceBudgetMapper">
    
    <resultMap type="FinanceBudget" id="FinanceBudgetResult">
        <result property="id"    column="id"    />
        <result property="taskno"    column="taskno"    />
        <result property="taskname"    column="taskname"    />
        <result property="iflag"    column="iflag"    />
        <result property="hxzxname"    column="hxzxname"    />
        <result property="xhid"    column="xhid"    />
        <result property="yzjdname"    column="yzjdname"    />
        <result property="yzsl"    column="yzsl"    />
        <result property="tcdw"    column="tcdw"    />
        <result property="Brief"    column="Brief"    />
        <result property="zrbm"    column="zrbm"    />
        <result property="jycs"    column="jycs"    />
        <result property="tasktype"    column="tasktype"    />
        <result property="auditPrice"    column="auditPrice"    />
        <result property="businessManName"    column="businessManName"    />
        <result property="lrsj"    column="lrsj"    />
        <result property="sjkssj"    column="sjkssj"    />
        <result property="jhwcsj"    column="jhwcsj"    />
        <result property="ProcessPercent"    column="ProcessPercent"    />
        <result property="EstimationCoat"    column="EstimationCoat"    />
        <result property="contractfpe"    column="contractfpe"    />
        <result property="sjCost"    column="sjCost"    />
        <result property="clCost"    column="clCost"    />
        <result property="wxCost"    column="wxCost"    />
        <result property="zyCost"    column="zyCost"    />
        <result property="gzCost"    column="gzCost"    />
        <result property="rdCost"    column="rdCost"    />
        <result property="glCost"    column="glCost"    />
        <result property="rgCost"    column="rgCost"    />
        <result property="refTaskNo"    column="refTaskNo"    />
    </resultMap>

    <sql id="selectFinanceBudgetVo">
        select id, taskno, taskname, iflag, hxzxname, xhid, yzjdname, yzsl, tcdw, Brief, zrbm, jycs, tasktype, auditPrice, businessManName, lrsj, sjkssj, jhwcsj, ProcessPercent, EstimationCoat, contractfpe, sjCost, clCost, wxCost, zyCost, gzCost, rdCost, glCost, rgCost, refTaskNo from finance_budget
    </sql>

    <select id="selectFinanceBudgetList" parameterType="FinanceBudget" resultMap="FinanceBudgetResult">
        <include refid="selectFinanceBudgetVo"/>
        <where>  
            <if test="taskno != null  and taskno != ''"> and taskno = #{taskno}</if>
            <if test="taskname != null  and taskname != ''"> and taskname like concat('%', #{taskname}, '%')</if>
            <if test="iflag != null  and iflag != ''"> and iflag = #{iflag}</if>
            <if test="hxzxname != null  and hxzxname != ''"> and hxzxname like concat('%', #{hxzxname}, '%')</if>
            <if test="xhid != null  and xhid != ''"> and xhid = #{xhid}</if>
            <if test="yzjdname != null  and yzjdname != ''"> and yzjdname like concat('%', #{yzjdname}, '%')</if>
            <if test="yzsl != null  and yzsl != ''"> and yzsl = #{yzsl}</if>
            <if test="tcdw != null  and tcdw != ''"> and tcdw = #{tcdw}</if>
            <if test="Brief != null  and Brief != ''"> and Brief = #{Brief}</if>
            <if test="zrbm != null  and zrbm != ''"> and zrbm = #{zrbm}</if>
            <if test="jycs != null  and jycs != ''"> and jycs = #{jycs}</if>
            <if test="tasktype != null  and tasktype != ''"> and tasktype = #{tasktype}</if>
            <if test="auditPrice != null  and auditPrice != ''"> and auditPrice = #{auditPrice}</if>
            <if test="businessManName != null  and businessManName != ''"> and businessManName like concat('%', #{businessManName}, '%')</if>
            <if test="lrsj != null  and lrsj != ''"> and lrsj = #{lrsj}</if>
            <if test="sjkssj != null  and sjkssj != ''"> and sjkssj = #{sjkssj}</if>
            <if test="jhwcsj != null  and jhwcsj != ''"> and jhwcsj = #{jhwcsj}</if>
            <if test="ProcessPercent != null  and ProcessPercent != ''"> and ProcessPercent = #{ProcessPercent}</if>
            <if test="EstimationCoat != null  and EstimationCoat != ''"> and EstimationCoat = #{EstimationCoat}</if>
            <if test="contractfpe != null  and contractfpe != ''"> and contractfpe = #{contractfpe}</if>
            <if test="sjCost != null  and sjCost != ''"> and sjCost = #{sjCost}</if>
            <if test="clCost != null  and clCost != ''"> and clCost = #{clCost}</if>
            <if test="wxCost != null  and wxCost != ''"> and wxCost = #{wxCost}</if>
            <if test="zyCost != null  and zyCost != ''"> and zyCost = #{zyCost}</if>
            <if test="gzCost != null  and gzCost != ''"> and gzCost = #{gzCost}</if>
            <if test="rdCost != null  and rdCost != ''"> and rdCost = #{rdCost}</if>
            <if test="glCost != null  and glCost != ''"> and glCost = #{glCost}</if>
            <if test="rgCost != null  and rgCost != ''"> and rgCost = #{rgCost}</if>
            <if test="refTaskNo != null  and refTaskNo != ''"> and refTaskNo = #{refTaskNo}</if>
        </where>
    </select>
    
    <select id="selectFinanceBudgetById" parameterType="Long" resultMap="FinanceBudgetResult">
        <include refid="selectFinanceBudgetVo"/>
        where id = #{id}
    </select>
    <select id="selectEstimationCoatByTaskno" resultType="com.ruoyi.financeBudget.domain.FinanceBudget">
        select id,taskno,EstimationCoat from finance_budget where taskno = #{taskno}
    </select>

    <insert id="insertFinanceBudget" parameterType="FinanceBudget" useGeneratedKeys="true" keyProperty="id">
        insert into finance_budget
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskno != null">taskno,</if>
            <if test="taskname != null">taskname,</if>
            <if test="iflag != null">iflag,</if>
            <if test="hxzxname != null">hxzxname,</if>
            <if test="xhid != null">xhid,</if>
            <if test="yzjdname != null">yzjdname,</if>
            <if test="yzsl != null">yzsl,</if>
            <if test="tcdw != null">tcdw,</if>
            <if test="Brief != null">Brief,</if>
            <if test="zrbm != null">zrbm,</if>
            <if test="jycs != null">jycs,</if>
            <if test="tasktype != null">tasktype,</if>
            <if test="auditPrice != null">auditPrice,</if>
            <if test="businessManName != null">businessManName,</if>
            <if test="lrsj != null">lrsj,</if>
            <if test="sjkssj != null">sjkssj,</if>
            <if test="jhwcsj != null">jhwcsj,</if>
            <if test="ProcessPercent != null">ProcessPercent,</if>
            <if test="EstimationCoat != null">EstimationCoat,</if>
            <if test="contractfpe != null">contractfpe,</if>
            <if test="sjCost != null">sjCost,</if>
            <if test="clCost != null">clCost,</if>
            <if test="wxCost != null">wxCost,</if>
            <if test="zyCost != null">zyCost,</if>
            <if test="gzCost != null">gzCost,</if>
            <if test="rdCost != null">rdCost,</if>
            <if test="glCost != null">glCost,</if>
            <if test="rgCost != null">rgCost,</if>
            <if test="refTaskNo != null">refTaskNo,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskno != null">#{taskno},</if>
            <if test="taskname != null">#{taskname},</if>
            <if test="iflag != null">#{iflag},</if>
            <if test="hxzxname != null">#{hxzxname},</if>
            <if test="xhid != null">#{xhid},</if>
            <if test="yzjdname != null">#{yzjdname},</if>
            <if test="yzsl != null">#{yzsl},</if>
            <if test="tcdw != null">#{tcdw},</if>
            <if test="Brief != null">#{Brief},</if>
            <if test="zrbm != null">#{zrbm},</if>
            <if test="jycs != null">#{jycs},</if>
            <if test="tasktype != null">#{tasktype},</if>
            <if test="auditPrice != null">#{auditPrice},</if>
            <if test="businessManName != null">#{businessManName},</if>
            <if test="lrsj != null">#{lrsj},</if>
            <if test="sjkssj != null">#{sjkssj},</if>
            <if test="jhwcsj != null">#{jhwcsj},</if>
            <if test="ProcessPercent != null">#{ProcessPercent},</if>
            <if test="EstimationCoat != null">#{EstimationCoat},</if>
            <if test="contractfpe != null">#{contractfpe},</if>
            <if test="sjCost != null">#{sjCost},</if>
            <if test="clCost != null">#{clCost},</if>
            <if test="wxCost != null">#{wxCost},</if>
            <if test="zyCost != null">#{zyCost},</if>
            <if test="gzCost != null">#{gzCost},</if>
            <if test="rdCost != null">#{rdCost},</if>
            <if test="glCost != null">#{glCost},</if>
            <if test="rgCost != null">#{rgCost},</if>
            <if test="refTaskNo != null">#{refTaskNo},</if>
         </trim>
    </insert>

    <update id="updateFinanceBudget" parameterType="FinanceBudget">
        update finance_budget
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskno != null">taskno = #{taskno},</if>
            <if test="taskname != null">taskname = #{taskname},</if>
            <if test="iflag != null">iflag = #{iflag},</if>
            <if test="hxzxname != null">hxzxname = #{hxzxname},</if>
            <if test="xhid != null">xhid = #{xhid},</if>
            <if test="yzjdname != null">yzjdname = #{yzjdname},</if>
            <if test="yzsl != null">yzsl = #{yzsl},</if>
            <if test="tcdw != null">tcdw = #{tcdw},</if>
            <if test="Brief != null">Brief = #{Brief},</if>
            <if test="zrbm != null">zrbm = #{zrbm},</if>
            <if test="jycs != null">jycs = #{jycs},</if>
            <if test="tasktype != null">tasktype = #{tasktype},</if>
            <if test="auditPrice != null">auditPrice = #{auditPrice},</if>
            <if test="businessManName != null">businessManName = #{businessManName},</if>
            <if test="lrsj != null">lrsj = #{lrsj},</if>
            <if test="sjkssj != null">sjkssj = #{sjkssj},</if>
            <if test="jhwcsj != null">jhwcsj = #{jhwcsj},</if>
            <if test="ProcessPercent != null">ProcessPercent = #{ProcessPercent},</if>
            <if test="EstimationCoat != null">EstimationCoat = #{EstimationCoat},</if>
            <if test="contractfpe != null">contractfpe = #{contractfpe},</if>
            <if test="sjCost != null">sjCost = #{sjCost},</if>
            <if test="clCost != null">clCost = #{clCost},</if>
            <if test="wxCost != null">wxCost = #{wxCost},</if>
            <if test="zyCost != null">zyCost = #{zyCost},</if>
            <if test="gzCost != null">gzCost = #{gzCost},</if>
            <if test="rdCost != null">rdCost = #{rdCost},</if>
            <if test="glCost != null">glCost = #{glCost},</if>
            <if test="rgCost != null">rgCost = #{rgCost},</if>
            <if test="refTaskNo != null">refTaskNo = #{refTaskNo},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFinanceBudgetById" parameterType="Long">
        delete from finance_budget where id = #{id}
    </delete>

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