<?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.huijy.management.mapper.AboutUsMapper">
    
    <resultMap type="AboutUs" id="AboutUsResult">
        <result property="aboutUsId"    column="about_us_id"    />
        <result property="title"    column="title"    />
        <result property="helpPhone"    column="help_phone"    />
        <result property="showPictures"    column="show_pictures"    />
        <result property="briefText1"    column="brief_text1"    />
        <result property="briefText2"    column="brief_text2"    />
        <result property="briefText3"    column="brief_text3"    />
        <result property="briefText4"    column="brief_text4"    />
        <result property="content"    column="content"    />
        <result property="bgImg1"    column="bg_img1"    />
        <result property="bgImg2"    column="bg_img2"    />
        <result property="bgImg3"    column="bg_img3"    />
        <result property="bgImg4"    column="bg_img4"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectAboutUsVo">
        select about_us_id, title, help_phone, show_pictures, brief_text1, brief_text2, brief_text3, brief_text4, content, bg_img1, bg_img2, bg_img3, bg_img4, create_time from t_about_us
    </sql>

    <select id="selectAboutUsList" parameterType="AboutUs" resultMap="AboutUsResult">
        <include refid="selectAboutUsVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectAboutUsByAboutUsId" parameterType="Long" resultMap="AboutUsResult">
        <include refid="selectAboutUsVo"/>
        where about_us_id = #{aboutUsId}
    </select>
        
    <insert id="insertAboutUs" parameterType="AboutUs">
        insert into t_about_us
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="aboutUsId != null">about_us_id,</if>
            <if test="title != null">title,</if>
            <if test="helpPhone != null">help_phone,</if>
            <if test="showPictures != null">show_pictures,</if>
            <if test="briefText1 != null">brief_text1,</if>
            <if test="briefText2 != null">brief_text2,</if>
            <if test="briefText3 != null">brief_text3,</if>
            <if test="briefText4 != null">brief_text4,</if>
            <if test="content != null">content,</if>
            <if test="bgImg1 != null">bg_img1,</if>
            <if test="bgImg2 != null">bg_img2,</if>
            <if test="bgImg3 != null">bg_img3,</if>
            <if test="bgImg4 != null">bg_img4,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="aboutUsId != null">#{aboutUsId},</if>
            <if test="title != null">#{title},</if>
            <if test="helpPhone != null">#{helpPhone},</if>
            <if test="showPictures != null">#{showPictures},</if>
            <if test="briefText1 != null">#{briefText1},</if>
            <if test="briefText2 != null">#{briefText2},</if>
            <if test="briefText3 != null">#{briefText3},</if>
            <if test="briefText4 != null">#{briefText4},</if>
            <if test="content != null">#{content},</if>
            <if test="bgImg1 != null">#{bgImg1},</if>
            <if test="bgImg2 != null">#{bgImg2},</if>
            <if test="bgImg3 != null">#{bgImg3},</if>
            <if test="bgImg4 != null">#{bgImg4},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateAboutUs" parameterType="AboutUs">
        update t_about_us
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null">title = #{title},</if>
            <if test="helpPhone != null">help_phone = #{helpPhone},</if>
            <if test="showPictures != null">show_pictures = #{showPictures},</if>
            <if test="briefText1 != null">brief_text1 = #{briefText1},</if>
            <if test="briefText2 != null">brief_text2 = #{briefText2},</if>
            <if test="briefText3 != null">brief_text3 = #{briefText3},</if>
            <if test="briefText4 != null">brief_text4 = #{briefText4},</if>
            <if test="content != null">content = #{content},</if>
            <if test="bgImg1 != null">bg_img1 = #{bgImg1},</if>
            <if test="bgImg2 != null">bg_img2 = #{bgImg2},</if>
            <if test="bgImg3 != null">bg_img3 = #{bgImg3},</if>
            <if test="bgImg4 != null">bg_img4 = #{bgImg4},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where about_us_id = #{aboutUsId}
    </update>

    <delete id="deleteAboutUsByAboutUsId" parameterType="Long">
        delete from t_about_us where about_us_id = #{aboutUsId}
    </delete>

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