<?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.newfiber.modules.gate.dao.MonitorDao"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="com.newfiber.modules.gate.entity.GateInfo" id="gateInfoMap"> <result property="stCode" column="st_code"/> <result property="stName" column="st_name"/> <result property="deviceCode" column="device_code"/> <result property="channelId" column="channel_id"/> </resultMap> <insert id="insertTask"> insert into plc_downlink_task(`st_code`,`point_key`,`content`,`change_value`,`status`) values (#{task.stCode},#{task.pointKey},#{task.content},#{task.changeValue},#{task.status}) </insert> <update id="updateStatus"> update plc_gate_status set status=#{status} where st_code=#{stCode} and device_code=#{deviceCode} </update> <select id="querySiteList" resultType="java.util.List" resultMap="gateInfoMap"> select st_code,st_name,device_code,channel_id from plc_site_info </select> <select id="queryLevel" resultType="java.util.Map"> select yw,monitor_time from ${stCode} where 1=1 <if test="beginTime!=null and beginTime!=''"> and monitor_time >= #{beginTime} </if> <if test="endTime!=null and endTime!=''"> and monitor_time <= #{endTime} </if> order by monitor_time <if test="orderNum==1"> desc </if> </select> <select id="queryStatusPoints" resultType="java.util.Map"> select b.id,a.st_code,a.point_key pointKey,a.point_name pointName,a.data_type,b.device_code,b.device_name from plc_point_info a left join plc_device_info b on a.st_code=b.st_code and a.device_code=b.device_code where a.data_type=1 and a.st_code=#{stCode} group by a.st_code ,a.point_key,a.point_name ,a.data_type,b.device_code,b.device_name,b.id order by a.st_code,b.id </select> <select id="queryMonitorData" resultType="java.util.Map"> select <foreach collection="searchPoints" separator="," item="item"> ${item} </foreach> from ${stCode} order by monitor_time desc limit 1 </select> <select id="queryDownPoints" resultType="java.util.Map"> select point_key,down_key from plc_downlink_point where st_code=#{stCode} </select> <select id="queryGateStatus" resultType="java.util.Map"> select device_code,status from plc_gate_status where st_code=#{stCode} </select> <select id="queryPoint" resultType="com.newfiber.modules.gate.entity.PointInfo"> select st_code,point_key,point_name,plc_point_name,data_type,device_code from plc_point_info where st_code=#{stCode} and point_key=#{pointKey} </select> <select id="queryStatus" resultType="java.util.Map"> select a.device_code code,a.status `value`,b.device_name headName from plc_gate_status a,plc_device_info b where a.device_code=b.device_code and a.st_code=#{stCode} </select> <select id="getCurrentLevel" resultType="java.util.Map"> select yw,monitor_time from ${stCode} order by monitor_time desc limit 1 </select> <select id="selectByCode" resultType="com.newfiber.modules.inspection.entity.PlcSiteInfoEntity"> select * from plc_site_info where st_code = #{stCode} </select> </mapper>