<?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.SjJhzqMapper">
    
    <resultMap type="SjJhzq" id="SjJhzqResult">
        <result property="id"    column="id"    />
        <result property="jh"    column="jh"    />
        <result property="sghj"    column="sghj"    />
        <result property="qsjs"    column="qsjs"    />
        <result property="jsjs"    column="jsjs"    />
        <result property="jhzq"    column="jhzq"    />
        <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="selectSjJhzqVo">
        select id, jh, sghj, qsjs, jsjs, jhzq, created_by, created_time, update_by, update_time from sj_jhzq
    </sql>

    <select id="selectSjJhzqList" parameterType="SjJhzq" resultMap="SjJhzqResult">
        <include refid="selectSjJhzqVo"/>
        <where>  
            <if test="jh != null  and jh != ''"> and jh = #{jh}</if>
            <if test="sghj != null  and sghj != ''"> and sghj = #{sghj}</if>
            <if test="qsjs != null "> and qsjs = #{qsjs}</if>
            <if test="jsjs != null "> and jsjs = #{jsjs}</if>
            <if test="jhzq != null "> and jhzq = #{jhzq}</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="selectSjJhzqById" parameterType="Long" resultMap="SjJhzqResult">
        <include refid="selectSjJhzqVo"/>
        where id = #{id}
    </select>

    <insert id="insertSjJhzq" parameterType="SjJhzq" useGeneratedKeys="true" keyProperty="id">
        insert into sj_jhzq
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="jh != null">jh,</if>
            <if test="sghj != null">sghj,</if>
            <if test="qsjs != null">qsjs,</if>
            <if test="jsjs != null">jsjs,</if>
            <if test="jhzq != null">jhzq,</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="sghj != null">#{sghj},</if>
            <if test="qsjs != null">#{qsjs},</if>
            <if test="jsjs != null">#{jsjs},</if>
            <if test="jhzq != null">#{jhzq},</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="updateSjJhzq" parameterType="SjJhzq">
        update sj_jhzq
        <trim prefix="SET" suffixOverrides=",">
            <if test="jh != null">jh = #{jh},</if>
            <if test="sghj != null">sghj = #{sghj},</if>
            <if test="qsjs != null">qsjs = #{qsjs},</if>
            <if test="jsjs != null">jsjs = #{jsjs},</if>
            <if test="jhzq != null">jhzq = #{jhzq},</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="deleteSjJhzqById" parameterType="Long">
        delete from sj_jhzq where id = #{id}
    </delete>

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