yangys
2024-10-25 f112d1263921940234671e5788f6cf2655dbc353
smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
@@ -39,7 +39,7 @@
        </where>
        order by ts asc
    </select>
   <!--
    <select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select ts as time,
        ts as realTime,
@@ -55,7 +55,18 @@
        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 &gt;= #{startTime}
            and time &lt;= #{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
@@ -66,7 +77,15 @@
            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 &gt;= #{startTime}
            and time &lt;= #{endTime}
        </where>
    </select>
    <select id="getOneDate" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select ts as time,
        ts as realTime,
@@ -154,30 +173,51 @@
    
  
     <!-- 根据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 &lt; #{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 &gt; #{endTime}
          and workstation_id = #{workstationId}
    </select>
    </select> -->
    <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
        select n as collectItem,v  as valueCollect
        from root.f2.process_param_*
        where n = #{item}
          and time &gt;= #{startTime}
        select n as collectItem,v as valueCollect
        from root.f2.process_param_${workstationId}_${item}
        where time &gt;= #{startTime}
          and time &lt;= #{endTime}
          and workstation_id = #{workstationId}
        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&lt;&gt;"#{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 &gt; #{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>