<?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.ZsyzJzqkMapper">
    
    <resultMap type="ZsyzJzqk" id="ZsyzJzqkResult">
        <result property="id"    column="id"    />
        <result property="xmId"    column="xm_id"    />
        <result property="xmbh"    column="xmbh"    />
        <result property="xmmc"    column="xmmc"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="qtrName"    column="qtr_name"    />
        <result property="qtTime"    column="qt_time"    />
        <result property="qtrxz"    column="qtrxz"    />
        <result property="qtrdwzw"    column="qtrdwzw"    />
        <result property="phone"    column="phone"    />
        <result property="blsx"    column="blsx"    />
        <result property="dbsx"    column="dbsx"    />
        <result property="jzqk"    column="jzqk"    />
        <result property="czwt"    column="czwt"    />
        <result property="jjjy"    column="jjjy"    />
        <result property="gzjh"    column="gzjh"    />
        <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="selectZsyzJzqkVo">
        select id, xm_id, xmbh, xmmc, dept_id, dept_name, qtr_name, qt_time, qtrxz, qtrdwzw, phone, blsx, dbsx, jzqk, czwt, jjjy, gzjh, create_by, create_time, update_by, update_time, remark from zsyz_jzqk
    </sql>

    <select id="selectZsyzJzqkList" parameterType="ZsyzJzqk" resultMap="ZsyzJzqkResult">
        <include refid="selectZsyzJzqkVo"/>
        <where>  
            <if test="xmId != null "> and xm_id = #{xmId}</if>
            <if test="xmbh != null  and xmbh != ''"> and xmbh = #{xmbh}</if>
            <if test="xmmc != null  and xmmc != ''"> and xmmc = #{xmmc}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
            <if test="qtrName != null  and qtrName != ''"> and qtr_name like concat('%', #{qtrName}, '%')</if>
            <if test="qtTime != null "> and qt_time = #{qtTime}</if>
            <if test="qtrxz != null  and qtrxz != ''"> and qtrxz = #{qtrxz}</if>
            <if test="qtrdwzw != null  and qtrdwzw != ''"> and qtrdwzw = #{qtrdwzw}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="blsx != null  and blsx != ''"> and blsx = #{blsx}</if>
            <if test="dbsx != null  and dbsx != ''"> and dbsx = #{dbsx}</if>
            <if test="jzqk != null  and jzqk != ''"> and jzqk = #{jzqk}</if>
            <if test="czwt != null  and czwt != ''"> and czwt = #{czwt}</if>
            <if test="jjjy != null  and jjjy != ''"> and jjjy = #{jjjy}</if>
            <if test="gzjh != null  and gzjh != ''"> and gzjh = #{gzjh}</if>
        </where>
    </select>
    
    <select id="selectZsyzJzqkById" parameterType="Long" resultMap="ZsyzJzqkResult">
        <include refid="selectZsyzJzqkVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertZsyzJzqk" parameterType="ZsyzJzqk" useGeneratedKeys="true" keyProperty="id">
        insert into zsyz_jzqk
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="xmId != null">xm_id,</if>
            <if test="xmbh != null">xmbh,</if>
            <if test="xmmc != null and xmmc != ''">xmmc,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null and deptName != ''">dept_name,</if>
            <if test="qtrName != null and qtrName != ''">qtr_name,</if>
            <if test="qtTime != null">qt_time,</if>
            <if test="qtrxz != null">qtrxz,</if>
            <if test="qtrdwzw != null">qtrdwzw,</if>
            <if test="phone != null">phone,</if>
            <if test="blsx != null">blsx,</if>
            <if test="dbsx != null">dbsx,</if>
            <if test="jzqk != null">jzqk,</if>
            <if test="czwt != null">czwt,</if>
            <if test="jjjy != null">jjjy,</if>
            <if test="gzjh != null">gzjh,</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="xmId != null">#{xmId},</if>
            <if test="xmbh != null">#{xmbh},</if>
            <if test="xmmc != null and xmmc != ''">#{xmmc},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null and deptName != ''">#{deptName},</if>
            <if test="qtrName != null and qtrName != ''">#{qtrName},</if>
            <if test="qtTime != null">#{qtTime},</if>
            <if test="qtrxz != null">#{qtrxz},</if>
            <if test="qtrdwzw != null">#{qtrdwzw},</if>
            <if test="phone != null">#{phone},</if>
            <if test="blsx != null">#{blsx},</if>
            <if test="dbsx != null">#{dbsx},</if>
            <if test="jzqk != null">#{jzqk},</if>
            <if test="czwt != null">#{czwt},</if>
            <if test="jjjy != null">#{jjjy},</if>
            <if test="gzjh != null">#{gzjh},</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="updateZsyzJzqk" parameterType="ZsyzJzqk">
        update zsyz_jzqk
        <trim prefix="SET" suffixOverrides=",">
            <if test="xmId != null">xm_id = #{xmId},</if>
            <if test="xmbh != null">xmbh = #{xmbh},</if>
            <if test="xmmc != null and xmmc != ''">xmmc = #{xmmc},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
            <if test="qtrName != null and qtrName != ''">qtr_name = #{qtrName},</if>
            <if test="qtTime != null">qt_time = #{qtTime},</if>
            <if test="qtrxz != null">qtrxz = #{qtrxz},</if>
            <if test="qtrdwzw != null">qtrdwzw = #{qtrdwzw},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="blsx != null">blsx = #{blsx},</if>
            <if test="dbsx != null">dbsx = #{dbsx},</if>
            <if test="jzqk != null">jzqk = #{jzqk},</if>
            <if test="czwt != null">czwt = #{czwt},</if>
            <if test="jjjy != null">jjjy = #{jjjy},</if>
            <if test="gzjh != null">gzjh = #{gzjh},</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="deleteZsyzJzqkById" parameterType="Long">
        delete from zsyz_jzqk where id = #{id}
    </delete>

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