<?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.tdengine.mapper.WorkstationAggregatePulseMapper">
|
|
|
<delete id="deleteSuperTable">
|
drop table if exists iot_data.pulse_data_${workstationId}_${usageCode}
|
</delete>
|
|
<delete id="deleteTable">
|
drop table if exists iot_data.aggregate_pulse_data_${workstationId}_${usageCode}
|
</delete>
|
|
|
|
<select id="getShiftOutput"
|
resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
|
select ts,
|
pre_ts as preTs,
|
output,
|
cur_output as curOutput,
|
pre_output as preOutput,
|
calendar_code as calendarCode,
|
factory_year as factoryYear,
|
factory_month as factoryMonth,
|
factory_week as factoryWeek,
|
factory_date as factoryDate,
|
shift_index as shiftIndex,
|
shift_time_type as shiftTimeType,
|
program,
|
product_code as productCode,
|
product_name as productName,
|
workstation_id as workstationId
|
from iot_data.super_aggregate_pulse_data
|
where output <![CDATA[>=]]> 0
|
and factory_date = #{factoryDate}
|
and shift_index = #{shiftIndex}
|
and usage_code = #{usageCode}
|
<if test="workstationIds != null and workstationIds.size() > 0">
|
AND workstation_id IN
|
<foreach collection="workstationIds" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
ORDER BY ts asc
|
</select>
|
|
|
<select id="getOutputDataByWorkstationAndFactoryDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
|
select ts,
|
pre_ts as preTs,
|
output,
|
cur_output as curOutput,
|
pre_output as preOutput,
|
calendar_code as calendarCode,
|
factory_year as factoryYear,
|
factory_month as factoryMonth,
|
factory_week as factoryWeek,
|
factory_date as factoryDate,
|
shift_index as shiftIndex,
|
shift_time_type as shiftTimeType,
|
program,
|
product_code as productCode,
|
product_name as productName,
|
workstation_id as workstationId
|
from iot_data.super_aggregate_pulse_data
|
where output <![CDATA[>=]]> 0
|
and ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate}
|
and usage_code = #{usageCode}
|
<if test="workstationId != null and workstationId !=''">
|
AND workstation_id =#{workstationId}
|
</if>
|
ORDER BY ts asc
|
</select>
|
|
</mapper>
|