浏览代码

事前标记

zjs 2 周之前
父节点
当前提交
2afdcb1a41

+ 1 - 1
src/main/java/com/cn/esermis/EsermisApplication.java

@@ -25,7 +25,7 @@ public class EsermisApplication  implements CommandLineRunner {
25 25
         /**
26 26
          * 使用异步注解方式启动netty服务端服务
27 27
          */
28
-        new BootNettyServer().bind(19900);
28
+        new BootNettyServer().bind(8088);
29 29
     }
30 30
 
31 31
 }

+ 19 - 5
src/main/java/com/cn/esermis/controller/DataAcquisitionInstrumentController.java

@@ -1,5 +1,6 @@
1 1
 package com.cn.esermis.controller;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -19,9 +20,7 @@ import org.springframework.web.bind.annotation.*;
19 20
 
20 21
 import javax.annotation.Resource;
21 22
 
22
-import java.util.ArrayList;
23
-import java.util.List;
24
-import java.util.Map;
23
+import java.util.*;
25 24
 
26 25
 import static com.cn.esermis.dpld.model.AjaxResult.success;
27 26
 
@@ -36,7 +35,7 @@ public class DataAcquisitionInstrumentController {
36 35
     private IDataAcquisitionInstrumentService dataAcquisitionInstrumentService;
37 36
 
38 37
     /**
39
-     * 获取菜单列
38
+     * 获取数采仪信息
40 39
      */
41 40
     @GetMapping("/list")
42 41
     public AjaxResult list(DataAcquisitionInstrumentVo vo)
@@ -177,7 +176,7 @@ public class DataAcquisitionInstrumentController {
177 176
                 BeanUtils.copyProperties(x, analyticalInstruments);
178 177
                 analyticalInstruments.setDataAcquisitionInstrumentId(dataAcquisitionInstrument.getId());
179 178
                 boolean save1 = analyticalInstrumentsService.save(analyticalInstruments);
180
-                if (save1){
179
+                if (x.getDetectMonitoringFactors()!=null && save1){
181 180
                     List<DetectMonitoringFactor> detectMonitoringFactors = x.getDetectMonitoringFactors();
182 181
                     detectMonitoringFactors.forEach(y->{
183 182
                         y.setAnalyticalInstrumentId(analyticalInstruments.getId());
@@ -212,4 +211,19 @@ public class DataAcquisitionInstrumentController {
212 211
     }
213 212
 
214 213
 
214
+
215
+    /**
216
+     * 获取数采仪信息表
217
+     */
218
+    @GetMapping("/listByCode")
219
+    public AjaxResult listByCode(DataAcquisitionInstrumentVo vo)
220
+    {
221
+        QueryWrapper<DataAcquisitionInstrument> wrapper = new QueryWrapper<>();
222
+        wrapper.eq(vo.getDepartmentCode()!=null,"department_code", vo.getDepartmentCode());
223
+//        wrapper.eq(vo.getCompanyCode()!=null,"company_code", vo.getCompanyCode());
224
+//        List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.listByCode(vo);
225
+        List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.list(wrapper);
226
+        return success(dataAcquisitionInstruments);
227
+    }
228
+
215 229
 }

+ 21 - 0
src/main/java/com/cn/esermis/controller/PreMarkingController.java

@@ -1,5 +1,6 @@
1 1
 package com.cn.esermis.controller;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -7,32 +8,41 @@ import com.cn.esermis.dpld.entity.PreMarking;
7 8
 import com.cn.esermis.dpld.model.AjaxResult;
8 9
 import com.cn.esermis.dpld.model.PreMarkingVo;
9 10
 import com.cn.esermis.dpld.service.IPreMarkingService;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.data.redis.core.RedisTemplate;
10 13
 import org.springframework.web.bind.annotation.*;
11 14
 
12 15
 import javax.annotation.Resource;
16
+import java.util.List;
13 17
 
14 18
 @RestController
15 19
 @RequestMapping("/pre_marking")
16 20
 public class PreMarkingController {
17 21
 
22
+    @Autowired
23
+    private RedisTemplate<String, Object> redisTemplate;
24
+
18 25
     @Resource
19 26
     private IPreMarkingService preMarkingService;
20 27
 
21 28
     @PostMapping("/add")
22 29
     public Object add(@RequestBody PreMarking preMarking) {
23 30
         preMarkingService.save(preMarking);
31
+        sendMessage();
24 32
         return AjaxResult.success("success");
25 33
     }
26 34
 
27 35
     @GetMapping("/del")
28 36
     public Object del(String id) {
29 37
         preMarkingService.removeById(id);
38
+        sendMessage();
30 39
         return AjaxResult.success("success");
31 40
     }
32 41
 
33 42
     @PostMapping("/edit")
34 43
     public Object edit(@RequestBody PreMarking preMarking) {
35 44
         preMarkingService.updateById(preMarking);
45
+        sendMessage();
36 46
         return AjaxResult.success("success");
37 47
     }
38 48
 
@@ -44,7 +54,18 @@ public class PreMarkingController {
44 54
     @GetMapping("/list")
45 55
     public Object list(PreMarkingVo vo) {
46 56
         IPage<PreMarking> page = new Page<>(vo.getPageNum(), vo.getPageSize());
57
+        sendMessage();
47 58
         return AjaxResult.success(preMarkingService.page(page,new QueryWrapper<>(vo)));
48 59
     }
49 60
 
61
+
62
+    public void sendMessage() {
63
+        List<PreMarking> preMarking = preMarkingService.getNewMarking();
64
+        if (preMarking != null){
65
+            preMarking.forEach(x->{
66
+                redisTemplate.opsForValue().set(x.getMnCode(), JSON.toJSONString(x));
67
+            });
68
+        }
69
+    }
70
+
50 71
 }

+ 38 - 2
src/main/java/com/cn/esermis/dpld/business/MonitorBusiness.java

@@ -1,5 +1,6 @@
1 1
 package com.cn.esermis.dpld.business;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
3 4
 import com.alibaba.fastjson2.JSONObject;
4 5
 import com.cn.esermis.constant.Constant;
5 6
 import com.cn.esermis.datawarn.common.ExceptionDataDispose;
@@ -10,10 +11,13 @@ import com.cn.esermis.model.CP;
10 11
 import com.cn.esermis.model.FactorModel;
11 12
 import lombok.extern.log4j.Log4j2;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.data.redis.core.RedisTemplate;
13 15
 import org.springframework.stereotype.Component;
14 16
 
15 17
 import javax.annotation.PostConstruct;
16 18
 import javax.annotation.Resource;
19
+import java.text.ParseException;
20
+import java.text.SimpleDateFormat;
17 21
 import java.util.ArrayList;
18 22
 import java.util.Date;
19 23
 import java.util.List;
@@ -37,7 +41,8 @@ public class MonitorBusiness {
37 41
     private IExcepLogService excepLogService;
38 42
     @Resource
39 43
     private IAirMonitorHourRecordService airMonitorHourRecordService;
40
-
44
+    @Autowired
45
+    private RedisTemplate<String, Object> redisTemplate;
41 46
 
42 47
     private List<OutletAndFactorVo>  dataAcquisitionInstruments =  new ArrayList<>();
43 48
 
@@ -91,6 +96,11 @@ public class MonitorBusiness {
91 96
                         airMonitorMinuteRecord.setZsMin(x.getZsMin());
92 97
                         airMonitorMinuteRecord.setRtd(x.getRtd());
93 98
                         try {
99
+                            airMonitorMinuteRecord.setWorkCondition(sendMessage(factorModel.getDataTime(),factorModel.getMN()));
100
+                        } catch (ParseException e) {
101
+                            throw new RuntimeException(e);
102
+                        }
103
+                        try {
94 104
                             airMonitorMinuteRecord.setIsExceed(exceptionDataDispose.ExceedData(factorModel.getMN(), x.getFactor(), x.getAvg()!=null?x.getAvg().doubleValue():x.getRtd().doubleValue()));
95 105
                             airMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
96 106
                                     x.getMin()!=null?x.getMin().doubleValue():0,
@@ -129,6 +139,11 @@ public class MonitorBusiness {
129 139
                         airMonitorMinuteRecord.setZsMin(x.getZsMin());
130 140
                         airMonitorMinuteRecord.setRtd(x.getRtd());
131 141
                         try {
142
+                            airMonitorMinuteRecord.setWorkCondition(sendMessage(factorModel.getDataTime(),factorModel.getMN()));
143
+                        } catch (ParseException e) {
144
+                            throw new RuntimeException(e);
145
+                        }
146
+                        try {
132 147
                             airMonitorMinuteRecord.setIsExceed(exceptionDataDispose.ExceedData(factorModel.getMN(), x.getFactor(), x.getAvg()!=null?x.getAvg().doubleValue():x.getRtd().doubleValue()));
133 148
                             airMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
134 149
                                     x.getMin()!=null?x.getMin().doubleValue():0,
@@ -209,6 +224,11 @@ public class MonitorBusiness {
209 224
                         waterMonitorMinuteRecord.setFactorFlag(x.getFlag());
210 225
                         waterMonitorMinuteRecord.setRtd(x.getRtd());
211 226
                         try {
227
+                            waterMonitorMinuteRecord.setWorkCondition(sendMessage(factorModel.getDataTime(),factorModel.getMN()));
228
+                        } catch (ParseException e) {
229
+                            throw new RuntimeException(e);
230
+                        }
231
+                        try {
212 232
                             waterMonitorMinuteRecord.setIsExceed(exceptionDataDispose.ExceedData(factorModel.getMN(), x.getFactor(), x.getAvg()!=null?x.getAvg().doubleValue():x.getRtd().doubleValue()));
213 233
                             waterMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
214 234
                                     x.getMin()!=null?x.getMin().doubleValue():0,
@@ -244,6 +264,11 @@ public class MonitorBusiness {
244 264
                         waterMonitorMinuteRecord.setFactorFlag(x.getFlag());
245 265
                         waterMonitorMinuteRecord.setRtd(x.getRtd());
246 266
                         try {
267
+                            waterMonitorMinuteRecord.setWorkCondition(sendMessage(factorModel.getDataTime(),factorModel.getMN()));
268
+                        } catch (ParseException e) {
269
+                            throw new RuntimeException(e);
270
+                        }
271
+                        try {
247 272
                             waterMonitorMinuteRecord.setIsExceed(exceptionDataDispose.ExceedData(factorModel.getMN(), x.getFactor(), x.getAvg()!=null?x.getAvg().doubleValue():x.getRtd().doubleValue()));
248 273
                             waterMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
249 274
                                     x.getMin()!=null?x.getMin().doubleValue():0,
@@ -366,5 +391,16 @@ public class MonitorBusiness {
366 391
         }
367 392
     }
368 393
 
369
-
394
+    public Integer sendMessage(String time,String mn) throws ParseException {
395
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
396
+        Object o = redisTemplate.opsForValue().get(mn);
397
+        if (o != null){
398
+            PreMarking preMarking = JSON.parseObject(o.toString(), PreMarking.class);
399
+            Date date = formatter.parse(time);
400
+            if (preMarking.getStartTime().getTime() >= date.getTime()){
401
+                return preMarking.getWorkingCondition();
402
+            }
403
+        }
404
+        return 1;
405
+    }
370 406
 }

+ 6 - 0
src/main/java/com/cn/esermis/dpld/entity/AirMonitorHourRecord.java

@@ -126,4 +126,10 @@ public class AirMonitorHourRecord {
126 126
 
127 127
     @TableField(value = "is_exceed")
128 128
     private String isExceed;
129
+
130
+    /**
131
+     * 工况
132
+     */
133
+    @TableField(value = "work_condition")
134
+    private Integer workCondition;
129 135
 }

+ 5 - 0
src/main/java/com/cn/esermis/dpld/entity/AirMonitorMinuteRecord.java

@@ -128,5 +128,10 @@ public class AirMonitorMinuteRecord {
128 128
 
129 129
     @TableField(value = "is_exceed")
130 130
     private String isExceed;
131
+    /**
132
+     * 工况
133
+     */
134
+    @TableField(value = "work_condition")
135
+    private Integer workCondition;
131 136
 
132 137
 }

+ 27 - 3
src/main/java/com/cn/esermis/dpld/entity/PreMarking.java

@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import com.baomidou.mybatisplus.annotation.TableField;
5 5
 import com.baomidou.mybatisplus.annotation.TableId;
6 6
 import com.baomidou.mybatisplus.annotation.TableName;
7
+import com.fasterxml.jackson.annotation.JsonFormat;
8
+import com.fasterxml.jackson.databind.annotation.JsonAppend;
7 9
 import lombok.Data;
10
+import org.springframework.format.annotation.DateTimeFormat;
8 11
 
9 12
 import java.util.Date;
10 13
 
@@ -23,10 +26,21 @@ public class PreMarking {
23 26
     @TableId(value = "id", type = IdType.UUID)
24 27
     private String id;
25 28
     /**
26
-     * 点位名称
29
+     * 排污口名称
27 30
      */
28
-    @TableField(value = "point_name")
29
-    private String pointName;
31
+    @TableField(value = "outlet_name")
32
+    private String outletName;
33
+    /**
34
+     * 排污口编号
35
+     */
36
+    @TableField(value = "outlet_code")
37
+    private String outletCode;
38
+
39
+    /**
40
+     * 数采仪MN号
41
+     */
42
+    @TableField(value = "mn_code")
43
+    private String mnCode;
30 44
     /**
31 45
      * 工况类型
32 46
      * 1正常运行、2停运、3启炉、4焖炉、5烘炉、6停炉、7生产设施故障、8自动监控设施故障、9其他
@@ -37,6 +51,8 @@ public class PreMarking {
37 51
      * 开始时间
38 52
      */
39 53
     @TableField(value = "start_time")
54
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
55
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
40 56
     private Date startTime;
41 57
     /**
42 58
      * 原因
@@ -55,5 +71,13 @@ public class PreMarking {
55 71
     @TableField(value = "user_name")
56 72
     private String userName;
57 73
 
74
+    /**
75
+     * 创建时间
76
+     */
77
+    @TableField(value = "create_time")
78
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
79
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
80
+    private Date createTime;
81
+
58 82
 
59 83
 }

+ 5 - 0
src/main/java/com/cn/esermis/dpld/entity/WaterMonitorHourRecord.java

@@ -114,5 +114,10 @@ public class WaterMonitorHourRecord {
114 114
 
115 115
     @TableField(value = "is_exceed")
116 116
     private String isExceed;
117
+    /**
118
+     * 工况
119
+     */
120
+    @TableField(value = "work_condition")
121
+    private Integer workCondition;
117 122
 
118 123
 }

+ 5 - 1
src/main/java/com/cn/esermis/dpld/entity/WaterMonitorMinuteRecord.java

@@ -115,5 +115,9 @@ public class WaterMonitorMinuteRecord {
115 115
     @TableField(value = "is_exceed")
116 116
     private String isExceed;
117 117
 
118
-
118
+    /**
119
+     * 工况
120
+     */
121
+    @TableField(value = "work_condition")
122
+    private Integer workCondition;
119 123
 }

+ 3 - 0
src/main/java/com/cn/esermis/dpld/mapper/DataAcquisitionInstrumentMapper.java

@@ -2,6 +2,7 @@ package com.cn.esermis.dpld.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.cn.esermis.dpld.entity.DataAcquisitionInstrument;
5
+import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
5 6
 import com.cn.esermis.dpld.model.OutletAndFactorVo;
6 7
 import org.apache.ibatis.annotations.MapKey;
7 8
 import org.apache.ibatis.annotations.Mapper;
@@ -23,4 +24,6 @@ public interface DataAcquisitionInstrumentMapper extends BaseMapper<DataAcquisit
23 24
 
24 25
     @MapKey("departmentid")
25 26
     Map<String, Object> getDepartmentMap();
27
+
28
+    List<DataAcquisitionInstrument> listByCode(DataAcquisitionInstrumentVo vo);
26 29
 }

+ 3 - 0
src/main/java/com/cn/esermis/dpld/mapper/PreMarkingMapper.java

@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.cn.esermis.dpld.entity.PreMarking;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 
7
+import java.util.List;
8
+
7 9
 @Mapper
8 10
 public interface PreMarkingMapper extends BaseMapper<PreMarking> {
9 11
 
10 12
 
13
+    List<PreMarking> getNewMarking();
11 14
 }

+ 4 - 0
src/main/java/com/cn/esermis/dpld/service/IDataAcquisitionInstrumentService.java

@@ -2,9 +2,11 @@ package com.cn.esermis.dpld.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.cn.esermis.dpld.entity.DataAcquisitionInstrument;
5
+import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
5 6
 import com.cn.esermis.dpld.model.OutletAndFactorVo;
6 7
 import org.springframework.stereotype.Service;
7 8
 
9
+import java.util.Collection;
8 10
 import java.util.List;
9 11
 import java.util.Map;
10 12
 
@@ -21,4 +23,6 @@ public interface IDataAcquisitionInstrumentService extends IService<DataAcquisit
21 23
     Map<String, Object> getComponyMap();
22 24
 
23 25
     Map<String, Object> getDepartmentMap();
26
+
27
+    List<DataAcquisitionInstrument> listByCode(DataAcquisitionInstrumentVo vo);
24 28
 }

+ 3 - 0
src/main/java/com/cn/esermis/dpld/service/IPreMarkingService.java

@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.cn.esermis.dpld.entity.PreMarking;
5 5
 import org.springframework.stereotype.Service;
6 6
 
7
+import java.util.List;
8
+
7 9
 @Service
8 10
 public interface IPreMarkingService extends IService<PreMarking> {
11
+    List<PreMarking> getNewMarking();
9 12
 }

+ 9 - 0
src/main/java/com/cn/esermis/dpld/service/impl/DataAcquisitionInstrumentServiceImpl.java

@@ -1,13 +1,16 @@
1 1
 package com.cn.esermis.dpld.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 5
 import com.cn.esermis.dpld.entity.DataAcquisitionInstrument;
5 6
 import com.cn.esermis.dpld.mapper.DataAcquisitionInstrumentMapper;
7
+import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
6 8
 import com.cn.esermis.dpld.model.OutletAndFactorVo;
7 9
 import com.cn.esermis.dpld.service.IDataAcquisitionInstrumentService;
8 10
 import org.springframework.stereotype.Service;
9 11
 
10 12
 import javax.annotation.Resource;
13
+import java.util.Collection;
11 14
 import java.util.Collections;
12 15
 import java.util.List;
13 16
 import java.util.Map;
@@ -43,4 +46,10 @@ public class DataAcquisitionInstrumentServiceImpl extends ServiceImpl<DataAcquis
43 46
     public Map<String, Object> getDepartmentMap() {
44 47
         return mapper.getDepartmentMap();
45 48
     }
49
+
50
+    @Override
51
+    public List<DataAcquisitionInstrument> listByCode(DataAcquisitionInstrumentVo vo) {
52
+        List<DataAcquisitionInstrument> dataAcquisitionInstruments = mapper.listByCode(vo);
53
+        return dataAcquisitionInstruments;
54
+    }
46 55
 }

+ 12 - 0
src/main/java/com/cn/esermis/dpld/service/impl/PreMarkingImpl.java

@@ -6,6 +6,18 @@ import com.cn.esermis.dpld.mapper.PreMarkingMapper;
6 6
 import com.cn.esermis.dpld.service.IPreMarkingService;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import javax.annotation.Resource;
10
+import java.util.List;
11
+
9 12
 @Service
10 13
 public class PreMarkingImpl extends ServiceImpl<PreMarkingMapper, PreMarking> implements IPreMarkingService {
14
+
15
+    @Resource
16
+    private PreMarkingMapper preMarkingMapper;
17
+
18
+
19
+    @Override
20
+    public List<PreMarking> getNewMarking() {
21
+        return preMarkingMapper.getNewMarking();
22
+    }
11 23
 }

+ 4 - 4
src/main/resources/application.yml

@@ -46,10 +46,10 @@ mybatis-plus:
46 46
   mapper-locations: classpath:static/**/*.xml
47 47
   configuration:
48 48
     log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl # 指定 MyBatis 使用 SLF4J 日志实现
49
-logging:
50
-  level:
51
-    cnooc.esermis: DEBUG
52
-    com.baomidou.mybatisplus.core.mapper: debug # 设置 Mapper 接口的日志级别为 DEBUG
49
+#logging:
50
+#  level:
51
+#    cnooc.esermis: DEBUG
52
+#    com.baomidou.mybatisplus.core.mapper: debug # 设置 Mapper 接口的日志级别为 DEBUG
53 53
   ## 工程设置
54 54
 #project:
55 55
 #  debug: false

+ 14 - 0
src/main/resources/static/mybatis/DataAcquisitionInstrumentMapper.xml

@@ -27,5 +27,19 @@
27 27
         SELECT t.departmentid,t.departmentname
28 28
         FROM department t
29 29
     </select>
30
+    <select id="listByCode" resultType="com.cn.esermis.dpld.entity.DataAcquisitionInstrument"
31
+            parameterType="com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo">
32
+        SELECT t.id,t.outlet_name `outletName`,t.outlet_code `outletCode`,t.type,t.use_data `useData`,t.complete_filings `completeFilings`,t.complete_filings_time `completeFilingsTime`,t.collection_name `collectionName`,t.collection_brand `collectionBrand`,t.collection_model `collectionModel`,t.mn_code `mnCode`,t.collection_ip `collectionIp`,t.company_code `companyCode`,t.department_code `departmentCode`,t.have_exhaust
33
+        `haveExhaust`,t.exhaust_temperature `exhaustTemperature`,t.exhaust_height `exhaustHeight`,t.exhaust_diameter `exhaustDiameter`
34
+        FROM data_acquisition_instrument t
35
+        <where>
36
+            <if test="companyCode != null and companyCode != ''">
37
+                AND t.company_code = #{companyCode}
38
+            </if>
39
+            <if test="departmentCode != null and departmentCode != ''">
40
+                AND t.department_code = #{departmentCode}
41
+            </if>
42
+        </where>
43
+    </select>
30 44
 </mapper>
31 45
 

+ 17 - 0
src/main/resources/static/mybatis/PreMarkingMapper.xml

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.cn.esermis.dpld.mapper.PreMarkingMapper">
6
+
7
+    <select id="getNewMarking" resultType="com.cn.esermis.dpld.entity.PreMarking">
8
+        SELECT a.*
9
+        FROM pre_marking a
10
+                 JOIN (
11
+            SELECT mn_code, MAX(start_time) as max_date
12
+            FROM pre_marking
13
+            GROUP BY mn_code
14
+        ) b ON a.mn_code = b.mn_code AND a.start_time = b.max_date
15
+    </select>
16
+</mapper>
17
+