<?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.projectV2.ZsyzSkxmMapper">

    <resultMap type="ZsyzSkxm" id="ZsyzSkxmResult">
        <result property="id" column="id"/>
        <result property="xmmc" column="xmmc"/>
        <result property="pzwh" column="pzwh"/>
        <result property="tzdw" column="tzdw"/>
        <result property="xmszd" column="xmszd"/>
        <result property="sscy" column="sscy"/>
        <result property="ztze" column="ztze"/>
        <result property="swzj" column="swzj"/>
        <result property="sjdz" column="sjdz"/>
        <result property="dydw" column="dydw"/>
        <result property="rkTime" column="rk_time"/>
        <result property="qytbTime" column="qytb_time"/>
        <result property="isHs" column="is_hs"/>
        <result property="jsjd" column="jsjd"/>
        <result property="isSh" column="is_sh"/>
        <result property="shName" column="sh_name"/>
        <result property="shTime" column="sh_time"/>
        <result property="shJy" column="sh_jy"/>
        <result property="deptId" column="dept_id"/>
        <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="selectZsyzSkxmVo">
        select id, xmmc, pzwh, tzdw, xmszd, sscy, ztze, swzj, sjdz, dydw, rk_time, qytb_time, is_hs, jsjd, is_sh, sh_name, sh_time, sh_jy,dept_id, create_by, create_time, update_by, update_time, remark from zsyz_skxm
    </sql>

    <select id="selectZsyzSkxmList" parameterType="ZsyzSkxm" resultMap="ZsyzSkxmResult">
        <include refid="selectZsyzSkxmVo"/>
        <where>
            <if test="xmmc != null  and xmmc != ''">and xmmc = #{xmmc}</if>
            <if test="pzwh != null  and pzwh != ''">and pzwh = #{pzwh}</if>
            <if test="tzdw != null  and tzdw != ''">and tzdw = #{tzdw}</if>
            <if test="xmszd != null  and xmszd != ''">and xmszd = #{xmszd}</if>
            <if test="sscy != null  and sscy != ''">and sscy = #{sscy}</if>
            <if test="ztze != null  and ztze != ''">and ztze = #{ztze}</if>
            <if test="swzj != null  and swzj != ''">and swzj = #{swzj}</if>
            <if test="sjdz != null  and sjdz != ''">and sjdz = #{sjdz}</if>
            <if test="dydw != null  and dydw != ''">and dydw = #{dydw}</if>
            <if test="rkTime != null ">and rk_time = #{rkTime}</if>
            <if test="qytbTime != null ">and qytb_time = #{qytbTime}</if>
            <if test="isHs != null  and isHs != ''">and is_hs = #{isHs}</if>
            <if test="jsjd != null  and jsjd != ''">and jsjd = #{jsjd}</if>
            <if test="isSh != null  and isSh != ''">and is_sh = #{isSh}</if>
            <if test="shName != null  and shName != ''">and sh_name like concat('%', #{shName}, '%')</if>
            <if test="shTime != null ">and sh_time = #{shTime}</if>
            <if test="shJy != null  and shJy != ''">and sh_jy = #{shJy}</if>
            <if test="deptId != null  and deptId != ''">and dept_id = #{deptId}</if>
        </where>
    </select>

    <select id="selectZsyzSkxmById" parameterType="Long" resultMap="ZsyzSkxmResult">
        <include refid="selectZsyzSkxmVo"/>
        where id = #{id}
    </select>

    <insert id="insertZsyzSkxm" parameterType="ZsyzSkxm" useGeneratedKeys="true" keyProperty="id">
        insert into zsyz_skxm
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="xmmc != null">xmmc,</if>
            <if test="pzwh != null">pzwh,</if>
            <if test="tzdw != null">tzdw,</if>
            <if test="xmszd != null">xmszd,</if>
            <if test="sscy != null">sscy,</if>
            <if test="ztze != null">ztze,</if>
            <if test="swzj != null">swzj,</if>
            <if test="sjdz != null and sjdz != ''">sjdz,</if>
            <if test="dydw != null and dydw != ''">dydw,</if>
            <if test="rkTime != null">rk_time,</if>
            <if test="qytbTime != null">qytb_time,</if>
            <if test="isHs != null and isHs != ''">is_hs,</if>
            <if test="jsjd != null">jsjd,</if>
            <if test="isSh != null">is_sh,</if>
            <if test="shName != null">sh_name,</if>
            <if test="shTime != null">sh_time,</if>
            <if test="shJy != null">sh_jy,</if>
            <if test="deptId != null">dept_id,</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="xmmc != null">#{xmmc},</if>
            <if test="pzwh != null">#{pzwh},</if>
            <if test="tzdw != null">#{tzdw},</if>
            <if test="xmszd != null">#{xmszd},</if>
            <if test="sscy != null">#{sscy},</if>
            <if test="ztze != null">#{ztze},</if>
            <if test="swzj != null">#{swzj},</if>
            <if test="sjdz != null and sjdz != ''">#{sjdz},</if>
            <if test="dydw != null and dydw != ''">#{dydw},</if>
            <if test="rkTime != null">#{rkTime},</if>
            <if test="qytbTime != null">#{qytbTime},</if>
            <if test="isHs != null and isHs != ''">#{isHs},</if>
            <if test="jsjd != null">#{jsjd},</if>
            <if test="isSh != null">#{isSh},</if>
            <if test="shName != null">#{shName},</if>
            <if test="shTime != null">#{shTime},</if>
            <if test="shJy != null">#{shJy},</if>
            <if test="deptId != null">#{deptId},</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="updateZsyzSkxm" parameterType="ZsyzSkxm">
        update zsyz_skxm
        <trim prefix="SET" suffixOverrides=",">
            <if test="xmmc != null">xmmc = #{xmmc},</if>
            <if test="pzwh != null">pzwh = #{pzwh},</if>
            <if test="tzdw != null">tzdw = #{tzdw},</if>
            <if test="xmszd != null">xmszd = #{xmszd},</if>
            <if test="sscy != null">sscy = #{sscy},</if>
            <if test="ztze != null">ztze = #{ztze},</if>
            <if test="swzj != null">swzj = #{swzj},</if>
            <if test="sjdz != null and sjdz != ''">sjdz = #{sjdz},</if>
            <if test="dydw != null and dydw != ''">dydw = #{dydw},</if>
            <if test="rkTime != null">rk_time = #{rkTime},</if>
            <if test="qytbTime != null">qytb_time = #{qytbTime},</if>
            <if test="isHs != null and isHs != ''">is_hs = #{isHs},</if>
            <if test="jsjd != null">jsjd = #{jsjd},</if>
            <if test="isSh != null">is_sh = #{isSh},</if>
            <if test="shName != null">sh_name = #{shName},</if>
            <if test="shTime != null">sh_time = #{shTime},</if>
            <if test="shJy != null">sh_jy = #{shJy},</if>
            <if test="deptId != null">dept_id = #{deptId},</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>
    <update id="updateZsyzSkxmSh" parameterType="ZsyzSkxm">
        update zsyz_skxm set is_sh = #{isSh} ,sh_time = sysdate()
        where id = #{id}
    </update>

    <delete id="deleteZsyzSkxmById" parameterType="Long">
        delete from zsyz_skxm where id = #{id}
    </delete>

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