<?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="org.jeecg.modules.mdc.mapper.EquipmentWorklineMapper">
|
|
<select id="getMacingDataList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
|
select top 1 [${tableName}].* from [${tableName}] order by CollectTime desc
|
</select>
|
|
<select id="findRunningData" resultType="java.lang.String">
|
SELECT ProductCount FROM [${tableName}] WHERE ProductCount <> '' AND CollectTime BETWEEN #{ startTime } AND #{ endTime } GROUP BY ProductCount ORDER BY ProductCount
|
</select>
|
|
<select id="getEquipProgramNum" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto">
|
select Programnumber,CollectTime from [${tableName}] where CollectTime > #{startTime} and CollectTime <= #{endTime} and Programnumber is not null
|
</select>
|
|
<select id="findProductCountStartTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
|
SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime ASC
|
</select>
|
|
<select id="findProductCountEndTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
|
SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC
|
</select>
|
|
<select id="getDataList" resultType="java.util.Map">
|
select top 1 [${tableName}].* from [${tableName}] order by CollectTime desc
|
</select>
|
|
<select id="getMinDate" resultType="java.util.Date">
|
SELECT TOP 1 CollectTime from [${tableName}] ORDER BY CollectTime ASC
|
</select>
|
|
<select id="getMaxElectric" resultType="org.jeecg.modules.mdc.dto.CurrentElectricDto">
|
SELECT TOP 1
|
<if test="axisType != null and axisType != '' and axisType == 1">
|
ABS( actualCurrentX ) currentValue,
|
EquipmentID,
|
CollectTime
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 2">
|
ABS( actualCurrentY ) currentValue,
|
EquipmentID,
|
CollectTime
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 3">
|
ABS( actualCurrentZ ) currentValue,
|
EquipmentID,
|
CollectTime
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 4">
|
ABS( actualCurrentA ) currentValue,
|
EquipmentID,
|
CollectTime
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 5">
|
ABS( actualCurrentB ) currentValue,
|
EquipmentID,
|
CollectTime
|
</if>
|
FROM
|
[${tableName}]
|
WHERE
|
<if test="axisType != null and axisType != '' and axisType == 1">
|
ABS( actualCurrentX ) = ( SELECT MAX ( ABS( actualCurrentX ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 2">
|
ABS( actualCurrentY ) = ( SELECT MAX ( ABS( actualCurrentY ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 3">
|
ABS( actualCurrentZ ) = ( SELECT MAX ( ABS( actualCurrentZ ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 4">
|
ABS( actualCurrentA ) = ( SELECT MAX ( ABS( actualCurrentA ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</if>
|
<if test="axisType != null and axisType != '' and axisType == 5">
|
ABS( actualCurrentB ) = ( SELECT MAX ( ABS( actualCurrentB ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</if>
|
</select>
|
|
<select id="getNearTimeSpindleLoad" resultType="org.jeecg.modules.mdc.dto.EquipmentMachiningHistoryDto">
|
SELECT TOP 1
|
CollectTime collectTime,
|
spindleload,
|
spindlespeed
|
FROM
|
[${tableName}]
|
WHERE
|
CollectTime BETWEEN #{startDate} AND #{endDate}
|
ORDER BY
|
ABS( DATEDIFF( SECOND, CollectTime, #{nearDate} ) )
|
</select>
|
|
<select id="getMaxSpindleLoad" resultType="org.jeecg.modules.mdc.dto.EquipmentMachiningHistoryDto">
|
SELECT TOP 1
|
CollectTime collectTime,
|
EquipmentID equipmentID,
|
spindleload spindleLoad,
|
spindlespeed spindleSpeed
|
FROM
|
[${tableName}]
|
WHERE
|
ABS( spindleload ) = ( SELECT MAX ( ABS( spindleload ) ) spindleload FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
|
</select>
|
</mapper>
|