<?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.system.mapper.OverviewMapper">
    
    <resultMap type="Overview" id="OverviewResult">
        <result property="overviewId"    column="overview_id"    />
        <result property="title"         column="title"          />
        <result property="summary"       column="summary"        />
        <result property="image"         column="image"          />
        <result property="video"         column="video"          />
        <result property="status"        column="status"         />
        <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"         />
    </resultMap>
    
    <sql id="selectOverviewVo">
        select overview_id, title, summary, image, video, status, create_by, create_time, update_by, update_time, remark 
		from overview
    </sql>
    
    <select id="selectOverviewById" parameterType="Long" resultMap="OverviewResult">
        <include refid="selectOverviewVo"/>
        where overview_id = #{overviewId}
    </select>
    
    <select id="selectOverviewOne" resultMap="OverviewResult">
        <include refid="selectOverviewVo"/>
        limit 1
    </select>
    
    <insert id="insertOverview" parameterType="Overview">
        insert into overview (
			<if test="title != null and title != '' ">title, </if>
			<if test="summary != null and summary != '' ">summary, </if>
			<if test="image != null and image != '' ">image, </if>
			<if test="video != null and video != '' ">video, </if>
			<if test="status != null and status != '' ">status, </if>
			<if test="remark != null and remark != ''">remark,</if>
 			<if test="createBy != null and createBy != ''">create_by,</if>
 			create_time
 		)values(
			<if test="title != null and title != ''">#{title}, </if>
			<if test="summary != null and summary != ''">#{summary}, </if>
			<if test="image != null and image != ''">#{image}, </if>
			<if test="video != null and video != ''">#{video}, </if>
			<if test="status != null and status != ''">#{status}, </if>
			<if test="remark != null and remark != ''">#{remark},</if>
 			<if test="createBy != null and createBy != ''">#{createBy},</if>
 			sysdate()
		)
    </insert>
	 
    <update id="updateOverview" parameterType="Overview">
        update overview 
        <set>
            <if test="title != null and title != ''">title = #{title}, </if>
            <if test="summary != null">summary = #{summary}, </if>
            <if test="image != null">image = #{image}, </if>
            <if test="video != null">video = #{video}, </if>
            <if test="status != null and status != ''">status = #{status}, </if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
 			update_time = sysdate()
        </set>
        where overview_id = #{overviewId}
    </update>
	
    <delete id="deleteOverviewById" parameterType="Long">
        delete from overview where overview_id = #{overviewId}
    </delete>
    
</mapper>
