2024-11-25 01:04:53 +08:00
|
|
|
<?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">
|
2024-11-25 15:48:00 +08:00
|
|
|
<mapper namespace="com.isu.gaswellwatch.dao.DeviceDao">
|
2024-11-25 01:04:53 +08:00
|
|
|
|
2024-11-25 15:48:00 +08:00
|
|
|
<resultMap id="DeviceVOMap" type="com.isu.gaswellwatch.vo.DeviceVO">
|
2024-11-25 01:04:53 +08:00
|
|
|
<id column="id" property="id"/>
|
|
|
|
<result column="code" property="code"/>
|
|
|
|
<result column="gas_station" property="gasStation"/>
|
|
|
|
<result column="gateway_sn" property="gatewaySn"/>
|
|
|
|
<result column="details" property="details"/>
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
<result column="update_time" property="updateTime"/>
|
|
|
|
<association property="deviceType" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic" column="device_type">
|
|
|
|
</association>
|
|
|
|
<association property="product" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic" column="product">
|
|
|
|
</association>
|
|
|
|
<association property="gasWell" javaType="com.isu.gaswellwatch.entity.GasWell" >
|
|
|
|
<id column="gasWellId" property="id"/>
|
|
|
|
<result column="gasWellName" property="name"/>
|
|
|
|
</association>
|
|
|
|
</resultMap>
|
|
|
|
|
2024-11-25 15:48:00 +08:00
|
|
|
<resultMap id="DeviceMap" type="com.isu.gaswellwatch.entity.Device" autoMapping="true">
|
|
|
|
<id column="id" property="id"/>
|
|
|
|
<result column="code" property="code"/>
|
|
|
|
<result column="gas_station" property="gasStation"/>
|
|
|
|
<result column="gateway_sn" property="gatewaySn"/>
|
|
|
|
<result column="details" property="details"/>
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
<result column="update_time" property="updateTime"/>
|
|
|
|
<result property="deviceType" column="device_type"/>
|
|
|
|
<result property="product" column="product"/>
|
|
|
|
<result property="gasWell" column="gas_well"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<select id="page" resultMap="DeviceVOMap">
|
2024-11-25 01:04:53 +08:00
|
|
|
select u.id, u.device_type, u.code, u.gas_station, u.product, u.gateway_sn,
|
2024-11-25 15:48:00 +08:00
|
|
|
u.gas_well, u.details, u.create_time, u.update_time,g.name as gasWellName,g.id as gasWellId
|
2024-11-25 01:04:53 +08:00
|
|
|
from device u left join gas_well g on u.gas_well = g.id
|
|
|
|
<where>
|
|
|
|
<if test="gasWellName!=null and gasWellName!='' ">
|
|
|
|
and g.name LIKE CONCAT('%',#{gasWellName},'%')
|
|
|
|
</if>
|
|
|
|
<if test="gasStationName!=null and gasStationName!='' ">
|
|
|
|
and u.gas_station LIKE CONCAT('%',#{gasStationName},'%')
|
|
|
|
</if>
|
|
|
|
<if test="deviceTypeId!=null and deviceTypeId!='' ">
|
|
|
|
and u.device_type = #{deviceTypeId}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
order by u.id desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getDic" parameterType="java.lang.Long" resultType="com.isu.gaswellwatch.entity.Dictionary">
|
2024-11-25 15:48:00 +08:00
|
|
|
SELECT d.id,d.type,d.code,d.name,d.value,d.sort
|
2024-11-25 01:04:53 +08:00
|
|
|
FROM Dictionary d
|
|
|
|
where d.id=#{dicId}
|
|
|
|
</select>
|
|
|
|
|
2024-11-25 15:48:00 +08:00
|
|
|
<select id="getDeviceById" resultMap="DeviceVOMap">
|
|
|
|
select u.id, u.device_type, u.code, u.gas_station, u.product, u.gateway_sn,
|
|
|
|
u.gas_well, u.details, u.create_time, u.update_time,g.name as gasWellName,g.id as gasWellId
|
|
|
|
from device u left join gas_well g on u.gas_well = g.id
|
|
|
|
where u.id = #{id}
|
|
|
|
</select>
|
|
|
|
|
2024-11-26 03:12:53 +08:00
|
|
|
|
|
|
|
<select id="historyPage" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
|
|
|
|
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure,t.run_mode,t.plug_status from ${tableName} t where
|
|
|
|
t.device_id = #{deviceId}
|
|
|
|
<if test="startTime!=null">
|
|
|
|
and t.collection_time >= #{startTime}
|
|
|
|
</if>
|
|
|
|
<if test="endTime!=null">
|
|
|
|
and t.collection_time <= #{endTime}
|
|
|
|
</if>
|
|
|
|
order by t.collection_time desc
|
|
|
|
</select>
|
|
|
|
|
2024-11-25 01:04:53 +08:00
|
|
|
</mapper>
|
|
|
|
|