<?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.TcQinglangZhuanxiangMapper">
    
    <resultMap type="TcQinglangZhuanxiang" id="TcQinglangZhuanxiangResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="zhuanxiangTitle"    column="zhuanxiang_title"    />
        <result property="zhuanxiangTime"    column="zhuanxiang_time"    />
        <result property="zhuanxiangContent"    column="zhuanxiang_content"    />
        <result property="zhuanxiangImg"    column="zhuanxiang_img"    />
        <result property="zhuanxiangType"    column="zhuanxiang_type"    />
        <result property="createId"    column="create_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateId"    column="update_id"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTcQinglangZhuanxiangVo">
        select id, area_id, zhuanxiang_title, zhuanxiang_time, zhuanxiang_content, zhuanxiang_img, zhuanxiang_type, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_qinglang_zhuanxiang
    </sql>

    <select id="selectTcQinglangZhuanxiangList" parameterType="TcQinglangZhuanxiang" resultMap="TcQinglangZhuanxiangResult">
        <include refid="selectTcQinglangZhuanxiangVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="zhuanxiangTitle != null  and zhuanxiangTitle != ''"> and zhuanxiang_title = #{zhuanxiangTitle}</if>
            <if test="zhuanxiangTime != null "> and zhuanxiang_time = #{zhuanxiangTime}</if>
            <if test="zhuanxiangContent != null  and zhuanxiangContent != ''"> and zhuanxiang_content = #{zhuanxiangContent}</if>
            <if test="zhuanxiangImg != null  and zhuanxiangImg != ''"> and zhuanxiang_img = #{zhuanxiangImg}</if>
            <if test="zhuanxiangType != null "> and zhuanxiang_type = #{zhuanxiangType}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
        </where>
    </select>
    
    <select id="selectTcQinglangZhuanxiangById" parameterType="Long" resultMap="TcQinglangZhuanxiangResult">
        <include refid="selectTcQinglangZhuanxiangVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcQinglangZhuanxiang" parameterType="TcQinglangZhuanxiang" useGeneratedKeys="true" keyProperty="id">
        insert into tc_qinglang_zhuanxiang
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="zhuanxiangTitle != null">zhuanxiang_title,</if>
            <if test="zhuanxiangTime != null">zhuanxiang_time,</if>
            <if test="zhuanxiangContent != null">zhuanxiang_content,</if>
            <if test="zhuanxiangImg != null">zhuanxiang_img,</if>
            <if test="zhuanxiangType != null">zhuanxiang_type,</if>
            <if test="createId != null">create_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateId != null">update_id,</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="areaId != null">#{areaId},</if>
            <if test="zhuanxiangTitle != null">#{zhuanxiangTitle},</if>
            <if test="zhuanxiangTime != null">#{zhuanxiangTime},</if>
            <if test="zhuanxiangContent != null">#{zhuanxiangContent},</if>
            <if test="zhuanxiangImg != null">#{zhuanxiangImg},</if>
            <if test="zhuanxiangType != null">#{zhuanxiangType},</if>
            <if test="createId != null">#{createId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateId != null">#{updateId},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTcQinglangZhuanxiang" parameterType="TcQinglangZhuanxiang">
        update tc_qinglang_zhuanxiang
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="zhuanxiangTitle != null">zhuanxiang_title = #{zhuanxiangTitle},</if>
            <if test="zhuanxiangTime != null">zhuanxiang_time = #{zhuanxiangTime},</if>
            <if test="zhuanxiangContent != null">zhuanxiang_content = #{zhuanxiangContent},</if>
            <if test="zhuanxiangImg != null">zhuanxiang_img = #{zhuanxiangImg},</if>
            <if test="zhuanxiangType != null">zhuanxiang_type = #{zhuanxiangType},</if>
            <if test="createId != null">create_id = #{createId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateId != null">update_id = #{updateId},</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="deleteTcQinglangZhuanxiangById" parameterType="Long">
        delete from tc_qinglang_zhuanxiang where id = #{id}
    </delete>

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