<?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.SuperNewCollectMapper">
|
|
<insert id="insertData">
|
insert into
|
<foreach collection="collects" item="collect" index="index" close=";">
|
iot_data.new_process_param_${collect.workstationId}_${collect.item}
|
using iot_data.super_new_collect_data
|
TAGS(#{collect.workstationId}, #{collect.n})
|
values (#{collect.ts}, #{collect.v})
|
</foreach>
|
</insert>
|
|
<update id="createSuperTable">
|
CREATE TABLE IF NOT EXISTS super_new_collect_data
|
(
|
ts timestamp,
|
v NCHAR(256)
|
) TAGS (workstation_id BIGINT, n NCHAR(64));
|
</update>
|
|
<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_new_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}
|
order by ts
|
</select>
|
|
<select id="countProcessParameter" resultType="java.lang.Long">
|
select count(*)
|
from iot_data.super_new_collect_data
|
where n = #{item}
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
</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_new_collect_data
|
where n = #{item}
|
and ts >= #{startTime}
|
and ts <= #{endTime}
|
and workstation_id = #{workstationId}
|
order by ts
|
limit #{current}, #{size}
|
</select>
|
|
<select id="queryProcessParameterByTime" 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_new_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}
|
order by ts
|
</select>
|
</mapper>
|