MonitorSetMapper.xml 8.22 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.business.mapper.MonitorSetMapper">
    
    <resultMap type="MonitorSet" id="MonitorSetResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="userId"    />
        <result property="parentType"    column="parentType"    />
        <result property="type"    column="type"    />
        <result property="monitorDimension"    column="monitorDimension"    />
        <result property="subdivisionDimension"    column="subdivisionDimension"    />
        <result property="monitorStatus"    column="monitorStatus"    />
        <result property="warningLevel"    column="warningLevel"    />
        <result property="isSF"    column="isSF"    />
        <result property="creditTime"    column="creditTime"    />
        <result property="updateTime"    column="updateTime"    />
        <result property="remark"    column="remark"    />
        <result property="status"    column="status"    />
    </resultMap>
	
	<sql id="selectMonitorSetVo">
        select id, userId, parentType, type, monitorDimension, subdivisionDimension, monitorStatus, warningLevel, isSF, creditTime, updateTime, remark,status from monitor_set
    </sql>
	
    <select id="selectMonitorSetList" parameterType="MonitorSet" resultMap="MonitorSetResult">
        <include refid="selectMonitorSetVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="userId != null  and userId != '' "> and userId = #{userId}</if>
            <if test="parentType != null  and parentType != '' "> and parentType = #{parentType}</if>
            <if test="type != null  and type != '' "> and type = #{type}</if>
            <if test="monitorDimension != null  and monitorDimension != '' "> and monitorDimension = #{monitorDimension}</if>
            <if test="subdivisionDimension != null  and subdivisionDimension != '' "> and subdivisionDimension = #{subdivisionDimension}</if>
            <if test="monitorStatus != null  and monitorStatus != '' "> and monitorStatus = #{monitorStatus}</if>
            <if test="warningLevel != null  and warningLevel != '' "> and warningLevel = #{warningLevel}</if>
            <if test="isSF != null  and isSF != '' "> and isSF = #{isSF}</if>
            <if test="creditTime != null "> and creditTime = #{creditTime}</if>
            <if test="updateTime != null "> and updateTime = #{updateTime}</if>
            <if test="remark != null  and remark != '' "> and remark = #{remark}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectMonitorSetById" parameterType="Integer" resultMap="MonitorSetResult">
        <include refid="selectMonitorSetVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMonitorSet" parameterType="MonitorSet" useGeneratedKeys="true" keyProperty="id">
        insert into monitor_set
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">userId,</if>
			<if test="parentType != null  and parentType != ''  ">parentType,</if>
			<if test="type != null  and type != ''  ">type,</if>
			<if test="monitorDimension != null  and monitorDimension != ''  ">monitorDimension,</if>
			<if test="subdivisionDimension != null  and subdivisionDimension != ''  ">subdivisionDimension,</if>
			<if test="monitorStatus != null  and monitorStatus != ''  ">monitorStatus,</if>
			<if test="warningLevel != null  and warningLevel != ''  ">warningLevel,</if>
			<if test="isSF != null  and isSF != ''  ">isSF,</if>
			<if test="creditTime != null  ">creditTime,</if>
			<if test="updateTime != null  ">updateTime,</if>
			<if test="remark != null  and remark != ''  ">remark,</if>
			<if test="status != null  and status != ''  ">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">#{userId},</if>
			<if test="parentType != null  and parentType != ''  ">#{parentType},</if>
			<if test="type != null  and type != ''  ">#{type},</if>
			<if test="monitorDimension != null  and monitorDimension != ''  ">#{monitorDimension},</if>
			<if test="subdivisionDimension != null  and subdivisionDimension != ''  ">#{subdivisionDimension},</if>
			<if test="monitorStatus != null  and monitorStatus != ''  ">#{monitorStatus},</if>
			<if test="warningLevel != null  and warningLevel != ''  ">#{warningLevel},</if>
			<if test="isSF != null  and isSF != ''  ">#{isSF},</if>
			<if test="creditTime != null  ">#{creditTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
			<if test="remark != null  and remark != ''  ">#{remark},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
         </trim>
    </insert>
	 
    <update id="updateMonitorSet" parameterType="MonitorSet">
        update monitor_set
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null  and userId != ''  ">userId = #{userId},</if>
            <if test="parentType != null  and parentType != ''  ">parentType = #{parentType},</if>
            <if test="type != null  and type != ''  ">type = #{type},</if>
            <if test="monitorDimension != null  and monitorDimension != ''  ">monitorDimension = #{monitorDimension},</if>
            <if test="subdivisionDimension != null  and subdivisionDimension != ''  ">subdivisionDimension = #{subdivisionDimension},</if>
            <if test="monitorStatus != null  and monitorStatus != ''  ">monitorStatus = #{monitorStatus},</if>
            <if test="warningLevel != null  and warningLevel != ''  ">warningLevel = #{warningLevel},</if>
            <if test="isSF != null  and isSF != ''  ">isSF = #{isSF},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
            <if test="remark != null  and remark != ''  ">remark = #{remark},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="updateMonitorSetByUserId" parameterType="MonitorSet">
        update monitor_set
        <trim prefix="SET" suffixOverrides=",">
            <if test="parentType != null  and parentType != ''  ">parentType = #{parentType},</if>
            <if test="type != null  and type != ''  ">type = #{type},</if>
            <if test="monitorDimension != null  and monitorDimension != ''  ">monitorDimension = #{monitorDimension},</if>
            <if test="subdivisionDimension != null  and subdivisionDimension != ''  ">subdivisionDimension = #{subdivisionDimension},</if>
            <if test="monitorStatus != null  and monitorStatus != ''  ">monitorStatus = #{monitorStatus},</if>
            <if test="warningLevel != null  and warningLevel != ''  ">warningLevel = #{warningLevel},</if>
            <if test="isSF != null  and isSF != ''  ">isSF = #{isSF},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
            <if test="remark != null  and remark != ''  ">remark = #{remark},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where userId = #{userId}
    </update>

	<delete id="deleteMonitorSetById" parameterType="Integer">
        delete from monitor_set where id = #{id}
    </delete>
	
    <delete id="deleteMonitorSetByIds" parameterType="String">
        delete from monitor_set where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <delete id="deleteMonitorSetByUserId" parameterType="String">
        delete from monitor_set where userId = #{userId}
    </delete>

    <delete id="deleteMonitorSetBy" parameterType="String">
        delete from monitor_set where userId = #{userId} and parentType = #{parentType}
    </delete>

    <update id="updateStatus" parameterType="String">
        update monitor_set set  status=#{status} where userId=#{userId} and parentType = #{parentType}
    </update>
</mapper>