<?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.zongzhi.mapper.TcDtSxMapper">
    
    <resultMap type="TcDtSx" id="TcDtSxResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="jcxxCount"    column="jcxx_count"    />
        <result property="pcxxCount"    column="pcxx_count"    />
        <result property="yqyjCount"    column="yqyj_count"    />
        <result property="yqyjZb"    column="yqyj_zb"    />
        <result property="isStatus"    column="is_status"    />
    </resultMap>

    <sql id="selectTcDtSxVo">
        select id, area_id, is_status,jcxx_count, pcxx_count, yqyj_count, yqyj_zb from tc_dt_sx
    </sql>

    <select id="selectTcDtSxList" parameterType="TcDtSx" resultMap="TcDtSxResult">
        <include refid="selectTcDtSxVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="jcxxCount != null "> and jcxx_count = #{jcxxCount}</if>
            <if test="pcxxCount != null "> and pcxx_count = #{pcxxCount}</if>
            <if test="yqyjCount != null "> and yqyj_count = #{yqyjCount}</if>
            <if test="yqyjZb != null "> and yqyj_zb = #{yqyjZb}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
        </where>
    </select>
    
    <select id="selectTcDtSxById" parameterType="Long" resultMap="TcDtSxResult">
        <include refid="selectTcDtSxVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcDtSx" parameterType="TcDtSx">
        insert into tc_dt_sx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="areaId != null">area_id,</if>
            <if test="jcxxCount != null">jcxx_count,</if>
            <if test="pcxxCount != null">pcxx_count,</if>
            <if test="yqyjCount != null">yqyj_count,</if>
            <if test="yqyjZb != null">yqyj_zb,</if>
            <if test="isStatus != null">is_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="areaId != null">#{areaId},</if>
            <if test="jcxxCount != null">#{jcxxCount},</if>
            <if test="pcxxCount != null">#{pcxxCount},</if>
            <if test="yqyjCount != null">#{yqyjCount},</if>
            <if test="yqyjZb != null">#{yqyjZb},</if>
            <if test="isStatus != null">#{isStatus},</if>
         </trim>
    </insert>

    <update id="updateTcDtSx" parameterType="TcDtSx">
        update tc_dt_sx
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="jcxxCount != null">jcxx_count = #{jcxxCount},</if>
            <if test="pcxxCount != null">pcxx_count = #{pcxxCount},</if>
            <if test="yqyjCount != null">yqyj_count = #{yqyjCount},</if>
            <if test="yqyjZb != null">yqyj_zb = #{yqyjZb},</if>
            <if test="isStatus != null">is_status=#{isStatus},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcDtSxById" parameterType="Long">
        delete from tc_dt_sx where id = #{id}
    </delete>

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