| | |
| | | <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"/> |
| | | |
| | | |
| | | <id column="ts" jdbcType="BIGINT" property="ts"/> |
| | | |
| | | <result column="n" jdbcType="VARCHAR" property="n"/> |
| | | <result column="v" jdbcType="VARCHAR" property="v"/> |
| | | <result column="workstation_id" jdbcType="BIGINT" property="workstationId"/> |
| | | </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> |
| | |
| | | </where> |
| | | group by workstation_id,n |
| | | </select> |
| | | |
| | | --> |
| | | |
| | | |
| | | <select id="queryProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | |
| | | </where> |
| | | order by ts asc |
| | | </select> |
| | | |
| | | <!-- |
| | | <select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select ts as time, |
| | | ts as realTime, |
| | |
| | | order by ts asc |
| | | limit #{current}, #{size} |
| | | </select> |
| | | |
| | | --> |
| | | <select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select |
| | | n as collectItem, |
| | | v as value_collect |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | where time >= #{startTime} |
| | | and time <= #{endTime} |
| | | order by time asc |
| | | limit #{size} offset #{current} |
| | | </select> |
| | | <!-- |
| | | <select id="countProcessParameter" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from iot_data.super_collect_data |
| | |
| | | and workstation_id = #{workstationId} |
| | | </where> |
| | | </select> |
| | | |
| | | --> |
| | | <select id="countProcessParameter" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | <where> |
| | | and time >= #{startTime} |
| | | and time <= #{endTime} |
| | | </where> |
| | | </select> |
| | | <select id="getOneDate" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select ts as time, |
| | | ts as realTime, |
| | |
| | | </where> |
| | | order by ts asc |
| | | </select> |
| | | |
| | | <!-- |
| | | <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select ts as realTime, |
| | | n as collectItem, |
| | |
| | | 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 |
| | |
| | | --> |
| | | |
| | | <!-- sql修改开始 --> |
| | | <!-- queryLastParameter 这个是根据原始sql改的,mp有问题,改在service中实现了 |
| | | <select id="queryLastParameter" resultMap="BaseResultMap"> |
| | | select max_time(n) as ts,last_value(n) as n,last_value(v) as v,last_value(workstation_id) as workstationId from root.f2.process_param_${workstationId}_* align by device |
| | | </select> |
| | | --> |
| | | <!-- |
| | | <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam"> |
| | | select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId} |
| | | </select> |
| | | |
| | | --> |
| | | |
| | | |
| | | <!-- 根据oldFirstStatue 改造的--> |
| | | <!-- |
| | | <select id="lastParameterLessThanTime" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam"> |
| | | select workstation_id as workstationId,update_time as updateTime, param_json as paramJson |
| | | from root.f2.last_process_param |
| | | where n = #{item} |
| | | and time < #{startTime} |
| | | and workstation_id = #{workstationId} |
| | | </select> |
| | | </select> --> |
| | | <!-- 根据oldLastStatue改的 --> |
| | | <!-- |
| | | <select id="lastParameterGreaterThanTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select workstation_id as workstationId,update_time as updateTime, param_json as paramJson |
| | | from root.f2.last_process_param |
| | | where n = #{item} |
| | | and ts > #{endTime} |
| | | and workstation_id = #{workstationId} |
| | | </select> --> |
| | | <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select n as collectItem,v as valueCollect |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | where time >= #{startTime} |
| | | and time <= #{endTime} |
| | | order by time |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="lastParameterNotEqValue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select n as collectItem,v as valueCollect |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | where v<>"#{value}" |
| | | order by time desc limit 1 |
| | | </select> |
| | | |
| | | <select id="firstParameterEqValueGtTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select n as collectItem,v as valueCollect |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | where v="#{value}" and time > #{time} |
| | | order by time limit 1 |
| | | </select> |
| | | |
| | | <select id="firstParameterEqValue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO"> |
| | | select n as collectItem,v as valueCollect |
| | | from root.f2.process_param_${workstationId}_${item} |
| | | where v="#{value}" |
| | | order by time limit 1 |
| | | </select> |
| | | </mapper> |
| | | |