<?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.system.mapper.ZhxyShyjMapper">
    
    <resultMap type="ZhxyShyj" id="ZhxyShyjResult">
        <result property="id"    column="id"    />
        <result property="dataId"    column="data_id"    />
        <result property="type"    column="type"    />
        <result property="auditId"    column="audit_id"    />
        <result property="auditUser"    column="audit_user"    />
        <result property="shjg"    column="shjg"    />
        <result property="shyj"    column="shyj"    />
        <result property="shsj"    column="shsj"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectZhxyShyjVo">
        select id, data_id, type, audit_id, audit_user, shjg, shyj, shsj, create_by, create_time, update_by, update_time, remark from zhxy_shyj
    </sql>

    <select id="selectZhxyShyjList" parameterType="ZhxyShyj" resultMap="ZhxyShyjResult">
        <include refid="selectZhxyShyjVo"/>
        <where>  
            <if test="dataId != null "> and data_id = #{dataId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="auditId != null "> and audit_id = #{auditId}</if>
            <if test="auditUser != null  and auditUser != ''"> and audit_user = #{auditUser}</if>
            <if test="shjg != null  and shjg != ''"> and shjg = #{shjg}</if>
            <if test="shyj != null  and shyj != ''"> and shyj = #{shyj}</if>
            <if test="shsj != null "> and shsj = #{shsj}</if>
        </where>
    </select>
    
    <select id="selectZhxyShyjById" parameterType="Long" resultMap="ZhxyShyjResult">
        <include refid="selectZhxyShyjVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertZhxyShyj" parameterType="ZhxyShyj" useGeneratedKeys="true" keyProperty="id">
        insert into zhxy_shyj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dataId != null">data_id,</if>
            <if test="type != null">type,</if>
            <if test="auditId != null">audit_id,</if>
            <if test="auditUser != null ">audit_user,</if>
            <if test="shjg != null and shjg != ''">shjg,</if>
            <if test="shyj != null">shyj,</if>
            <if test="shsj != null">shsj,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dataId != null">#{dataId},</if>
            <if test="type != null">#{type},</if>
            <if test="auditId != null">#{auditId},</if>
            <if test="auditUser != null">#{auditUser},</if>
            <if test="shjg != null and shjg != ''">#{shjg},</if>
            <if test="shyj != null">#{shyj},</if>
            <if test="shsj != null">#{shsj},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateZhxyShyj" parameterType="ZhxyShyj">
        update zhxy_shyj
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataId != null">data_id = #{dataId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="auditId != null">audit_id = #{auditId},</if>
            <if test="auditUser != null and auditUser != ''">audit_user = #{auditUser},</if>
            <if test="shjg != null and shjg != ''">shjg = #{shjg},</if>
            <if test="shyj != null">shyj = #{shyj},</if>
            <if test="shsj != null">shsj = #{shsj},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteZhxyShyjById" parameterType="Long">
        delete from zhxy_shyj where id = #{id}
    </delete>

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