<?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.qianwen.smartman.modules.mdc.mapper.SuperProcessParameterMapper">
|
|
<resultMap id="BaseResultMap" type="com.qianwen.smartman.modules.mdc.entity.WorkstationCollectData">
|
<id column="ts" jdbcType="TIMESTAMP" property="ts"/>
|
<result column="n" jdbcType="NVARCHAR" property="n"/>
|
<result column="v" jdbcType="NVARCHAR" property="v"/>
|
</resultMap>
|
|
<select id="queryLastParameter" resultType="com.qianwen.smartman.modules.mdc.entity.WorkstationCollectData">
|
select last(ts), n, last(v),workstation_id from super_collect_data
|
<where>
|
and workstation_id = #{workstationId}
|
</where>
|
group by workstation_id,n
|
</select>
|
|
<select id="queryProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select ts as time,
|
ts as realTime,
|
n as collectItem,
|
v as value_collect
|
from iot_data.super_collect_data
|
<where>
|
n in
|
<foreach collection="collectItems" item="ids" index="index" open="(" close=")" separator=",">
|
#{ids}
|
</foreach>
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
</where>
|
order by ts asc
|
</select>
|
|
<select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select ts as time,
|
ts as realTime,
|
n as collectItem,
|
v as value_collect
|
from iot_data.super_collect_data
|
<where>
|
n = #{item}
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
</where>
|
order by ts asc
|
limit #{current}, #{size}
|
</select>
|
|
<select id="countProcessParameter" resultType="java.lang.Long">
|
select count(*)
|
from iot_data.super_collect_data
|
<where>
|
n = #{item}
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
</where>
|
</select>
|
|
<select id="getOneDate" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select ts as time,
|
ts as realTime,
|
n as collectItem,
|
v as value_collect
|
from iot_data.super_collect_data
|
where workstation_id = #{workstationId}
|
and n = #{item}
|
<if test="flag != null and 'true'.toString() == flag.toString()">
|
and ts > #{time}
|
order by ts asc
|
</if>
|
<if test="flag != null and 'false'.toString() == flag.toString()">
|
and ts < #{time}
|
order by ts desc
|
</if>
|
limit 1
|
</select>
|
|
<select id="processParameterListByShift" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select ts as time,
|
ts as realTime,
|
n as collectItem,
|
v as value_collect
|
from iot_data.super_collect_data
|
<where>
|
n in
|
<foreach collection="collectItems" item="ids" index="index" open="(" close=")" separator=",">
|
#{ids}
|
</foreach>
|
and
|
<foreach collection="times" item="time" index="index" open="(" close=")" separator="or">
|
(ts >= #{time.startTime}
|
and ts <= #{time.endTime})
|
</foreach>
|
and workstation_id = #{workstationId}
|
</where>
|
order by ts asc
|
</select>
|
|
<select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select ts as realTime,
|
n as collectItem,
|
v as value_collect
|
from iot_data.super_collect_data
|
where n = #{item}
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
order by ts
|
</select>
|
|
<select id="oldFirstStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select last(ts) as realTime,
|
last(v) as value_collect
|
from iot_data.super_collect_data
|
where n = #{item}
|
and ts < #{startTime}
|
and workstation_id = #{workstationId}
|
</select>
|
|
<select id="oldLastStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
|
select last(ts) as realTime,
|
last(v) as value_collect
|
from iot_data.super_collect_data
|
where n = #{item}
|
and ts > #{endTime}
|
and workstation_id = #{workstationId}
|
</select>
|
</mapper>
|