Lius
2024-11-04 d603739c0320f355cfc3152865918729fea790de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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.EquipmentXYZMapper">
 
    <select id="findByEquipmentId" resultType="org.jeecg.modules.mdc.entity.EquipmentXYZ">
        SELECT TOP
            1 *
        FROM
            EquipmentXYZ
        WHERE
            EquipmentID = #{equipmentId}
        ORDER BY
            CollectTime DESC
    </select>
 
    <select id="getNearAxisType" resultType="org.jeecg.modules.mdc.dto.MachineXYZHistoryDto">
        SELECT TOP 1
            CollectTime collectTime,
            EquipmentID equipmentID,
            Xmachine xMachine,
            Ymachine yMachine,
            Zmachine zMachine,
            Amachine aMachine,
            Bmachine bMachine
        FROM
            EquipmentXYZ
        WHERE
            EquipmentID = #{equipmentId}
          AND CollectTime BETWEEN #{startDate} AND #{endDate}
        ORDER BY
            ABS( DATEDIFF( SECOND, CollectTime, #{nearDate} ) )
    </select>
</mapper>