<?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.ZsyzSkSwtzdwMapper">
    
    <resultMap type="ZsyzSkSwtzdw" id="ZsyzSkSwtzdwResult">
        <result property="id"    column="id"    />
        <result property="skId"    column="sk_id"    />
        <result property="dwmc"    column="dwmc"    />
        <result property="zczj"    column="zczj"    />
        <result property="tzje"    column="tzje"    />
        <result property="province"    column="province"    />
        <result property="provinceId"    column="province_id"    />
        <result property="city"    column="city"    />
        <result property="cityId"    column="city_id"    />
        <result property="dwjj"    column="dwjj"    />
        <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="selectZsyzSkSwtzdwVo">
        select id, sk_id, dwmc, zczj, tzje, province, province_id, city, city_id, dwjj, create_by, create_time, update_by, update_time, remark from zsyz_sk_swtzdw
    </sql>

    <select id="selectZsyzSkSwtzdwList" parameterType="ZsyzSkSwtzdw" resultMap="ZsyzSkSwtzdwResult">
        <include refid="selectZsyzSkSwtzdwVo"/>
        <where>  
            <if test="skId != null "> and sk_id = #{skId}</if>
            <if test="dwmc != null  and dwmc != ''"> and dwmc = #{dwmc}</if>
            <if test="zczj != null  and zczj != ''"> and zczj = #{zczj}</if>
            <if test="tzje != null  and tzje != ''"> and tzje = #{tzje}</if>
            <if test="province != null  and province != ''"> and province = #{province}</if>
            <if test="provinceId != null  and provinceId != ''"> and province_id = #{provinceId}</if>
            <if test="city != null  and city != ''"> and city = #{city}</if>
            <if test="cityId != null  and cityId != ''"> and city_id = #{cityId}</if>
            <if test="dwjj != null  and dwjj != ''"> and dwjj = #{dwjj}</if>
        </where>
        order by create_time DESC
    </select>
    
    <select id="selectZsyzSkSwtzdwById" parameterType="Long" resultMap="ZsyzSkSwtzdwResult">
        <include refid="selectZsyzSkSwtzdwVo"/>
        where id = #{id}
    </select>
    <select id="selectZsyzSkSwtzdwBySkId" parameterType="Long" resultMap="ZsyzSkSwtzdwResult">
        <include refid="selectZsyzSkSwtzdwVo"/>
        where sk_id = #{id}
    </select>

    <insert id="insertZsyzSkSwtzdw" parameterType="ZsyzSkSwtzdw" useGeneratedKeys="true" keyProperty="id">
        insert into zsyz_sk_swtzdw
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="skId != null">sk_id,</if>
            <if test="dwmc != null">dwmc,</if>
            <if test="zczj != null">zczj,</if>
            <if test="tzje != null">tzje,</if>
            <if test="province != null">province,</if>
            <if test="provinceId != null">province_id,</if>
            <if test="city != null">city,</if>
            <if test="cityId != null">city_id,</if>
            <if test="dwjj != null">dwjj,</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="skId != null">#{skId},</if>
            <if test="dwmc != null">#{dwmc},</if>
            <if test="zczj != null">#{zczj},</if>
            <if test="tzje != null">#{tzje},</if>
            <if test="province != null">#{province},</if>
            <if test="provinceId != null">#{provinceId},</if>
            <if test="city != null">#{city},</if>
            <if test="cityId != null">#{cityId},</if>
            <if test="dwjj != null">#{dwjj},</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="updateZsyzSkSwtzdw" parameterType="ZsyzSkSwtzdw">
        update zsyz_sk_swtzdw
        <trim prefix="SET" suffixOverrides=",">
            <if test="skId != null">sk_id = #{skId},</if>
            <if test="dwmc != null">dwmc = #{dwmc},</if>
            <if test="zczj != null">zczj = #{zczj},</if>
            <if test="tzje != null">tzje = #{tzje},</if>
            <if test="province != null">province = #{province},</if>
            <if test="provinceId != null">province_id = #{provinceId},</if>
            <if test="city != null">city = #{city},</if>
            <if test="cityId != null">city_id = #{cityId},</if>
            <if test="dwjj != null">dwjj = #{dwjj},</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="deleteZsyzSkSwtzdwById" parameterType="Long">
        delete from zsyz_sk_swtzdw where id = #{id}
    </delete>

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