<?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.TcYqZsMapper">
    
    <resultMap type="TcYqZs" id="TcYqZsResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="type"    column="type"    />
        <result property="dateTime"    column="date_time"    />
        <result property="count"    column="count"    />
        <result property="isStatus"    column="is_status"    />
    </resultMap>

    <sql id="selectTcYqZsVo">
        select id, area_id, type, is_status,date_time, count from tc_yq_zs
    </sql>

    <select id="selectTcYqZsList" parameterType="TcYqZs" resultMap="TcYqZsResult">
        <include refid="selectTcYqZsVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="dateTime != null "> and date_time = #{dateTime}</if>
            <if test="count != null "> and count = #{count}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
        </where>
    </select>
    
    <select id="selectTcYqZsById" parameterType="Long" resultMap="TcYqZsResult">
        <include refid="selectTcYqZsVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcYqZs" parameterType="TcYqZs" useGeneratedKeys="true" keyProperty="id">
        insert into tc_yq_zs
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="type != null">type,</if>
            <if test="dateTime != null">date_time,</if>
            <if test="count != null">count,</if>
            <if test="isStatus != null">is_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="areaId != null">#{areaId},</if>
            <if test="type != null">#{type},</if>
            <if test="dateTime != null">#{dateTime},</if>
            <if test="count != null">#{count},</if>
            <if test="isStatus != null">#{isStatus},</if>
         </trim>
    </insert>

    <update id="updateTcYqZs" parameterType="TcYqZs">
        update tc_yq_zs
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="dateTime != null">date_time = #{dateTime},</if>
            <if test="count != null">count = #{count},</if>
            <if test="isStatus != null">is_status=#{isStatus},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcYqZsById" parameterType="Long">
        delete from tc_yq_zs where id = #{id}
    </delete>

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