<?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.projectChbWxf.mapper.KzksProjectChbWxfMapper">
    
    <resultMap type="KzksProjectChbWxf" id="KzksProjectChbWxfResult">
        <result property="id"    column="id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="sysOrgCode"    column="sys_org_code"    />
        <result property="nd"    column="nd"    />
        <result property="pzrq"    column="pzrq"    />
        <result property="pzh"    column="pzh"    />
        <result property="zy"    column="zy"    />
        <result property="kmbh"    column="kmbh"    />
        <result property="km"    column="km"    />
        <result property="fx"    column="fx"    />
        <result property="je"    column="je"    />
        <result property="bm"    column="bm"    />
        <result property="wldw"    column="wldw"    />
        <result property="fzje"    column="fzje"    />
        <result property="zdr"    column="zdr"    />
        <result property="kjqj"    column="kjqj"    />
        <result property="pznm"    column="pznm"    />
        <result property="xmbh"    column="xmbh"    />
        <result property="xmmc"    column="xmmc"    />
        <result property="xmlb"    column="xmlb"    />
        <result property="taskno"    column="taskno"    />
    </resultMap>

    <sql id="selectKzksProjectChbWxfVo">
        select id, create_by, create_time, update_by, update_time, sys_org_code, nd, pzrq, pzh, zy, kmbh, km, fx, je, bm, wldw, fzje, zdr, kjqj, pznm, xmbh, xmmc, xmlb, taskno from kzks_project_chb_wxf
    </sql>

    <select id="selectKzksProjectChbWxfList" parameterType="KzksProjectChbWxf" resultMap="KzksProjectChbWxfResult">
        <include refid="selectKzksProjectChbWxfVo"/>
        <where>  
            <if test="sysOrgCode != null  and sysOrgCode != ''"> and sys_org_code = #{sysOrgCode}</if>
            <if test="nd != null  and nd != ''"> and nd = #{nd}</if>
            <if test="pzrq != null  and pzrq != ''"> and pzrq = #{pzrq}</if>
            <if test="pzh != null  and pzh != ''"> and pzh = #{pzh}</if>
            <if test="zy != null  and zy != ''"> and zy = #{zy}</if>
            <if test="kmbh != null  and kmbh != ''"> and kmbh = #{kmbh}</if>
            <if test="km != null  and km != ''"> and km = #{km}</if>
            <if test="fx != null  and fx != ''"> and fx = #{fx}</if>
            <if test="je != null  and je != ''"> and je = #{je}</if>
            <if test="bm != null  and bm != ''"> and bm = #{bm}</if>
            <if test="wldw != null  and wldw != ''"> and wldw = #{wldw}</if>
            <if test="fzje != null  and fzje != ''"> and fzje = #{fzje}</if>
            <if test="zdr != null  and zdr != ''"> and zdr = #{zdr}</if>
            <if test="kjqj != null  and kjqj != ''"> and kjqj = #{kjqj}</if>
            <if test="pznm != null  and pznm != ''"> and pznm = #{pznm}</if>
            <if test="xmbh != null  and xmbh != ''"> and xmbh = #{xmbh}</if>
            <if test="xmmc != null  and xmmc != ''"> and xmmc = #{xmmc}</if>
            <if test="xmlb != null  and xmlb != ''"> and xmlb = #{xmlb}</if>
            <if test="taskno != null  and taskno != ''"> and taskno = #{taskno}</if>
        </where>
    </select>
    
    <select id="selectKzksProjectChbWxfById" parameterType="String" resultMap="KzksProjectChbWxfResult">
        <include refid="selectKzksProjectChbWxfVo"/>
        where id = #{id}
    </select>
    <select id="selectWxfByTaskno" resultType="java.math.BigDecimal">
        select SUM(fzje),taskno from kzks_project_chb_wxf where taskno = #{taskno}
    </select>

    <insert id="insertKzksProjectChbWxf" parameterType="KzksProjectChbWxf">
        insert into kzks_project_chb_wxf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="sysOrgCode != null">sys_org_code,</if>
            <if test="nd != null">nd,</if>
            <if test="pzrq != null">pzrq,</if>
            <if test="pzh != null">pzh,</if>
            <if test="zy != null">zy,</if>
            <if test="kmbh != null">kmbh,</if>
            <if test="km != null">km,</if>
            <if test="fx != null">fx,</if>
            <if test="je != null">je,</if>
            <if test="bm != null">bm,</if>
            <if test="wldw != null">wldw,</if>
            <if test="fzje != null">fzje,</if>
            <if test="zdr != null">zdr,</if>
            <if test="kjqj != null">kjqj,</if>
            <if test="pznm != null">pznm,</if>
            <if test="xmbh != null">xmbh,</if>
            <if test="xmmc != null">xmmc,</if>
            <if test="xmlb != null">xmlb,</if>
            <if test="taskno != null">taskno,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="sysOrgCode != null">#{sysOrgCode},</if>
            <if test="nd != null">#{nd},</if>
            <if test="pzrq != null">#{pzrq},</if>
            <if test="pzh != null">#{pzh},</if>
            <if test="zy != null">#{zy},</if>
            <if test="kmbh != null">#{kmbh},</if>
            <if test="km != null">#{km},</if>
            <if test="fx != null">#{fx},</if>
            <if test="je != null">#{je},</if>
            <if test="bm != null">#{bm},</if>
            <if test="wldw != null">#{wldw},</if>
            <if test="fzje != null">#{fzje},</if>
            <if test="zdr != null">#{zdr},</if>
            <if test="kjqj != null">#{kjqj},</if>
            <if test="pznm != null">#{pznm},</if>
            <if test="xmbh != null">#{xmbh},</if>
            <if test="xmmc != null">#{xmmc},</if>
            <if test="xmlb != null">#{xmlb},</if>
            <if test="taskno != null">#{taskno},</if>
         </trim>
    </insert>

    <update id="updateKzksProjectChbWxf" parameterType="KzksProjectChbWxf">
        update kzks_project_chb_wxf
        <trim prefix="SET" suffixOverrides=",">
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="sysOrgCode != null">sys_org_code = #{sysOrgCode},</if>
            <if test="nd != null">nd = #{nd},</if>
            <if test="pzrq != null">pzrq = #{pzrq},</if>
            <if test="pzh != null">pzh = #{pzh},</if>
            <if test="zy != null">zy = #{zy},</if>
            <if test="kmbh != null">kmbh = #{kmbh},</if>
            <if test="km != null">km = #{km},</if>
            <if test="fx != null">fx = #{fx},</if>
            <if test="je != null">je = #{je},</if>
            <if test="bm != null">bm = #{bm},</if>
            <if test="wldw != null">wldw = #{wldw},</if>
            <if test="fzje != null">fzje = #{fzje},</if>
            <if test="zdr != null">zdr = #{zdr},</if>
            <if test="kjqj != null">kjqj = #{kjqj},</if>
            <if test="pznm != null">pznm = #{pznm},</if>
            <if test="xmbh != null">xmbh = #{xmbh},</if>
            <if test="xmmc != null">xmmc = #{xmmc},</if>
            <if test="xmlb != null">xmlb = #{xmlb},</if>
            <if test="taskno != null">taskno = #{taskno},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteKzksProjectChbWxfById" parameterType="String">
        delete from kzks_project_chb_wxf where id = #{id}
    </delete>

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