<?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.project.zt.mapper.LjZtzhdfMapper">
    
    <resultMap type="LjZtzhdf" id="LjZtzhdfResult">
        <result property="id"    column="id"    />
        <result property="kc"    column="kc"    />
        <result property="ztxh"    column="ztxh"    />
        <result property="cc"    column="cc"    />
        <result property="jcdf"    column="jcdf"    />
        <result property="jsdf"    column="jsdf"    />
        <result property="zbdf"    column="zbdf"    />
        <result property="sldf"    column="sldf"    />
        <result property="zhdf"    column="zhdf"    />
        <result property="createdBy"    column="created_by"    />
        <result property="createdTime"    column="created_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectLjZtzhdfVo">
        select id, kc, ztxh, cc, jcdf, jsdf, zbdf, sldf, zhdf, created_by, created_time, update_by, update_time from lj_ztzhdf
    </sql>

    <select id="selectLjZtzhdfList" parameterType="LjZtzhdf" resultMap="LjZtzhdfResult">
        <include refid="selectLjZtzhdfVo"/>
        <where>  
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="ztxh != null  and ztxh != ''"> and ztxh = #{ztxh}</if>
            <if test="cc != null "> and cc = #{cc}</if>
            <if test="jcdf != null "> and jcdf = #{jcdf}</if>
            <if test="jsdf != null "> and jsdf = #{jsdf}</if>
            <if test="zbdf != null "> and zbdf = #{zbdf}</if>
            <if test="sldf != null "> and sldf = #{sldf}</if>
            <if test="zhdf != null "> and zhdf = #{zhdf}</if>
            <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
            <if test="createdTime != null "> and created_time = #{createdTime}</if>
        </where>
    </select>
    
    <select id="selectLjZtzhdfById" parameterType="Long" resultMap="LjZtzhdfResult">
        <include refid="selectLjZtzhdfVo"/>
        where id = #{id}
    </select>
    <select id="selectLjZtzhdfListByCom" resultMap="LjZtzhdfResult">
        <include refid="selectLjZtzhdfVo"/>
        <where>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="ztxh != null  and ztxh != ''"> and ztxh = #{ztxh}</if>
            <if test="cc != null "> and cc = #{cc}</if>
            <if test="jcdf != null "> and jcdf = #{jcdf}</if>
            <if test="jsdf != null "> and jsdf = #{jsdf}</if>
            <if test="zbdf != null "> and zbdf = #{zbdf}</if>
            <if test="sldf != null "> and sldf = #{sldf}</if>
            <if test="zhdf != null "> and zhdf = #{zhdf}</if>
            <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
            <if test="createdTime != null "> and created_time = #{createdTime}</if>
        </where>
    </select>

    <insert id="insertLjZtzhdf" parameterType="LjZtzhdf" useGeneratedKeys="true" keyProperty="id">
        insert into lj_ztzhdf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="kc != null">kc,</if>
            <if test="ztxh != null">ztxh,</if>
            <if test="cc != null">cc,</if>
            <if test="jcdf != null">jcdf,</if>
            <if test="jsdf != null">jsdf,</if>
            <if test="zbdf != null">zbdf,</if>
            <if test="sldf != null">sldf,</if>
            <if test="zhdf != null">zhdf,</if>
            <if test="createdBy != null">created_by,</if>
            <if test="createdTime != null">created_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="kc != null">#{kc},</if>
            <if test="ztxh != null">#{ztxh},</if>
            <if test="cc != null">#{cc},</if>
            <if test="jcdf != null">#{jcdf},</if>
            <if test="jsdf != null">#{jsdf},</if>
            <if test="zbdf != null">#{zbdf},</if>
            <if test="sldf != null">#{sldf},</if>
            <if test="zhdf != null">#{zhdf},</if>
            <if test="createdBy != null">#{createdBy},</if>
            <if test="createdTime != null">#{createdTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateLjZtzhdf" parameterType="LjZtzhdf">
        update lj_ztzhdf
        <trim prefix="SET" suffixOverrides=",">
            <if test="kc != null">kc = #{kc},</if>
            <if test="ztxh != null">ztxh = #{ztxh},</if>
            <if test="cc != null">cc = #{cc},</if>
            <if test="jcdf != null">jcdf = #{jcdf},</if>
            <if test="jsdf != null">jsdf = #{jsdf},</if>
            <if test="zbdf != null">zbdf = #{zbdf},</if>
            <if test="sldf != null">sldf = #{sldf},</if>
            <if test="zhdf != null">zhdf = #{zhdf},</if>
            <if test="createdBy != null">created_by = #{createdBy},</if>
            <if test="createdTime != null">created_time = #{createdTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLjZtzhdfById" parameterType="Long">
        delete from lj_ztzhdf where id = #{id}
    </delete>

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


    <insert id="batchLjZtzhdf">
        insert into lj_ztzhdf( kc, ztxh, cc, jcdf, jsdf, zbdf, sldf, zhdf) values
        <foreach item="item" index="index" collection="list" separator=",">
            (  #{item.kc}, #{item.ztxh}, #{item.cc}, #{item.jcdf}, #{item.jsdf}, #{item.zbdf}, #{item.sldf}, #{item.zhdf})
        </foreach>
    </insert>
</mapper>