<?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.cirs.biz.mapper.TPageViewTimeMapper">
    
    <resultMap type="TPageViewTime" id="TPageViewTimeResult">
        <result property="id"    column="id"    />
        <result property="componentId"    column="component_id"    />
        <result property="viewTime"    column="view_time"    />
        <result property="useScene"    column="use_scene"    />
        <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"    />
        <result property="searchCondition"    column="search_condition"    />
    </resultMap>

    <sql id="selectTPageViewTimeVo">
        select id, component_id, view_time, use_scene, create_by, create_time, update_by, update_time, remark,search_condition from t_page_view_time
    </sql>

    <select id="selectTPageViewTimeList" parameterType="TPageViewTime" resultMap="TPageViewTimeResult">
        <include refid="selectTPageViewTimeVo"/>
        <where>  
            <if test="componentId != null  and componentId != ''"> and component_id = #{componentId}</if>
            <if test="viewTime != null "> and view_time = #{viewTime}</if>
            <if test="useScene != null  and useScene != ''"> and use_scene = #{useScene}</if>
            <if test="searchCondition != null  and searchCondition != ''"> and search_condition = #{searchCondition}</if>
        </where>
    </select>
    
    <select id="selectTPageViewTimeById" parameterType="Long" resultMap="TPageViewTimeResult">
        <include refid="selectTPageViewTimeVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTPageViewTime" parameterType="TPageViewTime" useGeneratedKeys="true" keyProperty="id">
        insert into t_page_view_time
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="componentId != null">component_id,</if>
            <if test="viewTime != null">view_time,</if>
            <if test="useScene != null">use_scene,</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>
            <if test="searchCondition != null">search_condition,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="componentId != null">#{componentId},</if>
            <if test="viewTime != null">#{viewTime},</if>
            <if test="useScene != null">#{useScene},</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>
            <if test="searchCondition != null">#{searchCondition},</if>
         </trim>
    </insert>

    <update id="updateTPageViewTime" parameterType="TPageViewTime">
        update t_page_view_time
        <trim prefix="SET" suffixOverrides=",">
            <if test="componentId != null">component_id = #{componentId},</if>
            <if test="viewTime != null">view_time = #{viewTime},</if>
            <if test="useScene != null">use_scene = #{useScene},</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>
            <if test="searchCondition != null">search_condition = #{searchCondition},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTPageViewTimeById" parameterType="Long">
        delete from t_page_view_time where id = #{id}
    </delete>

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