<?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.LjZjzhfxMapper">
    
    <resultMap type="LjZjzhfx" id="LjZjzhfxResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="kc"    column="kc"    />
        <result property="zjzhmx"    column="zjzhmx"    />
        <result property="tsgj"    column="tsgj"    />
        <result property="zjzh"    column="zjzh"    />
        <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="selectLjZjzhfxVo">
        select id, jh, kc, zjzhmx, tsgj, zjzh, created_by, created_time, update_by, update_time from lj_zjzhfx
    </sql>

    <select id="selectLjZjzhfxList" parameterType="LjZjzhfx" resultMap="LjZjzhfxResult">
        <include refid="selectLjZjzhfxVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="zjzhmx != null  and zjzhmx != ''"> and zjzhmx = #{zjzhmx}</if>
            <if test="tsgj != null  and tsgj != ''"> and tsgj = #{tsgj}</if>
            <if test="zjzh != null  and zjzh != ''"> and zjzh = #{zjzh}</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="selectLjZjzhfxById" parameterType="Long" resultMap="LjZjzhfxResult">
        <include refid="selectLjZjzhfxVo"/>
        where id = #{id}
    </select>

    <insert id="insertLjZjzhfx" parameterType="LjZjzhfx" >
        insert into lj_zjzhfx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="kc != null">kc,</if>
            <if test="zjzhmx != null">zjzhmx,</if>
            <if test="tsgj != null">tsgj,</if>
            <if test="zjzh != null">zjzh,</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="jh != null">#{jh},</if>
            <if test="kc != null">#{kc},</if>
            <if test="zjzhmx != null">#{zjzhmx},</if>
            <if test="tsgj != null">#{tsgj},</if>
            <if test="zjzh != null">#{zjzh},</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>
    <insert id="batchLjZjzhfx">
        INSERT ALL
        <foreach item="item" index="index" collection="list">
            INTO lj_zjzhfx (jh, kc, zjzhmx, tsgj, zjzh)
            VALUES (#{item.jh}, #{item.kc}, #{item.zjzhmx}, #{item.tsgj}, #{item.zjzh})
        </foreach>
        SELECT 1 FROM DUAL
    </insert>

    <update id="updateLjZjzhfx" parameterType="LjZjzhfx">
        update lj_zjzhfx
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="zjzhmx != null">zjzhmx = #{zjzhmx},</if>
            <if test="tsgj != null">tsgj = #{tsgj},</if>
            <if test="zjzh != null">zjzh = #{zjzh},</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="deleteLjZjzhfxById" parameterType="Long">
        delete from lj_zjzhfx where id = #{id}
    </delete>

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