You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.8 KiB
XML

<?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.haiwei.manage.mapper.ApiMapper">
<select id="queryPram" resultType="com.haiwei.manage.domain.ParamVo">
SELECT ee.name,
info.PointName as pointname,
ed.Data as data
FROM EPointData ed
right join (
SELECT PID, MAX(CreateTime) AS LatestTime
FROM EPointData
GROUP BY PID
) ld on ld.PID = ed.PID and ld.LatestTime = CreateTime
right join EPointsInfo info on ed.PID = info.ID
left join EEquipmentMaintenance ee on ee.ID = info.EID
where ee.EquipmentType = 1
</select>
<select id="queryDeviceState" resultType="com.haiwei.manage.domain.ParamVo">
SELECT name,
DataType as data
FROM EEquipmentState
where PID = 7
</select>
<select id="queryPramList" resultType="com.haiwei.manage.domain.RecordRaramData">
select * from (
SELECT ee.name + info.PointName as pointname,
ed.Data as data,
CONVERT(varchar, ed.CreateTime, 120) time
FROM EPointData ed
right join EPointsInfo info on ed.PID = info.ID
left join EEquipmentMaintenance ee on ee.ID = info.EID
where ee.EquipmentType = 1
) a
PIVOT
(max(data) FOR pointname IN (
一体机A转速,
一体机A电流,
一体机切刀A转速,
一体机切刀A电流,
一体机A机头温度,
一体机A机头压力
))t
<where>
<if test="beginTime !=null and endTime !=null">
time between #{beginTime} and #{endTime}
</if>
</where>
</select>
</mapper>