<?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.casic.dao.smartwell.MapDataMapper"> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> w.ID AS id, WELL_CODE AS "wellCode", WELL_NAME AS "wellName", DEEP AS deep, COORDINATE_X AS "coordinateX", COORDINATE_Y AS "coordinateY", LAT_BAIDU AS "latBaidu", LNG_BAIDU AS "lngBaidu", LNG_GAODE AS "lngGaode", LAT_GAODE AS "latGaode", AREA AS area, POSITION AS position, DEPTID AS deptid, PHOTOS AS photos, NOTES AS notes, WELL_TYPE AS "wellType", STAFF AS staff, TEL AS tel, w.TS AS ts, w.VALID AS valid, BFZT AS bfzt,RESPONSIBLE_DEPT AS "responsibleDept",ROAD AS road,bd.device_type AS "deviceType" </sql> <select id="getWellList" resultType="com.casic.model.BusWellInfoDto"> SELECT <include refid="Base_Column_List"/> FROM bus_well_info w INNER JOIN bus_device_well bdw ON bdw.WELL_ID=w.id INNER JOIN bus_device bd ON bd.ID=bdw.device_id WHERE w.VALID='1' <if test="keywords != null and keywords !=''"> AND (w.WELL_CODE LIKE CONCAT('%',#{keywords},'%') OR w.POSITION LIKE CONCAT('%',#{keywords},'%')) </if> <if test="wellType != null and wellType !=''"> and w.WELL_TYPE = #{wellType} </if> <if test="deptid != null and deptid !=''"> and w.DEPTID = #{deptid} </if> </select> <select id="getAlarmWellList" resultType="com.casic.model.BusWellInfoDto"> SELECT <include refid="Base_Column_List"/> FROM bus_well_info w INNER JOIN bus_device_well bdw ON bdw.WELL_ID=w.id INNER JOIN bus_device bd ON bd.ID=bdw.device_id WHERE w.VALID='1' <if test="keywords != null and keywords !=''"> AND (w.WELL_CODE LIKE CONCAT('%',#{keywords},'%') OR w.POSITION LIKE CONCAT('%',#{keywords},'%')) </if> <if test="wellType != null and wellType !=''"> and w.WELL_TYPE = #{wellType} </if> <if test="deptid != null and deptid !=''"> and w.DEPTID = #{deptid} </if> and w.WELL_CODE in (SELECT DISTINCT well_code from alarm_records where status = '1') </select> <select id="getNotAlarmWellList" resultType="com.casic.model.BusWellInfoDto"> SELECT <include refid="Base_Column_List"/> FROM bus_well_info w INNER JOIN bus_device_well bdw ON bdw.WELL_ID=w.id INNER JOIN bus_device bd ON bd.ID=bdw.device_id WHERE w.VALID='1' <if test="keywords != null and keywords !=''"> AND (w.WELL_CODE LIKE CONCAT('%',#{keywords},'%') OR w.POSITION LIKE CONCAT('%',#{keywords},'%')) </if> <if test="wellType != null and wellType !=''"> and w.WELL_TYPE = #{wellType} </if> <if test="deptid != null and deptid !=''"> and w.DEPTID = #{deptid} </if> and w.WELL_CODE not in (SELECT DISTINCT WELL_CODE from alarm_records where status = '1') </select> <select id="getNowAlarmRecords" resultType="com.casic.model.AlarmNowView"> SELECT wellId AS "wellId", deviceId AS "deviceId", devcode as devcode, wellCode AS "wellCode", alarmId AS "alarmId", deptid AS deptid,wellType AS "wellType", alarmType AS "alarmType", alarmValue AS "alarmValue", alarmContent AS "alarmContent",alarmTimeDate AS "alarmTime", position AS "position", coordinateX AS "coordinateX", coordinateY AS "coordinateY", lngBaidu AS "lngBaidu", latBaidu AS "latBaidu", lngGaode AS "lngGaode", latGaode AS "latGaode" FROM alarm_now_view w WHERE alarmType=1 ORDER BY alarmTimeDate DESC </select> <select id="getDictNameByCode" resultType="String"> SELECT name FROM sys_dict sd, (SELECT id FROM sys_dict WHERE code='sluicewellType') ssd WHERE code='3' AND ssd.id=sd.pid </select> <select id="getDeviceStatus" resultType="Map"> SELECT ${dataField}, (CASE bd.online_state WHEN '0' THEN '0' ELSE '1' END) AS "onlineState",tn.logtime AS logtime FROM bus_device bd LEFT JOIN ${tableName} tn ON bd.DEVCODE=tn.DEVCODE JOIN bus_device_well bdw ON bd.ID=bdw.DEVICE_ID JOIN bus_well_info bwi ON bwi.ID=bdw.WELL_ID WHERE bd.DEVCODE=#{devcode} </select> </mapper>