<?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.SjZjyCljlMapper">
    
    <resultMap type="SjZjyCljl" id="SjZjyCljlResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="clmc"    column="clmc"    />
        <result property="ykjl"    column="ykjl"    />
        <result property="ekjl"    column="ekjl"    />
        <result property="skjl"    column="skjl"    />
        <result property="sikjl"    column="sikjl"    />
        <result property="wkjl"    column="wkjl"    />
        <result property="bz"    column="bz"    />
        <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="selectSjZjyCljlVo">
        select id, jh, clmc, ykjl, ekjl, skjl, sikjl, wkjl, bz, created_by, created_time, update_by, update_time from sj_zjy_cljl
    </sql>

    <select id="selectSjZjyCljlList" parameterType="SjZjyCljl" resultMap="SjZjyCljlResult">
        <include refid="selectSjZjyCljlVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="clmc != null  and clmc != ''"> and clmc = #{clmc}</if>
            <if test="ykjl != null  and ykjl != ''"> and ykjl = #{ykjl}</if>
            <if test="ekjl != null  and ekjl != ''"> and ekjl = #{ekjl}</if>
            <if test="skjl != null  and skjl != ''"> and skjl = #{skjl}</if>
            <if test="sikjl != null  and sikjl != ''"> and sikjl = #{sikjl}</if>
            <if test="wkjl != null  and wkjl != ''"> and wkjl = #{wkjl}</if>
            <if test="bz != null  and bz != ''"> and bz = #{bz}</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="selectSjZjyCljlById" parameterType="Long" resultMap="SjZjyCljlResult">
        <include refid="selectSjZjyCljlVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjZjyCljl" parameterType="SjZjyCljl" useGeneratedKeys="true" keyProperty="id">
        insert into sj_zjy_cljl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="clmc != null">clmc,</if>
            <if test="ykjl != null">ykjl,</if>
            <if test="ekjl != null">ekjl,</if>
            <if test="skjl != null">skjl,</if>
            <if test="sikjl != null">sikjl,</if>
            <if test="wkjl != null">wkjl,</if>
            <if test="bz != null">bz,</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="clmc != null">#{clmc},</if>
            <if test="ykjl != null">#{ykjl},</if>
            <if test="ekjl != null">#{ekjl},</if>
            <if test="skjl != null">#{skjl},</if>
            <if test="sikjl != null">#{sikjl},</if>
            <if test="wkjl != null">#{wkjl},</if>
            <if test="bz != null">#{bz},</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="insertSjZjyCljlBatch">
        INSERT INTO sj_zjy_cljl
        (jh, clmc, ykjl, ekjl, skjl, sikjl, wkjl, bz)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.jh},
            #{item.clmc},
            #{item.ykjl},
            #{item.ekjl},
            #{item.skjl},
            #{item.sikjl},
            #{item.wkjl},
            #{item.bz}
            )
        </foreach>
    </insert>

    <update id="updateSjZjyCljl" parameterType="SjZjyCljl">
        update sj_zjy_cljl
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="clmc != null">clmc = #{clmc},</if>
            <if test="ykjl != null">ykjl = #{ykjl},</if>
            <if test="ekjl != null">ekjl = #{ekjl},</if>
            <if test="skjl != null">skjl = #{skjl},</if>
            <if test="sikjl != null">sikjl = #{sikjl},</if>
            <if test="wkjl != null">wkjl = #{wkjl},</if>
            <if test="bz != null">bz = #{bz},</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="deleteSjZjyCljlById" parameterType="Long">
        delete from sj_zjy_cljl where id = #{id}
    </delete>

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