MonitorTemplateMapper.xml 6.7 KB
<?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.web.controller.monitorTemplate.mapper.MonitorTemplateMapper">
    
    <resultMap type="MonitorTemplate" id="MonitorTemplateResult">
        <result property="id"    column="id"    />
        <result property="templateName"    column="template_name"    />
        <result property="groupId"    column="group_id"    />
        <result property="groupName"    column="group_name"    />
        <result property="userId"    column="user_id"    />
        <result property="enableStatus"    column="enable_status"    />
        <result property="deflag"    column="deflag"    />
        <result property="createDate"    column="create_date"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateDate"    column="update_date"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>
	
	<sql id="selectMonitorTemplateVo">
        select id, template_name, group_id, group_name, user_id, enable_status, deflag, create_date, create_by, update_date, update_by from monitor_template
    </sql>
	
    <select id="selectMonitorTemplateList" parameterType="MonitorTemplate" resultMap="MonitorTemplateResult">
        <include refid="selectMonitorTemplateVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="templateName != null  and templateName != '' ">
              and template_name LIKE CONCAT('%', #{templateName}, '%')
             </if>
            <if test="groupId != null "> and group_id = #{groupId}</if>
            <if test="groupName != null  and groupName != '' "> and group_name = #{groupName}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="enableStatus != null  and enableStatus != '' "> and enable_status = #{enableStatus}</if>
            <if test="deflag != null  and deflag != '' "> and deflag = #{deflag}</if>
            <if test="createDate != null "> and create_date = #{createDate}</if>
            <if test="createBy != null  and createBy != '' "> and create_by = #{createBy}</if>
            <if test="updateDate != null "> and update_date = #{updateDate}</if>
            <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
        </where>
    </select>
    
    <select id="selectMonitorTemplateById" parameterType="Integer" resultMap="MonitorTemplateResult">
        <include refid="selectMonitorTemplateVo"/>
        where id = #{id}
    </select>
    <select id="selectMonitorTemplateByList"
            resultType="com.ruoyi.web.controller.monitorTemplate.domain.MonitorTemplate" resultMap="MonitorTemplateResult">
        <include refid="selectMonitorTemplateVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="templateName != null  and templateName != '' ">and template_name = #{templateName}</if>
            <if test="groupId != null "> and group_id = #{groupId}</if>
            <if test="groupName != null  and groupName != '' "> and group_name = #{groupName}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="enableStatus != null  and enableStatus != '' "> and enable_status = #{enableStatus}</if>
            <if test="deflag != null  and deflag != '' "> and deflag = #{deflag}</if>
            <if test="createDate != null "> and create_date = #{createDate}</if>
            <if test="createBy != null  and createBy != '' "> and create_by = #{createBy}</if>
            <if test="updateDate != null "> and update_date = #{updateDate}</if>
            <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
        </where>


    </select>

    <insert id="insertMonitorTemplate" parameterType="MonitorTemplate" useGeneratedKeys="true" keyProperty="id">
        insert into monitor_template
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="templateName != null  and templateName != ''  ">template_name,</if>
			<if test="groupId != null  ">group_id,</if>
			<if test="groupName != null  and groupName != ''  ">group_name,</if>
			<if test="userId != null  ">user_id,</if>
			<if test="enableStatus != null  and enableStatus != ''  ">enable_status,</if>
			<if test="deflag != null  and deflag != ''  ">deflag,</if>
			<if test="createDate != null  ">create_date,</if>
			<if test="createBy != null  and createBy != ''  ">create_by,</if>
			<if test="updateDate != null  ">update_date,</if>
			<if test="updateBy != null  and updateBy != ''  ">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="templateName != null  and templateName != ''  ">#{templateName},</if>
			<if test="groupId != null  ">#{groupId},</if>
			<if test="groupName != null  and groupName != ''  ">#{groupName},</if>
			<if test="userId != null  ">#{userId},</if>
			<if test="enableStatus != null  and enableStatus != ''  ">#{enableStatus},</if>
			<if test="deflag != null  and deflag != ''  ">#{deflag},</if>
			<if test="createDate != null  ">#{createDate},</if>
			<if test="createBy != null  and createBy != ''  ">#{createBy},</if>
			<if test="updateDate != null  ">#{updateDate},</if>
			<if test="updateBy != null  and updateBy != ''  ">#{updateBy},</if>
         </trim>
    </insert>
	 
    <update id="updateMonitorTemplate" parameterType="MonitorTemplate">
        update monitor_template
        <trim prefix="SET" suffixOverrides=",">
            <if test="templateName != null  and templateName != ''  ">template_name = #{templateName},</if>
            group_id = #{groupId},
            group_name = #{groupName},
            <if test="userId != null  ">user_id = #{userId},</if>
            <if test="enableStatus != null  and enableStatus != ''  ">enable_status = #{enableStatus},</if>
            <if test="deflag != null  and deflag != ''  ">deflag = #{deflag},</if>
            <if test="createDate != null  ">create_date = #{createDate},</if>
            <if test="createBy != null  and createBy != ''  ">create_by = #{createBy},</if>
            <if test="updateDate != null  ">update_date = #{updateDate},</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

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