<?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.TcQlzxxdsjMapper">

    <resultMap type="TcQlzxxdsj" id="TcQlzxxdsjResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="type"    column="type"    />
        <result property="monthYear"    column="month_year"    />
        <result property="count"    column="count"    />
    </resultMap>

    <sql id="selectTcQlzxxdsjVo">
        select id, area_id, type, month_year, count from tc_qlzxxdsj
    </sql>

    <select id="selectTcQlzxxdsjList" parameterType="TcQlzxxdsj" resultMap="TcQlzxxdsjResult">
        <include refid="selectTcQlzxxdsjVo"/>
        <where>
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="monthYear != null "> and month_year = #{monthYear}</if>
            <if test="count != null "> and count = #{count}</if>
        </where>
    </select>

    <select id="selectTcQlzxxdsjById" parameterType="Long" resultMap="TcQlzxxdsjResult">
        <include refid="selectTcQlzxxdsjVo"/>
        where id = #{id}
    </select>

    <insert id="insertTcQlzxxdsj" parameterType="TcQlzxxdsj" useGeneratedKeys="true" keyProperty="id">
        insert into tc_qlzxxdsj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="type != null">type,</if>
            <if test="monthYear != null">month_year,</if>
            <if test="count != null">count,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="areaId != null">#{areaId},</if>
            <if test="type != null">#{type},</if>
            <if test="monthYear != null">#{monthYear},</if>
            <if test="count != null">#{count},</if>
         </trim>
    </insert>

    <update id="updateTcQlzxxdsj" parameterType="TcQlzxxdsj">
        update tc_qlzxxdsj
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="monthYear != null">month_year = #{monthYear},</if>
            <if test="count != null">count = #{count},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcQlzxxdsjById" parameterType="Long">
        delete from tc_qlzxxdsj where id = #{id}
    </delete>

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