<?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.projectCost.mapper.ProjectCostMapper">
    
    <resultMap type="ProjectCost" id="ProjectCostResult">
        <result property="id"    column="id"    />
        <result property="taskno"    column="taskno"    />
        <result property="taskname"    column="taskname"    />
        <result property="xhname"    column="xhname"    />
        <result property="jhwcsj"    column="jhwcsj"    />
        <result property="yzjdname"    column="yzjdname"    />
        <result property="processPercent"    column="processPercent"    />
        <result property="costPercent"    column="cost_percent"    />
        <result property="yzsl"    column="yzsl"    />
        <result property="oneIncome"    column="one_income"    />
        <result property="oneCost"    column="one_cost"    />
        <result property="oneProfit"    column="one_profit"    />
        <result property="lre"    column="lre"    />
        <result property="lrl"    column="lrl"    />
        <result property="EstimationCoat"    column="EstimationCoat"    />
        <result property="contractfpe"    column="contractfpe"    />
        <result property="TaskMoney"    column="TaskMoney"    />
        <result property="zcb"    column="zcb"    />
        <result property="clf"    column="clf"    />
        <result property="zyf"    column="zyf"    />
        <result property="swf"    column="swf"    />
        <result property="wxf"    column="wxf"    />
        <result property="rldlf"    column="rldlf"    />
        <result property="gdzczj"    column="gdzczj"    />
        <result property="gzjlwf"    column="gzjlwf"    />
        <result property="glf"    column="glf"    />
        <result property="zjcb"    column="zjcb"    />
        <result property="lbsy"    column="lbsy"    />
        <result property="workhour"    column="workhour"    />
        <result property="zrbm"    column="zrbm"    />
        <result property="jycsid"    column="jycsid"    />
        <result property="jycs"    column="jycs"    />
        <result property="hxzxid"    column="hxzxid"    />
        <result property="hxzxname"    column="hxzxname"    />
        <result property="tasktype"    column="tasktype"    />
        <result property="AuditPrice"    column="AuditPrice"    />
        <result property="iflag"    column="iflag"    />
        <result property="Brief"    column="Brief"    />
        <result property="RefTaskNo"    column="RefTaskNo"    />
        <result property="pcCode"    column="pcCode"    />
        <result property="bcCode"    column="bcCode"    />
        <result property="blCode"    column="blCode"    />
        <result property="BusinessMan"    column="BusinessMan"    />
        <result property="sjgs"    column="sjgs"    />
        <result property="scgs"    column="scgs"    />
    </resultMap>

    <sql id="selectProjectCostVo">
        select id, taskno, taskname, xhname, jhwcsj, yzjdname, processPercent, cost_percent, yzsl, one_income, one_cost, one_profit, lre, lrl, EstimationCoat, contractfpe, TaskMoney, zcb, clf, zyf, swf, wxf, rldlf, gdzczj, gzjlwf, glf, zjcb, lbsy, workhour, zrbm, jycsid, jycs, hxzxid, hxzxname, tasktype, AuditPrice, iflag, Brief, RefTaskNo, pcCode, bcCode, blCode, BusinessMan, sjgs, scgs from project_cost
    </sql>

    <select id="selectProjectCostList" parameterType="ProjectCost" resultMap="ProjectCostResult">
        <include refid="selectProjectCostVo"/>
        <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="xhname != null  and xhname != ''"> and xhname like concat('%', #{xhname}, '%')</if>
            <if test="jhwcsj != null "> and jhwcsj = #{jhwcsj}</if>
            <if test="yzjdname != null  and yzjdname != ''"> and yzjdname like concat('%', #{yzjdname}, '%')</if>
            <if test="processPercent != null  and processPercent != ''"> and processPercent = #{processPercent}</if>
            <if test="costPercent != null  and costPercent != ''"> and cost_percent = #{costPercent}</if>
            <if test="oneIncome != null "> and one_income = #{oneIncome}</if>
            <if test="oneCost != null "> and one_cost = #{oneCost}</if>
            <if test="oneProfit != null "> and one_profit = #{oneProfit}</if>
            <if test="lre != null "> and lre = #{lre}</if>
            <if test="lrl != null "> and lrl = #{lrl}</if>
            <if test="EstimationCoat != null "> and EstimationCoat = #{EstimationCoat}</if>
            <if test="contractfpe != null "> and contractfpe = #{contractfpe}</if>
            <if test="TaskMoney != null "> and TaskMoney = #{TaskMoney}</if>
            <if test="zcb != null "> and zcb = #{zcb}</if>
            <if test="clf != null "> and clf = #{clf}</if>
            <if test="zyf != null "> and zyf = #{zyf}</if>
            <if test="swf != null "> and swf = #{swf}</if>
            <if test="wxf != null "> and wxf = #{wxf}</if>
            <if test="rldlf != null "> and rldlf = #{rldlf}</if>
            <if test="gdzczj != null "> and gdzczj = #{gdzczj}</if>
            <if test="gzjlwf != null "> and gzjlwf = #{gzjlwf}</if>
            <if test="glf != null "> and glf = #{glf}</if>
            <if test="zjcb != null "> and zjcb = #{zjcb}</if>
            <if test="lbsy != null "> and lbsy = #{lbsy}</if>
            <if test="workhour != null "> and workhour = #{workhour}</if>
            <if test="zrbm != null  and zrbm != ''"> and zrbm = #{zrbm}</if>
            <if test="jycsid != null "> and jycsid = #{jycsid}</if>
            <if test="jycs != null  and jycs != ''"> and jycs = #{jycs}</if>
            <if test="hxzxid != null "> and hxzxid = #{hxzxid}</if>
            <if test="hxzxname != null  and hxzxname != ''"> and hxzxname like concat('%', #{hxzxname}, '%')</if>
            <if test="tasktype != null  and tasktype != ''"> and tasktype = #{tasktype}</if>
            <if test="AuditPrice != null  and AuditPrice != ''"> and AuditPrice = #{AuditPrice}</if>
            <if test="iflag != null  and iflag != ''"> and iflag = #{iflag}</if>
            <if test="Brief != null  and Brief != ''"> and Brief = #{Brief}</if>
            <if test="RefTaskNo != null "> and RefTaskNo = #{RefTaskNo}</if>
            <if test="pcCode != null "> and pcCode = #{pcCode}</if>
            <if test="bcCode != null "> and bcCode = #{bcCode}</if>
            <if test="blCode != null "> and blCode = #{blCode}</if>
            <if test="BusinessMan != null  and BusinessMan != ''"> and BusinessMan = #{BusinessMan}</if>
            <if test="sjgs != null "> and sjgs = #{sjgs}</if>
            <if test="scgs != null "> and scgs = #{scgs}</if>
        </where>
    </select>
    
    <select id="selectProjectCostById" parameterType="Long" resultMap="ProjectCostResult">
        <include refid="selectProjectCostVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertProjectCost" parameterType="ProjectCost">
        insert into project_cost
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="taskno != null">taskno,</if>
            <if test="taskname != null">taskname,</if>
            <if test="xhname != null and xhname != ''">xhname,</if>
            <if test="jhwcsj != null">jhwcsj,</if>
            <if test="yzjdname != null">yzjdname,</if>
            <if test="processPercent != null">processPercent,</if>
            <if test="costPercent != null">cost_percent,</if>
            <if test="yzsl != null">yzsl,</if>
            <if test="oneIncome != null">one_income,</if>
            <if test="oneCost != null">one_cost,</if>
            <if test="oneProfit != null">one_profit,</if>
            <if test="lre != null">lre,</if>
            <if test="lrl != null">lrl,</if>
            <if test="EstimationCoat != null">EstimationCoat,</if>
            <if test="contractfpe != null">contractfpe,</if>
            <if test="TaskMoney != null">TaskMoney,</if>
            <if test="zcb != null">zcb,</if>
            <if test="clf != null">clf,</if>
            <if test="zyf != null">zyf,</if>
            <if test="swf != null">swf,</if>
            <if test="wxf != null">wxf,</if>
            <if test="rldlf != null">rldlf,</if>
            <if test="gdzczj != null">gdzczj,</if>
            <if test="gzjlwf != null">gzjlwf,</if>
            <if test="glf != null">glf,</if>
            <if test="zjcb != null">zjcb,</if>
            <if test="lbsy != null">lbsy,</if>
            <if test="workhour != null">workhour,</if>
            <if test="zrbm != null">zrbm,</if>
            <if test="jycsid != null">jycsid,</if>
            <if test="jycs != null">jycs,</if>
            <if test="hxzxid != null">hxzxid,</if>
            <if test="hxzxname != null">hxzxname,</if>
            <if test="tasktype != null and tasktype != ''">tasktype,</if>
            <if test="AuditPrice != null">AuditPrice,</if>
            <if test="iflag != null">iflag,</if>
            <if test="Brief != null">Brief,</if>
            <if test="RefTaskNo != null">RefTaskNo,</if>
            <if test="pcCode != null">pcCode,</if>
            <if test="bcCode != null">bcCode,</if>
            <if test="blCode != null">blCode,</if>
            <if test="BusinessMan != null">BusinessMan,</if>
            <if test="sjgs != null">sjgs,</if>
            <if test="scgs != null">scgs,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="taskno != null">#{taskno},</if>
            <if test="taskname != null">#{taskname},</if>
            <if test="xhname != null and xhname != ''">#{xhname},</if>
            <if test="jhwcsj != null">#{jhwcsj},</if>
            <if test="yzjdname != null">#{yzjdname},</if>
            <if test="processPercent != null">#{processPercent},</if>
            <if test="costPercent != null">#{costPercent},</if>
            <if test="yzsl != null">#{yzsl},</if>
            <if test="oneIncome != null">#{oneIncome},</if>
            <if test="oneCost != null">#{oneCost},</if>
            <if test="oneProfit != null">#{oneProfit},</if>
            <if test="lre != null">#{lre},</if>
            <if test="lrl != null">#{lrl},</if>
            <if test="EstimationCoat != null">#{EstimationCoat},</if>
            <if test="contractfpe != null">#{contractfpe},</if>
            <if test="TaskMoney != null">#{TaskMoney},</if>
            <if test="zcb != null">#{zcb},</if>
            <if test="clf != null">#{clf},</if>
            <if test="zyf != null">#{zyf},</if>
            <if test="swf != null">#{swf},</if>
            <if test="wxf != null">#{wxf},</if>
            <if test="rldlf != null">#{rldlf},</if>
            <if test="gdzczj != null">#{gdzczj},</if>
            <if test="gzjlwf != null">#{gzjlwf},</if>
            <if test="glf != null">#{glf},</if>
            <if test="zjcb != null">#{zjcb},</if>
            <if test="lbsy != null">#{lbsy},</if>
            <if test="workhour != null">#{workhour},</if>
            <if test="zrbm != null">#{zrbm},</if>
            <if test="jycsid != null">#{jycsid},</if>
            <if test="jycs != null">#{jycs},</if>
            <if test="hxzxid != null">#{hxzxid},</if>
            <if test="hxzxname != null">#{hxzxname},</if>
            <if test="tasktype != null and tasktype != ''">#{tasktype},</if>
            <if test="AuditPrice != null">#{AuditPrice},</if>
            <if test="iflag != null">#{iflag},</if>
            <if test="Brief != null">#{Brief},</if>
            <if test="RefTaskNo != null">#{RefTaskNo},</if>
            <if test="pcCode != null">#{pcCode},</if>
            <if test="bcCode != null">#{bcCode},</if>
            <if test="blCode != null">#{blCode},</if>
            <if test="BusinessMan != null">#{BusinessMan},</if>
            <if test="sjgs != null">#{sjgs},</if>
            <if test="scgs != null">#{scgs},</if>
         </trim>
    </insert>

    <insert id="insertBatchProjectCost" parameterType="java.util.List">
        insert into
        project_cost(id,taskno,taskname,xhname,jhwcsj,yzjdname,processPercent,cost_percent,yzsl,one_income,one_cost,
        one_profit,lre, lrl,
        EstimationCoat,contractfpe,TaskMoney,zcb,clf,zyf,swf,wxf,rldlf,gdzczj,gzjlwf,glf,zjcb,lbsy,workhour,zrbm,jycsid,jycs,
        hxzxid,hxzxname,tasktype,AuditPrice, iflag,Brief,RefTaskNo,pcCode,bcCode,blCode,BusinessMan,sjgs,scgs)
        VALUES
        <foreach collection="list" item="projectCost" index="index" separator=",">
            (
            #{projectCost.id},
            #{projectCost.taskno},
            #{projectCost.taskname},
            #{projectCost.xhname},
            #{projectCost.jhwcsj},
            #{projectCost.yzjdname},
            #{projectCost.processPercent},
            #{projectCost.costPercent},
            #{projectCost.yzsl},
            #{projectCost.oneIncome},
            #{projectCost.oneCost},
            #{projectCost.oneProfit},
            #{projectCost.lre},
            #{projectCost.lrl},
            #{projectCost.EstimationCoat},
            #{projectCost.contractfpe},
            #{projectCost.TaskMoney},
            #{projectCost.zcb},
            #{projectCost.clf},
            #{projectCost.zyf},
            #{projectCost.swf},
            #{projectCost.wxf},
            #{projectCost.rldlf},
            #{projectCost.gdzczj},
            #{projectCost.gzjlwf},
            #{projectCost.glf},
            #{projectCost.zjcb},
            #{projectCost.lbsy},
            #{projectCost.workhour},
            #{projectCost.zrbm},
            #{projectCost.jycsid},
            #{projectCost.jycs},
            #{projectCost.hxzxid},
            #{projectCost.hxzxname},
            #{projectCost.tasktype},
            #{projectCost.AuditPrice},
            #{projectCost.iflag},
            #{projectCost.Brief},
            #{projectCost.RefTaskNo},
            #{projectCost.pcCode},
            #{projectCost.bcCode},
            #{projectCost.blCode},
            #{projectCost.BusinessMan},
            #{projectCost.sjgs},
            #{projectCost.scgs}
            )
        </foreach>
    </insert>

    <update id="updateProjectCost" parameterType="ProjectCost">
        update project_cost
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskno != null">taskno = #{taskno},</if>
            <if test="taskname != null">taskname = #{taskname},</if>
            <if test="xhname != null and xhname != ''">xhname = #{xhname},</if>
            <if test="jhwcsj != null">jhwcsj = #{jhwcsj},</if>
            <if test="yzjdname != null">yzjdname = #{yzjdname},</if>
            <if test="processPercent != null">processPercent = #{processPercent},</if>
            <if test="costPercent != null">cost_percent = #{costPercent},</if>
            <if test="yzsl != null">yzsl = #{yzsl},</if>
            <if test="oneIncome != null">one_income = #{oneIncome},</if>
            <if test="oneCost != null">one_cost = #{oneCost},</if>
            <if test="oneProfit != null">one_profit = #{oneProfit},</if>
            <if test="lre != null">lre = #{lre},</if>
            <if test="lrl != null">lrl = #{lrl},</if>
            <if test="EstimationCoat != null">EstimationCoat = #{EstimationCoat},</if>
            <if test="contractfpe != null">contractfpe = #{contractfpe},</if>
            <if test="TaskMoney != null">TaskMoney = #{TaskMoney},</if>
            <if test="zcb != null">zcb = #{zcb},</if>
            <if test="clf != null">clf = #{clf},</if>
            <if test="zyf != null">zyf = #{zyf},</if>
            <if test="swf != null">swf = #{swf},</if>
            <if test="wxf != null">wxf = #{wxf},</if>
            <if test="rldlf != null">rldlf = #{rldlf},</if>
            <if test="gdzczj != null">gdzczj = #{gdzczj},</if>
            <if test="gzjlwf != null">gzjlwf = #{gzjlwf},</if>
            <if test="glf != null">glf = #{glf},</if>
            <if test="zjcb != null">zjcb = #{zjcb},</if>
            <if test="lbsy != null">lbsy = #{lbsy},</if>
            <if test="workhour != null">workhour = #{workhour},</if>
            <if test="zrbm != null">zrbm = #{zrbm},</if>
            <if test="jycsid != null">jycsid = #{jycsid},</if>
            <if test="jycs != null">jycs = #{jycs},</if>
            <if test="hxzxid != null">hxzxid = #{hxzxid},</if>
            <if test="hxzxname != null">hxzxname = #{hxzxname},</if>
            <if test="tasktype != null and tasktype != ''">tasktype = #{tasktype},</if>
            <if test="AuditPrice != null">AuditPrice = #{AuditPrice},</if>
            <if test="iflag != null">iflag = #{iflag},</if>
            <if test="Brief != null">Brief = #{Brief},</if>
            <if test="RefTaskNo != null">RefTaskNo = #{RefTaskNo},</if>
            <if test="pcCode != null">pcCode = #{pcCode},</if>
            <if test="bcCode != null">bcCode = #{bcCode},</if>
            <if test="blCode != null">blCode = #{blCode},</if>
            <if test="BusinessMan != null">BusinessMan = #{BusinessMan},</if>
            <if test="sjgs != null">sjgs = #{sjgs},</if>
            <if test="scgs != null">scgs = #{scgs},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteProjectCostById" parameterType="Long">
        delete from project_cost where id = #{id}
    </delete>

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