yangys
2024-11-02 9a9b747962cc00801d8cce4137d1e123d556a79b
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?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.qianwen.mdc.mapper.MachiningDataMapper">
  <resultMap id="BaseResultMap" type="com.qianwen.mdc.domain.MachiningData">
 
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="machine_id" jdbcType="INTEGER" property="machineId" />
    <result column="mdc_time" jdbcType="INTEGER" property="mdcTime" />
    <result column="update_time" jdbcType="INTEGER" property="updateTime" />
    <result column="state" jdbcType="VARCHAR" property="state" />
    <result column="mode" jdbcType="VARCHAR" property="mode" />
    <result column="op_mode" jdbcType="INTEGER" property="opMode" />
    <result column="spindle_speed" jdbcType="INTEGER" property="spindleSpeed" />
    <result column="spindle_override" jdbcType="INTEGER" property="spindleOverride" />
    <result column="spindle_load" jdbcType="INTEGER" property="spindleLoad" />
    <result column="feedrate_override" jdbcType="INTEGER" property="feedrateOverride" />
    <result column="feed_rate" jdbcType="INTEGER" property="feedRate" />
    <result column="rapid_feed_override" jdbcType="INTEGER" property="rapidFeedOverride" />
    <result column="rapid_feed" jdbcType="INTEGER" property="rapidFeed" />
    <result column="prog_name" jdbcType="VARCHAR" property="progName" />
    <result column="prog_block" jdbcType="VARCHAR" property="progBlock" />
    <result column="alarm_no" jdbcType="VARCHAR" property="alarmNo" />
    <result column="alarm_msg" jdbcType="VARCHAR" property="alarmMsg" />
    <result column="tool_no" jdbcType="INTEGER" property="toolNo" />
    <result column="tool_name" jdbcType="VARCHAR" property="toolName" />
    <result column="oper_id" jdbcType="INTEGER" property="operId" />
    <result column="axis_names" jdbcType="VARCHAR" property="axisNames" />
    <result column="axis_absolute" jdbcType="VARCHAR" property="axisAbsolute" />
    <result column="axis_relative" jdbcType="VARCHAR" property="axisRelative" />
    <result column="axis_servoloads" jdbcType="VARCHAR" property="axisServoloads" />
    <result column="is_maintain" jdbcType="BIT" property="isMaintain" />
    <result column="is_part_complete" jdbcType="BIT" property="isPartComplete" />
    
   
    
  </resultMap>
  
  <resultMap id="DetailResultMap" type="com.qianwen.mdc.dto.machine.MachiningDataFullDTO">
 
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="machine_id" jdbcType="INTEGER" property="machineId" />
    
    <result column="mdc_time" jdbcType="INTEGER" property="mdcTime" />
    <result column="update_time" jdbcType="INTEGER" property="updateTime" />
    <result column="state" jdbcType="VARCHAR" property="state" />
    <result column="mode" jdbcType="VARCHAR" property="mode" />
    <result column="op_mode" jdbcType="INTEGER" property="opMode" />
    <result column="spindle_speed" jdbcType="INTEGER" property="spindleSpeed" />
    <result column="spindle_override" jdbcType="INTEGER" property="spindleOverride" />
    <result column="spindle_load" jdbcType="INTEGER" property="spindleLoad" />
    <result column="feedrate_override" jdbcType="INTEGER" property="feedrateOverride" />
    <result column="feed_rate" jdbcType="INTEGER" property="feedRate" />
    <result column="rapid_feed_override" jdbcType="INTEGER" property="rapidFeedOverride" />
    <result column="rapid_feed" jdbcType="INTEGER" property="rapidFeed" />
    <result column="prog_name" jdbcType="VARCHAR" property="progName" />
    <result column="prog_block" jdbcType="VARCHAR" property="progBlock" />
    <result column="alarm_no" jdbcType="VARCHAR" property="alarmNo" />
    <result column="alarm_msg" jdbcType="VARCHAR" property="alarmMsg" />
    <result column="tool_no" jdbcType="INTEGER" property="toolNo" />
    <result column="tool_name" jdbcType="VARCHAR" property="toolName" />
    <result column="oper_id" jdbcType="INTEGER" property="operId" />
    <result column="axis_names" jdbcType="VARCHAR" property="axisNames" />
    <result column="axis_absolute" jdbcType="VARCHAR" property="axisAbsolute" />
    <result column="axis_relative" jdbcType="VARCHAR" property="axisRelative" />
    <result column="axis_servoloads" jdbcType="VARCHAR" property="axisServoloads" />
    <result column="is_maintain" jdbcType="BIT" property="isMaintain" />
    <result column="is_part_complete" jdbcType="BIT" property="isPartComplete" />
    
     <result column="machine_name" jdbcType="VARCHAR" property="machineName" />
  </resultMap>
  <select id="machineLastDataBeforeTime" resultMap="BaseResultMap">
      select id,machine_id,mdc_time,update_time,state,mode,op_mode,spindle_speed,spindle_override,spindle_load,feedrate_override,
      feed_rate, rapid_feed_override,rapid_feed,prog_name,prog_block,alarm_no,alarm_msg,tool_no,tool_name,oper_id,
    axis_names,axis_absolute,axis_relative,axis_servoloads,is_maintain,is_part_complete
    
       from machining_data where machine_id=#{machineId} and mdc_time &lt;=#{mdcTime} order by mdc_time desc limit 1
  </select>
  
  <select id="machineLastDatasAfterUpdateTime" resultMap="BaseResultMap">
      select id,machine_id,mdc_time,update_time,state,mode,op_mode,spindle_speed,spindle_override,spindle_load,feedrate_override,
      feed_rate, rapid_feed_override,rapid_feed,prog_name,prog_block,alarm_no,alarm_msg,tool_no,tool_name,oper_id,
    axis_names,axis_absolute,axis_relative,axis_servoloads,is_maintain,is_part_complete
    
       from machining_data where machine_id=#{machineId} and update_time &gt;#{updateTime} order by id asc, update_time asc limit 1
  </select>
  
  <select id="machineLastData" resultMap="DetailResultMap">
      select d.id,d.machine_id,mdc_time,update_time,state,mode,op_mode,spindle_speed,spindle_override,spindle_load,feedrate_override,
      feed_rate, rapid_feed_override,rapid_feed,prog_name,prog_block,alarm_no,alarm_msg,tool_no,tool_name,oper_id,
    axis_names,axis_absolute,axis_relative,axis_servoloads,is_maintain,is_part_complete,
    ma.machine_name
       from machining_data d left join machine_account ma on d.machine_id=ma.machine_id where d.machine_id=#{machineId} order by id desc
       limit #{limit}
  </select>
</mapper>