MonitorValueMapper.xml 3.73 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.MonitorValueMapper">
    
    <resultMap type="MonitorValue" id="MonitorValueResult">
        <result property="type"    column="type"    />
        <result property="field"    column="field"    />
        <result property="meaning"    column="meaning"    />
        <result property="status"    column="status"    />
        <result property="sort"    column="sort"    />
    </resultMap>


    <resultMap type="MonitorValue" id="MonitorValueMap">
        <result property="field"    column="field"    />
        <result property="meaning"    column="meaning"    />
    </resultMap>
	
	<sql id="selectMonitorValueVo">
        select type, field, meaning, status, sort from monitor_value
    </sql>
	
    <select id="selectMonitorValueList" parameterType="MonitorValue" resultMap="MonitorValueResult">
        <include refid="selectMonitorValueVo"/>
        <where>  
            <if test="type != null  and type != '' "> and type = #{type}</if>
            <if test="field != null  and field != '' "> and field = #{field}</if>
            <if test="meaning != null  and meaning != '' "> and meaning = #{meaning}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="sort != null "> and sort = #{sort}</if>
        </where>
    </select>
    
    <select id="selectMonitorValueById" parameterType="String" resultMap="MonitorValueResult">
        <include refid="selectMonitorValueVo"/>
        where type = #{type}
    </select>
        
    <insert id="insertMonitorValue" parameterType="MonitorValue">
        insert into monitor_value
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="type != null  and type != ''  ">type,</if>
			<if test="field != null  and field != ''  ">field,</if>
			<if test="meaning != null  and meaning != ''  ">meaning,</if>
			<if test="status != null  and status != ''  ">status,</if>
			<if test="sort != null  ">sort,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="type != null  and type != ''  ">#{type},</if>
			<if test="field != null  and field != ''  ">#{field},</if>
			<if test="meaning != null  and meaning != ''  ">#{meaning},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
			<if test="sort != null  ">#{sort},</if>
         </trim>
    </insert>
	 
    <update id="updateMonitorValue" parameterType="MonitorValue">
        update monitor_value
        <trim prefix="SET" suffixOverrides=",">
            <if test="field != null  and field != ''  ">field = #{field},</if>
            <if test="meaning != null  and meaning != ''  ">meaning = #{meaning},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="sort != null  ">sort = #{sort},</if>
        </trim>
        where type = #{type}
    </update>

	<delete id="deleteMonitorValueById" parameterType="String">
        delete from monitor_value where type = #{type}
    </delete>
	
    <delete id="deleteMonitorValueByIds" parameterType="String">
        delete from monitor_value where type in 
        <foreach item="type" collection="array" open="(" separator="," close=")">
            #{type}
        </foreach>
    </delete>


    <select id="queryMonitorValueList" parameterType="MonitorValue" resultType="Map">
       select field,meaning from monitor_value
        <where>
            <if test="type != null  and type != '' "> and type = #{type}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
        </where>
        order by sort
    </select>
</mapper>