<?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.zjsgfa.mapper.SjLjjwMapper">
    
    <resultMap type="SjLjjw" id="SjLjjwResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="ljjh"    column="ljjh"    />
        <result property="jx"    column="jx"    />
        <result property="wjjs"    column="wjjs"    />
        <result property="wjczjs"    column="wjczjs"    />
        <result property="wzcw"    column="wzcw"    />
        <result property="kc"    column="kc"    />
        <result property="zjzq"    column="zjzq"    />
        <result property="wjzq"    column="wjzq"    />
        <result property="jkjl"    column="jkjl"    />
        <result property="jdjl"    column="jdjl"    />
        <result property="jkhzb"    column="jkhzb"    />
        <result property="jkzzb"    column="jkzzb"    />
        <result property="jkhjl"    column="jkhjl"    />
        <result property="jkzjl"    column="jkzjl"    />
        <result property="jdhzb"    column="jdhzb"    />
        <result property="jdzzb"    column="jdzzb"    />
        <result property="jdhjl"    column="jdhjl"    />
        <result property="jdzjl"    column="jdzjl"    />
    </resultMap>

    <sql id="selectSjLjjwVo">
        select id, jh, ljjh, jx, wjjs, wjczjs, wzcw, kc, zjzq, wjzq, jkjl, jdjl, jkhzb, jkzzb, jkhjl, jkzjl, jdhzb, jdzzb, jdhjl, jdzjl from sj_ljjw
    </sql>

    <select id="selectSjLjjwList" parameterType="SjLjjw" resultMap="SjLjjwResult">
        <include refid="selectSjLjjwVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="ljjh != null  and ljjh != ''"> and ljjh = #{ljjh}</if>
            <if test="jx != null  and jx != ''"> and jx = #{jx}</if>
            <if test="wjjs != null "> and wjjs = #{wjjs}</if>
            <if test="wjczjs != null "> and wjczjs = #{wjczjs}</if>
            <if test="wzcw != null  and wzcw != ''"> and wzcw = #{wzcw}</if>
            <if test="kc != null  and kc != ''"> and kc = #{kc}</if>
            <if test="zjzq != null "> and zjzq = #{zjzq}</if>
            <if test="wjzq != null "> and wjzq = #{wjzq}</if>
            <if test="jkjl != null "> and jkjl = #{jkjl}</if>
            <if test="jdjl != null "> and jdjl = #{jdjl}</if>
            <if test="jkhzb != null "> and jkhzb = #{jkhzb}</if>
            <if test="jkzzb != null "> and jkzzb = #{jkzzb}</if>
            <if test="jkhjl != null "> and jkhjl = #{jkhjl}</if>
            <if test="jkzjl != null "> and jkzjl = #{jkzjl}</if>
            <if test="jdhzb != null "> and jdhzb = #{jdhzb}</if>
            <if test="jdzzb != null "> and jdzzb = #{jdzzb}</if>
            <if test="jdhjl != null "> and jdhjl = #{jdhjl}</if>
            <if test="jdzjl != null "> and jdzjl = #{jdzjl}</if>
        </where>
    </select>
    
    <select id="selectSjLjjwById" parameterType="Long" resultMap="SjLjjwResult">
        <include refid="selectSjLjjwVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjLjjw" parameterType="SjLjjw" useGeneratedKeys="true" keyProperty="id">
        insert into sj_ljjw
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="ljjh != null">ljjh,</if>
            <if test="jx != null">jx,</if>
            <if test="wjjs != null">wjjs,</if>
            <if test="wjczjs != null">wjczjs,</if>
            <if test="wzcw != null">wzcw,</if>
            <if test="kc != null">kc,</if>
            <if test="zjzq != null">zjzq,</if>
            <if test="wjzq != null">wjzq,</if>
            <if test="jkjl != null">jkjl,</if>
            <if test="jdjl != null">jdjl,</if>
            <if test="jkhzb != null">jkhzb,</if>
            <if test="jkzzb != null">jkzzb,</if>
            <if test="jkhjl != null">jkhjl,</if>
            <if test="jkzjl != null">jkzjl,</if>
            <if test="jdhzb != null">jdhzb,</if>
            <if test="jdzzb != null">jdzzb,</if>
            <if test="jdhjl != null">jdhjl,</if>
            <if test="jdzjl != null">jdzjl,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="jh != null">#{jh},</if>
            <if test="ljjh != null">#{ljjh},</if>
            <if test="jx != null">#{jx},</if>
            <if test="wjjs != null">#{wjjs},</if>
            <if test="wjczjs != null">#{wjczjs},</if>
            <if test="wzcw != null">#{wzcw},</if>
            <if test="kc != null">#{kc},</if>
            <if test="zjzq != null">#{zjzq},</if>
            <if test="wjzq != null">#{wjzq},</if>
            <if test="jkjl != null">#{jkjl},</if>
            <if test="jdjl != null">#{jdjl},</if>
            <if test="jkhzb != null">#{jkhzb},</if>
            <if test="jkzzb != null">#{jkzzb},</if>
            <if test="jkhjl != null">#{jkhjl},</if>
            <if test="jkzjl != null">#{jkzjl},</if>
            <if test="jdhzb != null">#{jdhzb},</if>
            <if test="jdzzb != null">#{jdzzb},</if>
            <if test="jdhjl != null">#{jdhjl},</if>
            <if test="jdzjl != null">#{jdzjl},</if>
         </trim>
    </insert>
    <insert id="insertSjLjjwBatch">

        INSERT INTO sj_ljjw
        (
        jh, ljjh, jx, wjjs, wjczjs, wzcw, kc, zjzq, wjzq,
        jkjl, jdjl, jkhzb, jkzzb, jkhjl, jkzjl,
        jdhzb, jdzzb, jdhjl, jdzjl
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.ljjh},
            #{item.jx},
            #{item.wjjs},
            #{item.wjczjs},
            #{item.wzcw},
            #{item.kc},
            #{item.zjzq},
            #{item.wjzq},
            #{item.jkjl},
            #{item.jdjl},
            #{item.jkhzb},
            #{item.jkzzb},
            #{item.jkhjl},
            #{item.jkzjl},
            #{item.jdhzb},
            #{item.jdzzb},
            #{item.jdhjl},
            #{item.jdzjl}
            )
        </foreach>
    </insert>

    <update id="updateSjLjjw" parameterType="SjLjjw">
        update sj_ljjw
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="ljjh != null">ljjh = #{ljjh},</if>
            <if test="jx != null">jx = #{jx},</if>
            <if test="wjjs != null">wjjs = #{wjjs},</if>
            <if test="wjczjs != null">wjczjs = #{wjczjs},</if>
            <if test="wzcw != null">wzcw = #{wzcw},</if>
            <if test="kc != null">kc = #{kc},</if>
            <if test="zjzq != null">zjzq = #{zjzq},</if>
            <if test="wjzq != null">wjzq = #{wjzq},</if>
            <if test="jkjl != null">jkjl = #{jkjl},</if>
            <if test="jdjl != null">jdjl = #{jdjl},</if>
            <if test="jkhzb != null">jkhzb = #{jkhzb},</if>
            <if test="jkzzb != null">jkzzb = #{jkzzb},</if>
            <if test="jkhjl != null">jkhjl = #{jkhjl},</if>
            <if test="jkzjl != null">jkzjl = #{jkzjl},</if>
            <if test="jdhzb != null">jdhzb = #{jdhzb},</if>
            <if test="jdzzb != null">jdzzb = #{jdzzb},</if>
            <if test="jdhjl != null">jdhjl = #{jdhjl},</if>
            <if test="jdzjl != null">jdzjl = #{jdzjl},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSjLjjwById" parameterType="Long">
        delete from sj_ljjw where id = #{id}
    </delete>

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