<?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.SysHelpMapper">
    
    <resultMap type="SysHelp" id="SysHelpResult">
        <result property="id"    column="id"    />
        <result property="title"    column="title"    />
        <result property="content"    column="content"    />
    </resultMap>

    <sql id="selectSysHelpVo">
        select id, title, content from sys_help
    </sql>

    <select id="selectSysHelpList" parameterType="SysHelp" resultMap="SysHelpResult">
        <include refid="selectSysHelpVo"/>
        <where>  
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
        </where>
        order by id desc
    </select>
    
    <select id="selectSysHelpById" parameterType="Long" resultMap="SysHelpResult">
        <include refid="selectSysHelpVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSysHelp" parameterType="SysHelp" useGeneratedKeys="true" keyProperty="id">
        insert into sys_help
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="title != null">title,</if>
            <if test="content != null">content,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="title != null">#{title},</if>
            <if test="content != null">#{content},</if>
         </trim>
    </insert>

    <update id="updateSysHelp" parameterType="SysHelp">
        update sys_help
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null">title = #{title},</if>
            <if test="content != null">content = #{content},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysHelpById" parameterType="Long">
        delete from sys_help where id = #{id}
    </delete>

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