<?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.SysAboutStsMapper">
    <resultMap type="SysAboutSts" id="SysAboutStsResult">
        <id property="id" column="id" />
        <result property="title" column="title" />
        <result property="content" column="content" />
        <result property="sortOrder" column="sort_order" />
        <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="selectSysAboutStsVo">
        select id, title, content, sort_order, create_by, create_time, update_by, update_time, remark
        from sys_about_sts
    </sql>

    <select id="selectSysAboutStsById" parameterType="Long" resultMap="SysAboutStsResult">
        <include refid="selectSysAboutStsVo" />
        where id = #{id}
    </select>

    <select id="selectSysAboutStsList" resultMap="SysAboutStsResult">
        <include refid="selectSysAboutStsVo" />
        order by sort_order asc, create_time desc
    </select>

    <insert id="insertSysAboutSts" parameterType="SysAboutSts" useGeneratedKeys="true" keyProperty="id">
        insert into sys_about_sts
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="title != null and title != ''">title,</if>
            <if test="content != null">content,</if>
            <if test="sortOrder != null">sort_order,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="title != null and title != ''">#{title},</if>
            <if test="content != null">#{content},</if>
            <if test="sortOrder != null">#{sortOrder},</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>
         </trim>
    </insert>

    <update id="updateSysAboutSts" parameterType="SysAboutSts">
        update sys_about_sts
        <trim prefix="set" suffixOverrides=",">
            <if test="title != null and title != ''">title = #{title},</if>
            <if test="content != null">content = #{content},</if>
            <if test="sortOrder != null">sort_order = #{sortOrder},</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="deleteSysAboutStsById" parameterType="Long">
        delete from sys_about_sts where id = #{id}
    </delete>

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