From b41f303340d8c21dad9e1b2fd798a0957e7fd7d1 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Fri, 01 Dec 2017 09:32:32 +0800
Subject: [PATCH] 大屏 接口
---
src/main/java/com/moral/entity/Organization.java | 106 -
src/main/java/com/moral/common/mapper/BaseMapper.java | 2
src/main/java/com/moral/common/util/WebUtils.java | 2
src/main/java/com/moral/mapper/OrganizationRelationMapper.java | 1
src/main/java/com/moral/controller/ReportController.java | 75
src/main/java/com/moral/mapper/HistoryMapper.java | 26
pom.xml | 20
src/main/java/com/moral/service/impl/DeviceServiceImpl.java | 12
src/main/resources/system/alarmLevels.json | 93
src/main/java/com/moral/mapper/AccountMapper.java | 1
src/main/java/com/moral/service/DeviceService.java | 5
src/main/java/com/moral/common/util/ExportExcelUtils.java | 106 +
src/main/java/com/moral/entity/DeviceExample.java | 1591 ++++++++++----------
src/main/java/com/moral/entity/OperateUser.java | 90 -
src/main/java/com/moral/mapper/DeviceMapper.java | 9
src/main/resources/mapper/HistoryMapper.xml | 440 +----
src/main/java/com/moral/controller/ScreenController.java | 180 -
src/main/java/com/moral/service/AccountService.java | 3
src/main/java/com/moral/service/impl/AccountServiceImpl.java | 52
src/main/resources/mapper/DeviceMapper.xml | 772 +++++----
src/main/java/com/moral/common/util/RedisUtil.java | 2
src/main/java/com/moral/common/bean/ResultBean.java | 40
src/main/java/com/moral/common/exception/BusinessException.java | 2
src/main/java/com/moral/entity/Account.java | 83 -
src/main/java/com/moral/entity/Device.java | 181 -
/dev/null | 443 -----
src/main/java/com/moral/service/HistoryService.java | 7
src/main/java/com/moral/service/impl/HistoryServiceImpl.java | 110 +
src/main/java/com/moral/common/bean/Constants.java | 3
src/main/java/com/moral/common/util/CalculateUtils.java | 2
src/main/java/com/moral/entity/OrganizationRelation.java | 26
src/main/java/com/moral/mapper/OperateUserMapper.java | 1
src/main/java/com/moral/common/aop/ControllerAOP.java | 48
src/main/java/com/moral/common/util/Crypto.java | 2
src/main/java/com/moral/common/util/ResourceUtil.java | 2
src/main/java/com/moral/service/impl/OrganizationServiceImpl.java | 5
src/main/java/com/moral/mapper/OrganizationMapper.java | 1
37 files changed, 1,990 insertions(+), 2,554 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4a7576c..46215af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,26 @@
<artifactId>fastjson</artifactId>
<version>1.2.39</version>
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.jexcelapi</groupId>
+ <artifactId>jxl</artifactId>
+ <version>2.6.12</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.16.18</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-aop</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/src/main/java/com/moral/common/aop/ControllerAOP.java b/src/main/java/com/moral/common/aop/ControllerAOP.java
new file mode 100644
index 0000000..bd542c7
--- /dev/null
+++ b/src/main/java/com/moral/common/aop/ControllerAOP.java
@@ -0,0 +1,48 @@
+package com.moral.common.aop;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+import com.moral.common.exception.BusinessException;
+
+import lombok.extern.log4j.Log4j;
+
+@Log4j
+@Aspect
+@Component
+public class ControllerAOP {
+
+ @Around("execution(* com.moral.controller.*Controller.*(..))")
+ public Object handlerControllerMethod(ProceedingJoinPoint pjp) {
+ long startTime = System.currentTimeMillis();
+ Map<String, Object> result;
+ try {
+ result = (Map<String, Object>) pjp.proceed();
+ log.info(pjp.getSignature() + "use time:" + (System.currentTimeMillis() - startTime));
+ } catch (Throwable e) {
+ result = handlerException(pjp, e);
+ }
+
+ return result;
+ }
+
+ private Map<String, Object> handlerException(ProceedingJoinPoint pjp, Throwable e) {
+ Map<String, Object> result = new HashMap<String, Object>();
+
+ // ������������
+ if (e instanceof BusinessException) {
+ result.put("msg", e.getLocalizedMessage());
+ } else {
+ log.error(pjp.getSignature() + " error ", e);
+ result.put("msg", e.toString());
+ //TODO ������������������������������������������������������������������
+ }
+
+ return result;
+ }
+}
diff --git a/src/main/java/com/moral/util/Constants.java b/src/main/java/com/moral/common/bean/Constants.java
similarity index 84%
rename from src/main/java/com/moral/util/Constants.java
rename to src/main/java/com/moral/common/bean/Constants.java
index b693490..071f5c3 100644
--- a/src/main/java/com/moral/util/Constants.java
+++ b/src/main/java/com/moral/common/bean/Constants.java
@@ -1,6 +1,5 @@
-package com.moral.util;
+package com.moral.common.bean;
-// TODO: Auto-generated Javadoc
/**
* ������������.
*/
diff --git a/src/main/java/com/moral/common/bean/ResultBean.java b/src/main/java/com/moral/common/bean/ResultBean.java
new file mode 100644
index 0000000..6506493
--- /dev/null
+++ b/src/main/java/com/moral/common/bean/ResultBean.java
@@ -0,0 +1,40 @@
+package com.moral.common.bean;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+public class ResultBean<T>implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int FAIL = 0;
+ public static final int SUCCESS = 1;
+ public static final int NO_PERMISSION = 2;
+ private String msg = "success";
+ private int code = SUCCESS;
+ private T data;
+ public ResultBean() {
+ super();
+ }
+ public ResultBean(T data) {
+ super();
+ this.data = data;
+ }
+
+ public ResultBean(Throwable e) {
+ super();
+ this.msg = e.toString();
+ this.code = FAIL;
+ }
+ public ResultBean(String msg, int code) {
+ super();
+ this.msg = msg;
+ this.code = code;
+ }
+ public ResultBean(int code) {
+ super();
+ this.code = code;
+ }
+}
diff --git a/src/main/java/com/moral/util/BusinessException.java b/src/main/java/com/moral/common/exception/BusinessException.java
similarity index 83%
rename from src/main/java/com/moral/util/BusinessException.java
rename to src/main/java/com/moral/common/exception/BusinessException.java
index 68cc526..4e41a98 100644
--- a/src/main/java/com/moral/util/BusinessException.java
+++ b/src/main/java/com/moral/common/exception/BusinessException.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.exception;
public class BusinessException extends RuntimeException {
diff --git a/src/main/java/com/moral/mapper/BaseMapper.java b/src/main/java/com/moral/common/mapper/BaseMapper.java
similarity index 96%
rename from src/main/java/com/moral/mapper/BaseMapper.java
rename to src/main/java/com/moral/common/mapper/BaseMapper.java
index 8df23db..20a1454 100644
--- a/src/main/java/com/moral/mapper/BaseMapper.java
+++ b/src/main/java/com/moral/common/mapper/BaseMapper.java
@@ -1,4 +1,4 @@
-package com.moral.mapper;
+package com.moral.common.mapper;
import java.io.Serializable;
import java.util.List;
diff --git a/src/main/java/com/moral/util/CalculateUtils.java b/src/main/java/com/moral/common/util/CalculateUtils.java
similarity index 88%
rename from src/main/java/com/moral/util/CalculateUtils.java
rename to src/main/java/com/moral/common/util/CalculateUtils.java
index 71743a1..bae80f5 100644
--- a/src/main/java/com/moral/util/CalculateUtils.java
+++ b/src/main/java/com/moral/common/util/CalculateUtils.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.util;
public class CalculateUtils {
diff --git a/src/main/java/com/moral/util/Crypto.java b/src/main/java/com/moral/common/util/Crypto.java
similarity index 96%
rename from src/main/java/com/moral/util/Crypto.java
rename to src/main/java/com/moral/common/util/Crypto.java
index 09f827c..2a8be1a 100644
--- a/src/main/java/com/moral/util/Crypto.java
+++ b/src/main/java/com/moral/common/util/Crypto.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.util;
import sun.misc.BASE64Encoder;
diff --git a/src/main/java/com/moral/common/util/ExportExcelUtils.java b/src/main/java/com/moral/common/util/ExportExcelUtils.java
new file mode 100644
index 0000000..1f9862e
--- /dev/null
+++ b/src/main/java/com/moral/common/util/ExportExcelUtils.java
@@ -0,0 +1,106 @@
+package com.moral.common.util;
+
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+
+import jxl.Workbook;
+import jxl.write.Label;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+import jxl.write.WriteException;
+import jxl.write.biff.RowsExceededException;
+import net.sf.json.JSONObject;
+
+@SuppressWarnings("rawtypes")
+public class ExportExcelUtils {
+
+ public static OutputStream exportData(HttpServletResponse response, String fileName, List list,String[][] exportColumn)
+ throws Exception {
+
+ // ���������������������
+ String excelFileName = fileName + ".xls";
+
+ OutputStream outputStream = response.getOutputStream();
+ // ���������������������
+ response.setHeader("Content-Type", "application/force-download");
+ // ������������������������������������������������
+ response.setHeader("Content-Disposition", "attachment; filename=\""
+ + new String(excelFileName.getBytes("gb2312"), "ISO8859-1")
+ + "\"");
+ // ������excel������
+ exportExcel(outputStream,list, getColumn(exportColumn),getName(exportColumn), fileName);
+
+ return outputStream;
+ }
+
+ public static void exportExcel(OutputStream os, List list, String[] colTitles, String[] fieldNames, String fileName) throws Exception {
+ WritableWorkbook wwb = Workbook.createWorkbook(os);
+
+ createSheet(wwb, fileName, 0, list, colTitles, fieldNames);
+
+ wwb.write();
+ wwb.close();
+ }
+
+ private static void createSheet(WritableWorkbook wwb, String sheetName, int index, List list, String[] colTitles,
+ String[] fieldNames)
+ throws RowsExceededException, WriteException, UnsupportedEncodingException {
+
+ WritableSheet ws = wwb.createSheet(sheetName, index);
+ // ������������������
+ WritableFont font = new WritableFont(WritableFont.createFont("������"), 10, WritableFont.BOLD);
+ WritableCellFormat wcf = new WritableCellFormat(font);
+
+ for (int i = 0; i < colTitles.length; i++) {
+ String title = colTitles[i];
+ ws.addCell(new Label(i, 0, title.split(",")[0], wcf));
+ ws.setColumnView(i, Integer.valueOf(title.split(",")[1]));
+ }
+ for (int i = 0; i < list.size(); i++) {
+ JSONObject jsonObject = JSONObject.fromObject(list.get(i));
+ for (int j = 0; j < colTitles.length; j++) {
+ ws.addCell(new Label(j, i + 1, jsonObject.getString(fieldNames[j])));
+ }
+ }
+ }
+
+ /**
+ * ������������ ��������� ��� ���������
+ *
+ * @return
+ */
+ public static String[] getColumn(String[][] exportColumn) {
+ if (exportColumn != null) {
+ String[] result = new String[exportColumn.length];
+ for (int i = 0; i < exportColumn.length; i++) {
+ result[i] = exportColumn[i][0] + "," + exportColumn[i][1];
+ }
+ return result;
+ } else {
+ return new String[0];
+ }
+ }
+
+ /**
+ * ������ ���������������
+ *
+ * @return
+ */
+ public static String[] getName(String[][] exportColumn) {
+ if (exportColumn != null) {
+ String[] result = new String[exportColumn.length];
+ for (int i = 0; i < exportColumn.length; i++) {
+ result[i] = exportColumn[i][2];
+ }
+ return result;
+ } else {
+ return new String[0];
+ }
+ }
+
+}
diff --git a/src/main/java/com/moral/util/RedisUtil.java b/src/main/java/com/moral/common/util/RedisUtil.java
similarity index 96%
rename from src/main/java/com/moral/util/RedisUtil.java
rename to src/main/java/com/moral/common/util/RedisUtil.java
index 3092485..87b55df 100644
--- a/src/main/java/com/moral/util/RedisUtil.java
+++ b/src/main/java/com/moral/common/util/RedisUtil.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.util;
import java.util.Set;
import java.util.concurrent.TimeUnit;
diff --git a/src/main/java/com/moral/util/ResourceUtil.java b/src/main/java/com/moral/common/util/ResourceUtil.java
similarity index 92%
rename from src/main/java/com/moral/util/ResourceUtil.java
rename to src/main/java/com/moral/common/util/ResourceUtil.java
index 14e640e..7c64fb2 100644
--- a/src/main/java/com/moral/util/ResourceUtil.java
+++ b/src/main/java/com/moral/common/util/ResourceUtil.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.util;
import java.util.ResourceBundle;
diff --git a/src/main/java/com/moral/util/WebUtils.java b/src/main/java/com/moral/common/util/WebUtils.java
similarity index 97%
rename from src/main/java/com/moral/util/WebUtils.java
rename to src/main/java/com/moral/common/util/WebUtils.java
index ce1d302..fc167c0 100644
--- a/src/main/java/com/moral/util/WebUtils.java
+++ b/src/main/java/com/moral/common/util/WebUtils.java
@@ -1,4 +1,4 @@
-package com.moral.util;
+package com.moral.common.util;
import java.util.Enumeration;
import java.util.Map;
diff --git a/src/main/java/com/moral/controller/ReportController.java b/src/main/java/com/moral/controller/ReportController.java
new file mode 100644
index 0000000..73c0897
--- /dev/null
+++ b/src/main/java/com/moral/controller/ReportController.java
@@ -0,0 +1,75 @@
+package com.moral.controller;
+
+import static com.moral.common.util.ExportExcelUtils.exportData;
+import static com.moral.common.util.WebUtils.getParametersStartingWith;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import static org.springframework.util.ObjectUtils.*;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.moral.common.exception.BusinessException;
+import com.moral.service.DeviceService;
+import com.moral.service.HistoryService;
+
+@RestController
+@RequestMapping(value = "report")
+@CrossOrigin(origins = "*", maxAge = 3600)
+public class ReportController {
+
+ @Autowired
+ private HistoryService historyService;
+
+ @Autowired
+ private DeviceService deviceService;
+
+ @GetMapping("sensors-average")
+ public Map<String, Object> getSensorsAverageByDevice(HttpServletRequest request,HttpServletResponse response) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ try {
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ Object mac = parameters.get("mac");
+ Object time = parameters.get("time");
+ Object type = parameters.get("type");
+ if (isEmpty(mac) || isEmpty(time) || isEmpty(type)) {
+ result.put("msg", "���������������������");
+ } else {
+ List<Map<String, Object>> sensors = deviceService.getSensorsByDevice(mac.toString());
+ List<Map<String, Object>> sensorsAverage = historyService.getSensorsAverageByDevice4Report(parameters,sensors);
+ if (isEmpty(sensorsAverage)) {
+ result.put("msg", "���������������");
+ } else {
+ String[][] exportColumn = new String[sensors.size() + 1][];
+ exportColumn[0] = new String[] { "������", "20", "time" };
+ for (int i = 0; i < sensors.size(); i++) {
+ String name = (String) sensors.get(i).get("name");
+ String key = (String) sensors.get(i).get("key");
+ exportColumn[i + 1] = new String[] { name, "10", key };
+ }
+
+ OutputStream outputStream = exportData(response, time + "_" + mac + "_" + type, sensorsAverage, exportColumn);
+ outputStream.flush();
+ outputStream.close();
+ }
+ }
+ } catch (BusinessException be) {
+ be.printStackTrace();
+ result.put("msg", be.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ result.put("msg", "���������������������������������������������������"+e.getMessage());
+ }
+ return result;
+ }
+
+}
diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index 01c7c41..893bd61 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -1,5 +1,11 @@
package com.moral.controller;
+import static com.moral.common.util.RedisUtil.get;
+import static com.moral.common.util.RedisUtil.hasKey;
+import static com.moral.common.util.ResourceUtil.getValue;
+import static com.moral.common.util.WebUtils.getParametersStartingWith;
+import static org.springframework.util.ObjectUtils.isEmpty;
+
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
@@ -12,24 +18,22 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONReader;
import com.alibaba.fastjson.TypeReference;
-import com.moral.util.ResourceUtil;
+import com.moral.common.bean.ResultBean;
+import com.moral.common.exception.BusinessException;
+import com.moral.entity.Account;
import com.moral.service.AccountService;
import com.moral.service.DeviceService;
import com.moral.service.HistoryService;
-import com.moral.util.BusinessException;
-import com.moral.util.RedisUtil;
-import com.moral.util.WebUtils;
-// TODO: Auto-generated Javadoc
/**
* The Class ScreenController.
*/
@@ -68,23 +72,34 @@
* the request
* @return the map
*/
- @RequestMapping(value = "login", method = RequestMethod.GET)
+ @GetMapping("login")
public Map<String, Object> screenLogin(HttpServletRequest request) {
Map<String, Object> resultMap = new HashMap<String, Object>();
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!(parameters.containsKey("account") && parameters.containsKey("password"))) {
+ resultMap.put("msg", "������������������������������������");
+ resultMap.put("accountId", -1);
+ } else {
+ resultMap = accountService.screenLogin(parameters);
+ }
+ return resultMap;
+ }
+
+ @GetMapping("login1")
+ public ResultBean<Account> screenLogin1(HttpServletRequest request) {
+ ResultBean<Account> resultBean = new ResultBean<Account>(ResultBean.FAIL);
try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
if (!(parameters.containsKey("account") && parameters.containsKey("password"))) {
- resultMap.put("msg", "������������������������������������");
- resultMap.put("accountId", -1);
+ resultBean.setMsg("������������������������������������");
} else {
- resultMap = accountService.screenLogin(parameters);
+ resultBean = accountService.screenLogin1(parameters);
}
} catch (Exception e) {
e.printStackTrace();
- resultMap.put("accountId", -1);
- resultMap.put("msg", "���������������������������������������������������" + e.getMessage());
+ resultBean = new ResultBean<Account>(e);
}
- return resultMap;
+ return resultBean;
}
/**
@@ -94,22 +109,14 @@
* the request
* @return the equipment states
*/
- @RequestMapping(value = "equipment-state", method = RequestMethod.GET)
- public Map<String, Object> getDeviceStates(HttpServletRequest request) {
+ @GetMapping("equipment-state")
+ public Map<String, Object> getDeviceStatesByAccount(HttpServletRequest request) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
- try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- if (!parameters.containsKey("accountId")) {
- result.put("msg", "���������������������");
- } else {
- result = deviceService.getDeviceStates(parameters);
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!parameters.containsKey("accountId")) {
+ result.put("msg", "���������������������");
+ } else {
+ result = deviceService.getDeviceStatesByAccount(parameters);
}
return result;
}
@@ -122,12 +129,12 @@
* @return the alarm levels
*/
@SuppressWarnings("resource")
- @RequestMapping(value = "alarm-levels", method = RequestMethod.GET)
+ @GetMapping("alarm-levels")
public Map<String, Object> getAlarmLevels(HttpServletRequest request) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
try {
- if (RedisUtil.hasKey(redisTemplate, levelKey)) {
- String levelConfigStr = RedisUtil.get(redisTemplate, levelKey);
+ if (hasKey(redisTemplate, levelKey)) {
+ String levelConfigStr = get(redisTemplate, levelKey);
result = JSON.parseObject(levelConfigStr, new TypeReference<Map<String, Object>>() {});
} else {
InputStreamReader reader = new InputStreamReader(resource.getInputStream());
@@ -147,22 +154,13 @@
* the request
* @return the standard by sensor
*/
- @RequestMapping(value = "sensor-standard", method = RequestMethod.GET)
- public Map<String, Object> getStandardBySensor(HttpServletRequest request) {
+ @GetMapping("sensor-standard")
+ public Map<String, Object> getStandardBySensor(@RequestParam("macKey") String macKey) {
Map<String, Object> result = new HashMap<String, Object>();
- try {
- String macKey = request.getParameter("macKey");
- if (ObjectUtils.isEmpty(macKey)) {
- result.put("msg", "���������������������");
- } else {
- result.put("standard", ResourceUtil.getValue(macKey + "-standard"));
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ if (isEmpty(macKey)) {
+ throw new BusinessException("���������������������");
+ } else {
+ result.put("standard", getValue(macKey + "-standard"));
}
return result;
}
@@ -174,22 +172,14 @@
* the request
* @return the day AQI by sensor
*/
- @RequestMapping(value = "day-aqi", method = RequestMethod.GET)
+ @GetMapping("day-aqi")
public Map<String, Object> getDayAQIByDevice(HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
- try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- if (!parameters.containsKey("mac")) {
- result.put("msg", "���������������������");
- } else {
- result = historyService.getDayAQIByDevice(parameters);
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!parameters.containsKey("mac")) {
+ result.put("msg", "���������������������");
+ } else {
+ result = historyService.getDayAQIByDevice(parameters);
}
return result;
}
@@ -201,22 +191,14 @@
* the request
* @return the average by all
*/
- @RequestMapping(value = "/all-average", method = RequestMethod.GET)
- public Map<String, Object> getAverageByAll(HttpServletRequest request) {
+ @GetMapping("all-average")
+ public Map<String, Object> getAllSensorAverageByDevice(HttpServletRequest request) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
- try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId"))) {
- result.put("msg", "���������������������");
- } else {
- result = historyService.getAverageByAll(parameters);
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId"))) {
+ result.put("msg", "���������������������");
+ } else {
+ result = historyService.getAllSensorAverageByDevice(parameters);
}
return result;
}
@@ -228,23 +210,15 @@
* the request
* @return the average by sensor
*/
- @RequestMapping(value = "/sensor-average", method = RequestMethod.GET)
- public Map<String, Object> getAverageBySensor(HttpServletRequest request) {
+ @GetMapping("sensor-average")
+ public Map<String, Object> getDeviceRankingBySensorAverage(HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
- try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId")
- && parameters.containsKey("macKey"))) {
- result.put("msg", "���������������������");
- } else {
- result = historyService.getAverageBySensor(parameters);
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId")
+ && parameters.containsKey("macKey"))) {
+ result.put("msg", "���������������������");
+ } else {
+ result = historyService.getDeviceRankingBySensorAverage(parameters);
}
return result;
}
@@ -256,22 +230,14 @@
* the request
* @return the month average by sensor
*/
- @RequestMapping(value = "month-sensor-average", method = RequestMethod.GET)
+ @GetMapping("month-sensor-average")
public Map<String, Object> getMonthAverageBySensor(HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
- try {
- Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- if (!(parameters.containsKey("mac") && parameters.containsKey("macKey"))) {
- result.put("msg", "���������������������");
- } else {
- result = historyService.getMonthAverageBySensor(parameters);
- }
- } catch (BusinessException be) {
- be.printStackTrace();
- result.put("msg", be.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- result.put("msg", "���������������������������������������������������" + e.getMessage());
+ Map<String, Object> parameters = getParametersStartingWith(request, null);
+ if (!(parameters.containsKey("mac") && parameters.containsKey("macKey"))) {
+ result.put("msg", "���������������������");
+ } else {
+ result = historyService.getMonthAverageBySensor(parameters);
}
return result;
}
diff --git a/src/main/java/com/moral/entity/Account.java b/src/main/java/com/moral/entity/Account.java
index 813c62d..c94b61e 100644
--- a/src/main/java/com/moral/entity/Account.java
+++ b/src/main/java/com/moral/entity/Account.java
@@ -2,6 +2,9 @@
import java.util.Date;
+import lombok.Data;
+
+@Data
public class Account {
private Integer id;
@@ -22,85 +25,5 @@
private Date createTime;
private Date expireTime;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getAccountName() {
- return accountName;
- }
-
- public void setAccountName(String accountName) {
- this.accountName = accountName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Integer getOrganizationId() {
- return organizationId;
- }
-
- public void setOrganizationId(Integer organizationId) {
- this.organizationId = organizationId;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getMobile() {
- return mobile;
- }
-
- public void setMobile(String mobile) {
- this.mobile = mobile;
- }
-
- public String getWeixin() {
- return weixin;
- }
-
- public void setWeixin(String weixin) {
- this.weixin = weixin;
- }
-
- public String getIsDelete() {
- return isDelete;
- }
-
- public void setIsDelete(String isDelete) {
- this.isDelete = isDelete;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getExpireTime() {
- return expireTime;
- }
-
- public void setExpireTime(Date expireTime) {
- this.expireTime = expireTime;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/Device.java b/src/main/java/com/moral/entity/Device.java
index 4b8d053..83a0858 100644
--- a/src/main/java/com/moral/entity/Device.java
+++ b/src/main/java/com/moral/entity/Device.java
@@ -2,124 +2,67 @@
import java.util.Date;
-public class Device {
- private Integer id;
+import lombok.Data;
- private String name;
-
- private String address;
-
- private Float longitude;
-
- private Float latitude;
-
- private String mac;
-
- private String state;
-
- private Integer operateUserId;
-
- private Date createTime;
-
- private Date installTime;
-
- private Integer monitorPointId;
-
- private Integer deviceVersionId;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public Float getLongitude() {
- return longitude;
- }
-
- public void setLongitude(Float longitude) {
- this.longitude = longitude;
- }
-
- public Float getLatitude() {
- return latitude;
- }
-
- public void setLatitude(Float latitude) {
- this.latitude = latitude;
- }
-
- public String getMac() {
- return mac;
- }
-
- public void setMac(String mac) {
- this.mac = mac;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public Integer getOperateUserId() {
- return operateUserId;
- }
-
- public void setOperateUserId(Integer operateUserId) {
- this.operateUserId = operateUserId;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getInstallTime() {
- return installTime;
- }
-
- public void setInstallTime(Date installTime) {
- this.installTime = installTime;
- }
-
- public Integer getMonitorPointId() {
- return monitorPointId;
- }
-
- public void setMonitorPointId(Integer monitorPointId) {
- this.monitorPointId = monitorPointId;
- }
-
- public Integer getDeviceVersionId() {
- return deviceVersionId;
- }
-
- public void setDeviceVersionId(Integer deviceVersionId) {
- this.deviceVersionId = deviceVersionId;
- }
+@Data
+public class Device {/**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.id
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Integer id;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.name
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private String name;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.address
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private String address;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.longitude
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Float longitude;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.latitude
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Float latitude;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.mac
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private String mac;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.operate_user_id
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Integer operateUserId;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.state
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private String state;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.create_time
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Date createTime;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.install_time
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Date installTime;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.monitor_point_id
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Integer monitorPointId;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column device.device_version_id
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ private Integer deviceVersionId;
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/DeviceExample.java b/src/main/java/com/moral/entity/DeviceExample.java
index e5966e5..756e5fe 100644
--- a/src/main/java/com/moral/entity/DeviceExample.java
+++ b/src/main/java/com/moral/entity/DeviceExample.java
@@ -5,957 +5,1016 @@
import java.util.List;
public class DeviceExample {
- protected String orderByClause;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ protected String orderByClause;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ protected boolean distinct;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ protected List<Criteria> oredCriteria;
- protected boolean distinct;
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public DeviceExample() {
+ oredCriteria = new ArrayList<Criteria>();
+ }
- protected List<Criteria> oredCriteria;
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public void setOrderByClause(String orderByClause) {
+ this.orderByClause = orderByClause;
+ }
- public DeviceExample() {
- oredCriteria = new ArrayList<Criteria>();
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public String getOrderByClause() {
+ return orderByClause;
+ }
- public void setOrderByClause(String orderByClause) {
- this.orderByClause = orderByClause;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public void setDistinct(boolean distinct) {
+ this.distinct = distinct;
+ }
- public String getOrderByClause() {
- return orderByClause;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public boolean isDistinct() {
+ return distinct;
+ }
- public void setDistinct(boolean distinct) {
- this.distinct = distinct;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public List<Criteria> getOredCriteria() {
+ return oredCriteria;
+ }
- public boolean isDistinct() {
- return distinct;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public void or(Criteria criteria) {
+ oredCriteria.add(criteria);
+ }
- public List<Criteria> getOredCriteria() {
- return oredCriteria;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public Criteria or() {
+ Criteria criteria = createCriteriaInternal();
+ oredCriteria.add(criteria);
+ return criteria;
+ }
- public void or(Criteria criteria) {
- oredCriteria.add(criteria);
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public Criteria createCriteria() {
+ Criteria criteria = createCriteriaInternal();
+ if (oredCriteria.size() == 0) {
+ oredCriteria.add(criteria);
+ }
+ return criteria;
+ }
- public Criteria or() {
- Criteria criteria = createCriteriaInternal();
- oredCriteria.add(criteria);
- return criteria;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ protected Criteria createCriteriaInternal() {
+ Criteria criteria = new Criteria();
+ return criteria;
+ }
- public Criteria createCriteria() {
- Criteria criteria = createCriteriaInternal();
- if (oredCriteria.size() == 0) {
- oredCriteria.add(criteria);
- }
- return criteria;
- }
+ /**
+ * This method was generated by MyBatis Generator. This method corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public void clear() {
+ oredCriteria.clear();
+ orderByClause = null;
+ distinct = false;
+ }
- protected Criteria createCriteriaInternal() {
- Criteria criteria = new Criteria();
- return criteria;
- }
+ /**
+ * This class was generated by MyBatis Generator. This class corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ protected abstract static class GeneratedCriteria {
+ protected List<Criterion> criteria;
- public void clear() {
- oredCriteria.clear();
- orderByClause = null;
- distinct = false;
- }
+ protected GeneratedCriteria() {
+ super();
+ criteria = new ArrayList<Criterion>();
+ }
- protected abstract static class GeneratedCriteria {
- protected List<Criterion> criteria;
+ public boolean isValid() {
+ return criteria.size() > 0;
+ }
- protected GeneratedCriteria() {
- super();
- criteria = new ArrayList<Criterion>();
- }
+ public List<Criterion> getAllCriteria() {
+ return criteria;
+ }
- public boolean isValid() {
- return criteria.size() > 0;
- }
+ public List<Criterion> getCriteria() {
+ return criteria;
+ }
- public List<Criterion> getAllCriteria() {
- return criteria;
- }
+ protected void addCriterion(String condition) {
+ if (condition == null) {
+ throw new RuntimeException("Value for condition cannot be null");
+ }
+ criteria.add(new Criterion(condition));
+ }
- public List<Criterion> getCriteria() {
- return criteria;
- }
+ protected void addCriterion(String condition, Object value, String property) {
+ if (value == null) {
+ throw new RuntimeException("Value for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value));
+ }
- protected void addCriterion(String condition) {
- if (condition == null) {
- throw new RuntimeException("Value for condition cannot be null");
- }
- criteria.add(new Criterion(condition));
- }
+ protected void addCriterion(String condition, Object value1, Object value2, String property) {
+ if (value1 == null || value2 == null) {
+ throw new RuntimeException("Between values for " + property + " cannot be null");
+ }
+ criteria.add(new Criterion(condition, value1, value2));
+ }
- protected void addCriterion(String condition, Object value, String property) {
- if (value == null) {
- throw new RuntimeException("Value for " + property + " cannot be null");
- }
- criteria.add(new Criterion(condition, value));
- }
+ public Criteria andIdIsNull() {
+ addCriterion("id is null");
+ return (Criteria) this;
+ }
- protected void addCriterion(String condition, Object value1, Object value2, String property) {
- if (value1 == null || value2 == null) {
- throw new RuntimeException("Between values for " + property + " cannot be null");
- }
- criteria.add(new Criterion(condition, value1, value2));
- }
+ public Criteria andIdIsNotNull() {
+ addCriterion("id is not null");
+ return (Criteria) this;
+ }
- public Criteria andIdIsNull() {
- addCriterion("id is null");
- return (Criteria) this;
- }
+ public Criteria andIdEqualTo(Integer value) {
+ addCriterion("id =", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdIsNotNull() {
- addCriterion("id is not null");
- return (Criteria) this;
- }
+ public Criteria andIdNotEqualTo(Integer value) {
+ addCriterion("id <>", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdEqualTo(Integer value) {
- addCriterion("id =", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdGreaterThan(Integer value) {
+ addCriterion("id >", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdNotEqualTo(Integer value) {
- addCriterion("id <>", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("id >=", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdGreaterThan(Integer value) {
- addCriterion("id >", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdLessThan(Integer value) {
+ addCriterion("id <", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdGreaterThanOrEqualTo(Integer value) {
- addCriterion("id >=", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdLessThanOrEqualTo(Integer value) {
+ addCriterion("id <=", value, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdLessThan(Integer value) {
- addCriterion("id <", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdIn(List<Integer> values) {
+ addCriterion("id in", values, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdLessThanOrEqualTo(Integer value) {
- addCriterion("id <=", value, "id");
- return (Criteria) this;
- }
+ public Criteria andIdNotIn(List<Integer> values) {
+ addCriterion("id not in", values, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdIn(List<Integer> values) {
- addCriterion("id in", values, "id");
- return (Criteria) this;
- }
+ public Criteria andIdBetween(Integer value1, Integer value2) {
+ addCriterion("id between", value1, value2, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdNotIn(List<Integer> values) {
- addCriterion("id not in", values, "id");
- return (Criteria) this;
- }
+ public Criteria andIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("id not between", value1, value2, "id");
+ return (Criteria) this;
+ }
- public Criteria andIdBetween(Integer value1, Integer value2) {
- addCriterion("id between", value1, value2, "id");
- return (Criteria) this;
- }
+ public Criteria andNameIsNull() {
+ addCriterion("name is null");
+ return (Criteria) this;
+ }
- public Criteria andIdNotBetween(Integer value1, Integer value2) {
- addCriterion("id not between", value1, value2, "id");
- return (Criteria) this;
- }
+ public Criteria andNameIsNotNull() {
+ addCriterion("name is not null");
+ return (Criteria) this;
+ }
- public Criteria andNameIsNull() {
- addCriterion("name is null");
- return (Criteria) this;
- }
+ public Criteria andNameEqualTo(String value) {
+ addCriterion("name =", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameIsNotNull() {
- addCriterion("name is not null");
- return (Criteria) this;
- }
+ public Criteria andNameNotEqualTo(String value) {
+ addCriterion("name <>", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameEqualTo(String value) {
- addCriterion("name =", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameGreaterThan(String value) {
+ addCriterion("name >", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameNotEqualTo(String value) {
- addCriterion("name <>", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameGreaterThanOrEqualTo(String value) {
+ addCriterion("name >=", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameGreaterThan(String value) {
- addCriterion("name >", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameLessThan(String value) {
+ addCriterion("name <", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameGreaterThanOrEqualTo(String value) {
- addCriterion("name >=", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameLessThanOrEqualTo(String value) {
+ addCriterion("name <=", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameLessThan(String value) {
- addCriterion("name <", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameLike(String value) {
+ addCriterion("name like", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameLessThanOrEqualTo(String value) {
- addCriterion("name <=", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameNotLike(String value) {
+ addCriterion("name not like", value, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameLike(String value) {
- addCriterion("name like", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameIn(List<String> values) {
+ addCriterion("name in", values, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameNotLike(String value) {
- addCriterion("name not like", value, "name");
- return (Criteria) this;
- }
+ public Criteria andNameNotIn(List<String> values) {
+ addCriterion("name not in", values, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameIn(List<String> values) {
- addCriterion("name in", values, "name");
- return (Criteria) this;
- }
+ public Criteria andNameBetween(String value1, String value2) {
+ addCriterion("name between", value1, value2, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameNotIn(List<String> values) {
- addCriterion("name not in", values, "name");
- return (Criteria) this;
- }
+ public Criteria andNameNotBetween(String value1, String value2) {
+ addCriterion("name not between", value1, value2, "name");
+ return (Criteria) this;
+ }
- public Criteria andNameBetween(String value1, String value2) {
- addCriterion("name between", value1, value2, "name");
- return (Criteria) this;
- }
+ public Criteria andAddressIsNull() {
+ addCriterion("address is null");
+ return (Criteria) this;
+ }
- public Criteria andNameNotBetween(String value1, String value2) {
- addCriterion("name not between", value1, value2, "name");
- return (Criteria) this;
- }
+ public Criteria andAddressIsNotNull() {
+ addCriterion("address is not null");
+ return (Criteria) this;
+ }
- public Criteria andAddressIsNull() {
- addCriterion("address is null");
- return (Criteria) this;
- }
+ public Criteria andAddressEqualTo(String value) {
+ addCriterion("address =", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressIsNotNull() {
- addCriterion("address is not null");
- return (Criteria) this;
- }
+ public Criteria andAddressNotEqualTo(String value) {
+ addCriterion("address <>", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressEqualTo(String value) {
- addCriterion("address =", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressGreaterThan(String value) {
+ addCriterion("address >", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressNotEqualTo(String value) {
- addCriterion("address <>", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressGreaterThanOrEqualTo(String value) {
+ addCriterion("address >=", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressGreaterThan(String value) {
- addCriterion("address >", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressLessThan(String value) {
+ addCriterion("address <", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressGreaterThanOrEqualTo(String value) {
- addCriterion("address >=", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressLessThanOrEqualTo(String value) {
+ addCriterion("address <=", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressLessThan(String value) {
- addCriterion("address <", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressLike(String value) {
+ addCriterion("address like", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressLessThanOrEqualTo(String value) {
- addCriterion("address <=", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressNotLike(String value) {
+ addCriterion("address not like", value, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressLike(String value) {
- addCriterion("address like", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressIn(List<String> values) {
+ addCriterion("address in", values, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressNotLike(String value) {
- addCriterion("address not like", value, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressNotIn(List<String> values) {
+ addCriterion("address not in", values, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressIn(List<String> values) {
- addCriterion("address in", values, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressBetween(String value1, String value2) {
+ addCriterion("address between", value1, value2, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressNotIn(List<String> values) {
- addCriterion("address not in", values, "address");
- return (Criteria) this;
- }
+ public Criteria andAddressNotBetween(String value1, String value2) {
+ addCriterion("address not between", value1, value2, "address");
+ return (Criteria) this;
+ }
- public Criteria andAddressBetween(String value1, String value2) {
- addCriterion("address between", value1, value2, "address");
- return (Criteria) this;
- }
+ public Criteria andLongitudeIsNull() {
+ addCriterion("longitude is null");
+ return (Criteria) this;
+ }
- public Criteria andAddressNotBetween(String value1, String value2) {
- addCriterion("address not between", value1, value2, "address");
- return (Criteria) this;
- }
+ public Criteria andLongitudeIsNotNull() {
+ addCriterion("longitude is not null");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeIsNull() {
- addCriterion("longitude is null");
- return (Criteria) this;
- }
+ public Criteria andLongitudeEqualTo(Float value) {
+ addCriterion("longitude =", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeIsNotNull() {
- addCriterion("longitude is not null");
- return (Criteria) this;
- }
+ public Criteria andLongitudeNotEqualTo(Float value) {
+ addCriterion("longitude <>", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeEqualTo(Float value) {
- addCriterion("longitude =", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeGreaterThan(Float value) {
+ addCriterion("longitude >", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeNotEqualTo(Float value) {
- addCriterion("longitude <>", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeGreaterThanOrEqualTo(Float value) {
+ addCriterion("longitude >=", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeGreaterThan(Float value) {
- addCriterion("longitude >", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeLessThan(Float value) {
+ addCriterion("longitude <", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeGreaterThanOrEqualTo(Float value) {
- addCriterion("longitude >=", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeLessThanOrEqualTo(Float value) {
+ addCriterion("longitude <=", value, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeLessThan(Float value) {
- addCriterion("longitude <", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeIn(List<Float> values) {
+ addCriterion("longitude in", values, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeLessThanOrEqualTo(Float value) {
- addCriterion("longitude <=", value, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeNotIn(List<Float> values) {
+ addCriterion("longitude not in", values, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeIn(List<Float> values) {
- addCriterion("longitude in", values, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeBetween(Float value1, Float value2) {
+ addCriterion("longitude between", value1, value2, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeNotIn(List<Float> values) {
- addCriterion("longitude not in", values, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLongitudeNotBetween(Float value1, Float value2) {
+ addCriterion("longitude not between", value1, value2, "longitude");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeBetween(Float value1, Float value2) {
- addCriterion("longitude between", value1, value2, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeIsNull() {
+ addCriterion("latitude is null");
+ return (Criteria) this;
+ }
- public Criteria andLongitudeNotBetween(Float value1, Float value2) {
- addCriterion("longitude not between", value1, value2, "longitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeIsNotNull() {
+ addCriterion("latitude is not null");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeIsNull() {
- addCriterion("latitude is null");
- return (Criteria) this;
- }
+ public Criteria andLatitudeEqualTo(Float value) {
+ addCriterion("latitude =", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeIsNotNull() {
- addCriterion("latitude is not null");
- return (Criteria) this;
- }
+ public Criteria andLatitudeNotEqualTo(Float value) {
+ addCriterion("latitude <>", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeEqualTo(Float value) {
- addCriterion("latitude =", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeGreaterThan(Float value) {
+ addCriterion("latitude >", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeNotEqualTo(Float value) {
- addCriterion("latitude <>", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeGreaterThanOrEqualTo(Float value) {
+ addCriterion("latitude >=", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeGreaterThan(Float value) {
- addCriterion("latitude >", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeLessThan(Float value) {
+ addCriterion("latitude <", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeGreaterThanOrEqualTo(Float value) {
- addCriterion("latitude >=", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeLessThanOrEqualTo(Float value) {
+ addCriterion("latitude <=", value, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeLessThan(Float value) {
- addCriterion("latitude <", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeIn(List<Float> values) {
+ addCriterion("latitude in", values, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeLessThanOrEqualTo(Float value) {
- addCriterion("latitude <=", value, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeNotIn(List<Float> values) {
+ addCriterion("latitude not in", values, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeIn(List<Float> values) {
- addCriterion("latitude in", values, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeBetween(Float value1, Float value2) {
+ addCriterion("latitude between", value1, value2, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeNotIn(List<Float> values) {
- addCriterion("latitude not in", values, "latitude");
- return (Criteria) this;
- }
+ public Criteria andLatitudeNotBetween(Float value1, Float value2) {
+ addCriterion("latitude not between", value1, value2, "latitude");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeBetween(Float value1, Float value2) {
- addCriterion("latitude between", value1, value2, "latitude");
- return (Criteria) this;
- }
+ public Criteria andMacIsNull() {
+ addCriterion("mac is null");
+ return (Criteria) this;
+ }
- public Criteria andLatitudeNotBetween(Float value1, Float value2) {
- addCriterion("latitude not between", value1, value2, "latitude");
- return (Criteria) this;
- }
+ public Criteria andMacIsNotNull() {
+ addCriterion("mac is not null");
+ return (Criteria) this;
+ }
- public Criteria andMacIsNull() {
- addCriterion("mac is null");
- return (Criteria) this;
- }
+ public Criteria andMacEqualTo(String value) {
+ addCriterion("mac =", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacIsNotNull() {
- addCriterion("mac is not null");
- return (Criteria) this;
- }
+ public Criteria andMacNotEqualTo(String value) {
+ addCriterion("mac <>", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacEqualTo(String value) {
- addCriterion("mac =", value, "mac");
- return (Criteria) this;
- }
+ public Criteria andMacGreaterThan(String value) {
+ addCriterion("mac >", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacNotEqualTo(String value) {
- addCriterion("mac <>", value, "mac");
- return (Criteria) this;
- }
+ public Criteria andMacGreaterThanOrEqualTo(String value) {
+ addCriterion("mac >=", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacGreaterThan(String value) {
- addCriterion("mac >", value, "mac");
- return (Criteria) this;
- }
+ public Criteria andMacLessThan(String value) {
+ addCriterion("mac <", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacGreaterThanOrEqualTo(String value) {
- addCriterion("mac >=", value, "mac");
- return (Criteria) this;
- }
+ public Criteria andMacLessThanOrEqualTo(String value) {
+ addCriterion("mac <=", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacLessThan(String value) {
- addCriterion("mac <", value, "mac");
- return (Criteria) this;
- }
+ public Criteria andMacLike(String value) {
+ addCriterion("mac like", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andMacLessThanOrEqualTo(String value) {
- addCriterion("mac <=", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacLike(String value) {
- addCriterion("mac like", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotLike(String value) {
- addCriterion("mac not like", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacIn(List<String> values) {
- addCriterion("mac in", values, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotIn(List<String> values) {
- addCriterion("mac not in", values, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacBetween(String value1, String value2) {
- addCriterion("mac between", value1, value2, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotBetween(String value1, String value2) {
- addCriterion("mac not between", value1, value2, "mac");
- return (Criteria) this;
- }
-
- public Criteria andStateIsNull() {
- addCriterion("state is null");
- return (Criteria) this;
- }
-
- public Criteria andStateIsNotNull() {
- addCriterion("state is not null");
- return (Criteria) this;
- }
-
- public Criteria andStateEqualTo(String value) {
- addCriterion("state =", value, "state");
- return (Criteria) this;
- }
+ public Criteria andMacNotLike(String value) {
+ addCriterion("mac not like", value, "mac");
+ return (Criteria) this;
+ }
- public Criteria andStateNotEqualTo(String value) {
- addCriterion("state <>", value, "state");
- return (Criteria) this;
- }
+ public Criteria andMacIn(List<String> values) {
+ addCriterion("mac in", values, "mac");
+ return (Criteria) this;
+ }
- public Criteria andStateGreaterThan(String value) {
- addCriterion("state >", value, "state");
- return (Criteria) this;
- }
+ public Criteria andMacNotIn(List<String> values) {
+ addCriterion("mac not in", values, "mac");
+ return (Criteria) this;
+ }
- public Criteria andStateGreaterThanOrEqualTo(String value) {
- addCriterion("state >=", value, "state");
- return (Criteria) this;
- }
+ public Criteria andMacBetween(String value1, String value2) {
+ addCriterion("mac between", value1, value2, "mac");
+ return (Criteria) this;
+ }
- public Criteria andStateLessThan(String value) {
- addCriterion("state <", value, "state");
- return (Criteria) this;
- }
+ public Criteria andMacNotBetween(String value1, String value2) {
+ addCriterion("mac not between", value1, value2, "mac");
+ return (Criteria) this;
+ }
- public Criteria andStateLessThanOrEqualTo(String value) {
- addCriterion("state <=", value, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdIsNull() {
+ addCriterion("operate_user_id is null");
+ return (Criteria) this;
+ }
- public Criteria andStateLike(String value) {
- addCriterion("state like", value, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdIsNotNull() {
+ addCriterion("operate_user_id is not null");
+ return (Criteria) this;
+ }
- public Criteria andStateNotLike(String value) {
- addCriterion("state not like", value, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdEqualTo(Integer value) {
+ addCriterion("operate_user_id =", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andStateIn(List<String> values) {
- addCriterion("state in", values, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdNotEqualTo(Integer value) {
+ addCriterion("operate_user_id <>", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andStateNotIn(List<String> values) {
- addCriterion("state not in", values, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdGreaterThan(Integer value) {
+ addCriterion("operate_user_id >", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andStateBetween(String value1, String value2) {
- addCriterion("state between", value1, value2, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("operate_user_id >=", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andStateNotBetween(String value1, String value2) {
- addCriterion("state not between", value1, value2, "state");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdLessThan(Integer value) {
+ addCriterion("operate_user_id <", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdIsNull() {
- addCriterion("operate_user_id is null");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdLessThanOrEqualTo(Integer value) {
+ addCriterion("operate_user_id <=", value, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdIsNotNull() {
- addCriterion("operate_user_id is not null");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdIn(List<Integer> values) {
+ addCriterion("operate_user_id in", values, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdEqualTo(Integer value) {
- addCriterion("operate_user_id =", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdNotIn(List<Integer> values) {
+ addCriterion("operate_user_id not in", values, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdNotEqualTo(Integer value) {
- addCriterion("operate_user_id <>", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdBetween(Integer value1, Integer value2) {
+ addCriterion("operate_user_id between", value1, value2, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdGreaterThan(Integer value) {
- addCriterion("operate_user_id >", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andOperateUserIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("operate_user_id not between", value1, value2, "operateUserId");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdGreaterThanOrEqualTo(Integer value) {
- addCriterion("operate_user_id >=", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateIsNull() {
+ addCriterion("state is null");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdLessThan(Integer value) {
- addCriterion("operate_user_id <", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateIsNotNull() {
+ addCriterion("state is not null");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdLessThanOrEqualTo(Integer value) {
- addCriterion("operate_user_id <=", value, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateEqualTo(String value) {
+ addCriterion("state =", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdIn(List<Integer> values) {
- addCriterion("operate_user_id in", values, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateNotEqualTo(String value) {
+ addCriterion("state <>", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdNotIn(List<Integer> values) {
- addCriterion("operate_user_id not in", values, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateGreaterThan(String value) {
+ addCriterion("state >", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdBetween(Integer value1, Integer value2) {
- addCriterion("operate_user_id between", value1, value2, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateGreaterThanOrEqualTo(String value) {
+ addCriterion("state >=", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andOperateUserIdNotBetween(Integer value1, Integer value2) {
- addCriterion("operate_user_id not between", value1, value2, "operateUserId");
- return (Criteria) this;
- }
+ public Criteria andStateLessThan(String value) {
+ addCriterion("state <", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeIsNull() {
- addCriterion("create_time is null");
- return (Criteria) this;
- }
+ public Criteria andStateLessThanOrEqualTo(String value) {
+ addCriterion("state <=", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeIsNotNull() {
- addCriterion("create_time is not null");
- return (Criteria) this;
- }
+ public Criteria andStateLike(String value) {
+ addCriterion("state like", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeEqualTo(Date value) {
- addCriterion("create_time =", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andStateNotLike(String value) {
+ addCriterion("state not like", value, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeNotEqualTo(Date value) {
- addCriterion("create_time <>", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andStateIn(List<String> values) {
+ addCriterion("state in", values, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeGreaterThan(Date value) {
- addCriterion("create_time >", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andStateNotIn(List<String> values) {
+ addCriterion("state not in", values, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
- addCriterion("create_time >=", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andStateBetween(String value1, String value2) {
+ addCriterion("state between", value1, value2, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeLessThan(Date value) {
- addCriterion("create_time <", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andStateNotBetween(String value1, String value2) {
+ addCriterion("state not between", value1, value2, "state");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
- addCriterion("create_time <=", value, "createTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeIsNull() {
+ addCriterion("create_time is null");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeIn(List<Date> values) {
- addCriterion("create_time in", values, "createTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeIsNotNull() {
+ addCriterion("create_time is not null");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeNotIn(List<Date> values) {
- addCriterion("create_time not in", values, "createTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeEqualTo(Date value) {
+ addCriterion("create_time =", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeBetween(Date value1, Date value2) {
- addCriterion("create_time between", value1, value2, "createTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeNotEqualTo(Date value) {
+ addCriterion("create_time <>", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
- addCriterion("create_time not between", value1, value2, "createTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeGreaterThan(Date value) {
+ addCriterion("create_time >", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeIsNull() {
- addCriterion("install_time is null");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+ addCriterion("create_time >=", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeIsNotNull() {
- addCriterion("install_time is not null");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeLessThan(Date value) {
+ addCriterion("create_time <", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeEqualTo(Date value) {
- addCriterion("install_time =", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+ addCriterion("create_time <=", value, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeNotEqualTo(Date value) {
- addCriterion("install_time <>", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeIn(List<Date> values) {
+ addCriterion("create_time in", values, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeGreaterThan(Date value) {
- addCriterion("install_time >", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeNotIn(List<Date> values) {
+ addCriterion("create_time not in", values, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeGreaterThanOrEqualTo(Date value) {
- addCriterion("install_time >=", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeBetween(Date value1, Date value2) {
+ addCriterion("create_time between", value1, value2, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeLessThan(Date value) {
- addCriterion("install_time <", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+ addCriterion("create_time not between", value1, value2, "createTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeLessThanOrEqualTo(Date value) {
- addCriterion("install_time <=", value, "installTime");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeIsNull() {
+ addCriterion("install_time is null");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeIn(List<Date> values) {
- addCriterion("install_time in", values, "installTime");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeIsNotNull() {
+ addCriterion("install_time is not null");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeNotIn(List<Date> values) {
- addCriterion("install_time not in", values, "installTime");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeEqualTo(Date value) {
+ addCriterion("install_time =", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeBetween(Date value1, Date value2) {
- addCriterion("install_time between", value1, value2, "installTime");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeNotEqualTo(Date value) {
+ addCriterion("install_time <>", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andInstallTimeNotBetween(Date value1, Date value2) {
- addCriterion("install_time not between", value1, value2, "installTime");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeGreaterThan(Date value) {
+ addCriterion("install_time >", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdIsNull() {
- addCriterion("monitor_point_id is null");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeGreaterThanOrEqualTo(Date value) {
+ addCriterion("install_time >=", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdIsNotNull() {
- addCriterion("monitor_point_id is not null");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeLessThan(Date value) {
+ addCriterion("install_time <", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdEqualTo(Integer value) {
- addCriterion("monitor_point_id =", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeLessThanOrEqualTo(Date value) {
+ addCriterion("install_time <=", value, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdNotEqualTo(Integer value) {
- addCriterion("monitor_point_id <>", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeIn(List<Date> values) {
+ addCriterion("install_time in", values, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdGreaterThan(Integer value) {
- addCriterion("monitor_point_id >", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeNotIn(List<Date> values) {
+ addCriterion("install_time not in", values, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdGreaterThanOrEqualTo(Integer value) {
- addCriterion("monitor_point_id >=", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeBetween(Date value1, Date value2) {
+ addCriterion("install_time between", value1, value2, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdLessThan(Integer value) {
- addCriterion("monitor_point_id <", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andInstallTimeNotBetween(Date value1, Date value2) {
+ addCriterion("install_time not between", value1, value2, "installTime");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdLessThanOrEqualTo(Integer value) {
- addCriterion("monitor_point_id <=", value, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdIsNull() {
+ addCriterion("monitor_point_id is null");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdIn(List<Integer> values) {
- addCriterion("monitor_point_id in", values, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdIsNotNull() {
+ addCriterion("monitor_point_id is not null");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdNotIn(List<Integer> values) {
- addCriterion("monitor_point_id not in", values, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdEqualTo(Integer value) {
+ addCriterion("monitor_point_id =", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdBetween(Integer value1, Integer value2) {
- addCriterion("monitor_point_id between", value1, value2, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdNotEqualTo(Integer value) {
+ addCriterion("monitor_point_id <>", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andMonitorPointIdNotBetween(Integer value1, Integer value2) {
- addCriterion("monitor_point_id not between", value1, value2, "monitorPointId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdGreaterThan(Integer value) {
+ addCriterion("monitor_point_id >", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdIsNull() {
- addCriterion("device_version_id is null");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("monitor_point_id >=", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdIsNotNull() {
- addCriterion("device_version_id is not null");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdLessThan(Integer value) {
+ addCriterion("monitor_point_id <", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdEqualTo(Integer value) {
- addCriterion("device_version_id =", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdLessThanOrEqualTo(Integer value) {
+ addCriterion("monitor_point_id <=", value, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdNotEqualTo(Integer value) {
- addCriterion("device_version_id <>", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdIn(List<Integer> values) {
+ addCriterion("monitor_point_id in", values, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdGreaterThan(Integer value) {
- addCriterion("device_version_id >", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdNotIn(List<Integer> values) {
+ addCriterion("monitor_point_id not in", values, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdGreaterThanOrEqualTo(Integer value) {
- addCriterion("device_version_id >=", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdBetween(Integer value1, Integer value2) {
+ addCriterion("monitor_point_id between", value1, value2, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdLessThan(Integer value) {
- addCriterion("device_version_id <", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andMonitorPointIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("monitor_point_id not between", value1, value2, "monitorPointId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdLessThanOrEqualTo(Integer value) {
- addCriterion("device_version_id <=", value, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andDeviceVersionIdIsNull() {
+ addCriterion("device_version_id is null");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdIn(List<Integer> values) {
- addCriterion("device_version_id in", values, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andDeviceVersionIdIsNotNull() {
+ addCriterion("device_version_id is not null");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdNotIn(List<Integer> values) {
- addCriterion("device_version_id not in", values, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andDeviceVersionIdEqualTo(Integer value) {
+ addCriterion("device_version_id =", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdBetween(Integer value1, Integer value2) {
- addCriterion("device_version_id between", value1, value2, "deviceVersionId");
- return (Criteria) this;
- }
+ public Criteria andDeviceVersionIdNotEqualTo(Integer value) {
+ addCriterion("device_version_id <>", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- public Criteria andDeviceVersionIdNotBetween(Integer value1, Integer value2) {
- addCriterion("device_version_id not between", value1, value2, "deviceVersionId");
- return (Criteria) this;
- }
- }
+ public Criteria andDeviceVersionIdGreaterThan(Integer value) {
+ addCriterion("device_version_id >", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- public static class Criteria extends GeneratedCriteria {
+ public Criteria andDeviceVersionIdGreaterThanOrEqualTo(Integer value) {
+ addCriterion("device_version_id >=", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- protected Criteria() {
- super();
- }
- }
+ public Criteria andDeviceVersionIdLessThan(Integer value) {
+ addCriterion("device_version_id <", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- public static class Criterion {
- private String condition;
+ public Criteria andDeviceVersionIdLessThanOrEqualTo(Integer value) {
+ addCriterion("device_version_id <=", value, "deviceVersionId");
+ return (Criteria) this;
+ }
- private Object value;
+ public Criteria andDeviceVersionIdIn(List<Integer> values) {
+ addCriterion("device_version_id in", values, "deviceVersionId");
+ return (Criteria) this;
+ }
- private Object secondValue;
+ public Criteria andDeviceVersionIdNotIn(List<Integer> values) {
+ addCriterion("device_version_id not in", values, "deviceVersionId");
+ return (Criteria) this;
+ }
- private boolean noValue;
+ public Criteria andDeviceVersionIdBetween(Integer value1, Integer value2) {
+ addCriterion("device_version_id between", value1, value2, "deviceVersionId");
+ return (Criteria) this;
+ }
- private boolean singleValue;
+ public Criteria andDeviceVersionIdNotBetween(Integer value1, Integer value2) {
+ addCriterion("device_version_id not between", value1, value2, "deviceVersionId");
+ return (Criteria) this;
+ }
+ }
- private boolean betweenValue;
+ /**
+ * This class was generated by MyBatis Generator. This class corresponds to the database table device
+ * @mbggenerated Wed Nov 29 16:17:59 CST 2017
+ */
+ public static class Criterion {
+ private String condition;
+ private Object value;
+ private Object secondValue;
+ private boolean noValue;
+ private boolean singleValue;
+ private boolean betweenValue;
+ private boolean listValue;
+ private String typeHandler;
- private boolean listValue;
+ public String getCondition() {
+ return condition;
+ }
- private String typeHandler;
+ public Object getValue() {
+ return value;
+ }
- public String getCondition() {
- return condition;
- }
+ public Object getSecondValue() {
+ return secondValue;
+ }
- public Object getValue() {
- return value;
- }
+ public boolean isNoValue() {
+ return noValue;
+ }
- public Object getSecondValue() {
- return secondValue;
- }
+ public boolean isSingleValue() {
+ return singleValue;
+ }
- public boolean isNoValue() {
- return noValue;
- }
+ public boolean isBetweenValue() {
+ return betweenValue;
+ }
- public boolean isSingleValue() {
- return singleValue;
- }
+ public boolean isListValue() {
+ return listValue;
+ }
- public boolean isBetweenValue() {
- return betweenValue;
- }
+ public String getTypeHandler() {
+ return typeHandler;
+ }
- public boolean isListValue() {
- return listValue;
- }
+ protected Criterion(String condition) {
+ super();
+ this.condition = condition;
+ this.typeHandler = null;
+ this.noValue = true;
+ }
- public String getTypeHandler() {
- return typeHandler;
- }
+ protected Criterion(String condition, Object value, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.typeHandler = typeHandler;
+ if (value instanceof List<?>) {
+ this.listValue = true;
+ } else {
+ this.singleValue = true;
+ }
+ }
- protected Criterion(String condition) {
- super();
- this.condition = condition;
- this.typeHandler = null;
- this.noValue = true;
- }
+ protected Criterion(String condition, Object value) {
+ this(condition, value, null);
+ }
- protected Criterion(String condition, Object value, String typeHandler) {
- super();
- this.condition = condition;
- this.value = value;
- this.typeHandler = typeHandler;
- if (value instanceof List<?>) {
- this.listValue = true;
- } else {
- this.singleValue = true;
- }
- }
+ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.secondValue = secondValue;
+ this.typeHandler = typeHandler;
+ this.betweenValue = true;
+ }
- protected Criterion(String condition, Object value) {
- this(condition, value, null);
- }
+ protected Criterion(String condition, Object value, Object secondValue) {
+ this(condition, value, secondValue, null);
+ }
+ }
- protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
- super();
- this.condition = condition;
- this.value = value;
- this.secondValue = secondValue;
- this.typeHandler = typeHandler;
- this.betweenValue = true;
- }
+ /**
+ * This class was generated by MyBatis Generator. This class corresponds to the database table device
+ * @mbggenerated do_not_delete_during_merge
+ */
+ public static class Criteria extends GeneratedCriteria {
+ protected Criteria() {
+ super();
+ }
+ }
- protected Criterion(String condition, Object value, Object secondValue) {
- this(condition, value, secondValue, null);
- }
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/History.java b/src/main/java/com/moral/entity/History.java
deleted file mode 100644
index c3edf08..0000000
--- a/src/main/java/com/moral/entity/History.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.moral.entity;
-
-import java.util.Date;
-
-public class History {
- private String mac;
-
- private Object value;
-
- private Date time;
-
- private Integer version;
-
- public String getMac() {
- return mac;
- }
-
- public void setMac(String mac) {
- this.mac = mac;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Integer getVersion() {
- return version;
- }
-
- public void setVersion(Integer version) {
- this.version = version;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/HistoryExample.java b/src/main/java/com/moral/entity/HistoryExample.java
deleted file mode 100644
index 1e80762..0000000
--- a/src/main/java/com/moral/entity/HistoryExample.java
+++ /dev/null
@@ -1,443 +0,0 @@
-package com.moral.entity;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-public class HistoryExample {
- protected String orderByClause;
-
- protected boolean distinct;
-
- protected List<Criteria> oredCriteria;
-
- public HistoryExample() {
- oredCriteria = new ArrayList<Criteria>();
- }
-
- public void setOrderByClause(String orderByClause) {
- this.orderByClause = orderByClause;
- }
-
- public String getOrderByClause() {
- return orderByClause;
- }
-
- public void setDistinct(boolean distinct) {
- this.distinct = distinct;
- }
-
- public boolean isDistinct() {
- return distinct;
- }
-
- public List<Criteria> getOredCriteria() {
- return oredCriteria;
- }
-
- public void or(Criteria criteria) {
- oredCriteria.add(criteria);
- }
-
- public Criteria or() {
- Criteria criteria = createCriteriaInternal();
- oredCriteria.add(criteria);
- return criteria;
- }
-
- public Criteria createCriteria() {
- Criteria criteria = createCriteriaInternal();
- if (oredCriteria.size() == 0) {
- oredCriteria.add(criteria);
- }
- return criteria;
- }
-
- protected Criteria createCriteriaInternal() {
- Criteria criteria = new Criteria();
- return criteria;
- }
-
- public void clear() {
- oredCriteria.clear();
- orderByClause = null;
- distinct = false;
- }
-
- protected abstract static class GeneratedCriteria {
- protected List<Criterion> criteria;
-
- protected GeneratedCriteria() {
- super();
- criteria = new ArrayList<Criterion>();
- }
-
- public boolean isValid() {
- return criteria.size() > 0;
- }
-
- public List<Criterion> getAllCriteria() {
- return criteria;
- }
-
- public List<Criterion> getCriteria() {
- return criteria;
- }
-
- protected void addCriterion(String condition) {
- if (condition == null) {
- throw new RuntimeException("Value for condition cannot be null");
- }
- criteria.add(new Criterion(condition));
- }
-
- protected void addCriterion(String condition, Object value, String property) {
- if (value == null) {
- throw new RuntimeException("Value for " + property + " cannot be null");
- }
- criteria.add(new Criterion(condition, value));
- }
-
- protected void addCriterion(String condition, Object value1, Object value2, String property) {
- if (value1 == null || value2 == null) {
- throw new RuntimeException("Between values for " + property + " cannot be null");
- }
- criteria.add(new Criterion(condition, value1, value2));
- }
-
- public Criteria andMacIsNull() {
- addCriterion("mac is null");
- return (Criteria) this;
- }
-
- public Criteria andMacIsNotNull() {
- addCriterion("mac is not null");
- return (Criteria) this;
- }
-
- public Criteria andMacEqualTo(String value) {
- addCriterion("mac =", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotEqualTo(String value) {
- addCriterion("mac <>", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacGreaterThan(String value) {
- addCriterion("mac >", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacGreaterThanOrEqualTo(String value) {
- addCriterion("mac >=", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacLessThan(String value) {
- addCriterion("mac <", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacLessThanOrEqualTo(String value) {
- addCriterion("mac <=", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacLike(String value) {
- addCriterion("mac like", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotLike(String value) {
- addCriterion("mac not like", value, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacIn(List<String> values) {
- addCriterion("mac in", values, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotIn(List<String> values) {
- addCriterion("mac not in", values, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacBetween(String value1, String value2) {
- addCriterion("mac between", value1, value2, "mac");
- return (Criteria) this;
- }
-
- public Criteria andMacNotBetween(String value1, String value2) {
- addCriterion("mac not between", value1, value2, "mac");
- return (Criteria) this;
- }
-
- public Criteria andValueIsNull() {
- addCriterion("value is null");
- return (Criteria) this;
- }
-
- public Criteria andValueIsNotNull() {
- addCriterion("value is not null");
- return (Criteria) this;
- }
-
- public Criteria andValueEqualTo(Object value) {
- addCriterion("value =", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueNotEqualTo(Object value) {
- addCriterion("value <>", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueGreaterThan(Object value) {
- addCriterion("value >", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueGreaterThanOrEqualTo(Object value) {
- addCriterion("value >=", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueLessThan(Object value) {
- addCriterion("value <", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueLessThanOrEqualTo(Object value) {
- addCriterion("value <=", value, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueIn(List<Object> values) {
- addCriterion("value in", values, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueNotIn(List<Object> values) {
- addCriterion("value not in", values, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueBetween(Object value1, Object value2) {
- addCriterion("value between", value1, value2, "value");
- return (Criteria) this;
- }
-
- public Criteria andValueNotBetween(Object value1, Object value2) {
- addCriterion("value not between", value1, value2, "value");
- return (Criteria) this;
- }
-
- public Criteria andTimeIsNull() {
- addCriterion("time is null");
- return (Criteria) this;
- }
-
- public Criteria andTimeIsNotNull() {
- addCriterion("time is not null");
- return (Criteria) this;
- }
-
- public Criteria andTimeEqualTo(Date value) {
- addCriterion("time =", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeNotEqualTo(Date value) {
- addCriterion("time <>", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeGreaterThan(Date value) {
- addCriterion("time >", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeGreaterThanOrEqualTo(Date value) {
- addCriterion("time >=", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeLessThan(Date value) {
- addCriterion("time <", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeLessThanOrEqualTo(Date value) {
- addCriterion("time <=", value, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeIn(List<Date> values) {
- addCriterion("time in", values, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeNotIn(List<Date> values) {
- addCriterion("time not in", values, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeBetween(Date value1, Date value2) {
- addCriterion("time between", value1, value2, "time");
- return (Criteria) this;
- }
-
- public Criteria andTimeNotBetween(Date value1, Date value2) {
- addCriterion("time not between", value1, value2, "time");
- return (Criteria) this;
- }
-
- public Criteria andVersionIsNull() {
- addCriterion("version is null");
- return (Criteria) this;
- }
-
- public Criteria andVersionIsNotNull() {
- addCriterion("version is not null");
- return (Criteria) this;
- }
-
- public Criteria andVersionEqualTo(Integer value) {
- addCriterion("version =", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionNotEqualTo(Integer value) {
- addCriterion("version <>", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionGreaterThan(Integer value) {
- addCriterion("version >", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionGreaterThanOrEqualTo(Integer value) {
- addCriterion("version >=", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionLessThan(Integer value) {
- addCriterion("version <", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionLessThanOrEqualTo(Integer value) {
- addCriterion("version <=", value, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionIn(List<Integer> values) {
- addCriterion("version in", values, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionNotIn(List<Integer> values) {
- addCriterion("version not in", values, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionBetween(Integer value1, Integer value2) {
- addCriterion("version between", value1, value2, "version");
- return (Criteria) this;
- }
-
- public Criteria andVersionNotBetween(Integer value1, Integer value2) {
- addCriterion("version not between", value1, value2, "version");
- return (Criteria) this;
- }
- }
-
- public static class Criteria extends GeneratedCriteria {
- protected Criteria() {
- super();
- }
- }
-
- public static class Criterion {
- private String condition;
- private Object value;
- private Object secondValue;
- private boolean noValue;
- private boolean singleValue;
- private boolean betweenValue;
- private boolean listValue;
- private String typeHandler;
-
- public String getCondition() {
- return condition;
- }
-
- public Object getValue() {
- return value;
- }
-
- public Object getSecondValue() {
- return secondValue;
- }
-
- public boolean isNoValue() {
- return noValue;
- }
-
- public boolean isSingleValue() {
- return singleValue;
- }
-
- public boolean isBetweenValue() {
- return betweenValue;
- }
-
- public boolean isListValue() {
- return listValue;
- }
-
- public String getTypeHandler() {
- return typeHandler;
- }
-
- protected Criterion(String condition) {
- super();
- this.condition = condition;
- this.typeHandler = null;
- this.noValue = true;
- }
-
- protected Criterion(String condition, Object value, String typeHandler) {
- super();
- this.condition = condition;
- this.value = value;
- this.typeHandler = typeHandler;
- if (value instanceof List<?>) {
- this.listValue = true;
- } else {
- this.singleValue = true;
- }
- }
-
- protected Criterion(String condition, Object value) {
- this(condition, value, null);
- }
-
- protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
- super();
- this.condition = condition;
- this.value = value;
- this.secondValue = secondValue;
- this.typeHandler = typeHandler;
- this.betweenValue = true;
- }
-
- protected Criterion(String condition, Object value, Object secondValue) {
- this(condition, value, secondValue, null);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/OperateUser.java b/src/main/java/com/moral/entity/OperateUser.java
index 54f89b4..10a6ed5 100644
--- a/src/main/java/com/moral/entity/OperateUser.java
+++ b/src/main/java/com/moral/entity/OperateUser.java
@@ -2,6 +2,9 @@
import java.util.Date;
+import lombok.Data;
+
+@Data
public class OperateUser {
private Integer id;
@@ -25,91 +28,4 @@
private Date expireTime;
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getJobNumber() {
- return jobNumber;
- }
-
- public void setJobNumber(String jobNumber) {
- this.jobNumber = jobNumber;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Integer getOrganizationId() {
- return organizationId;
- }
-
- public void setOrganizationId(Integer organizationId) {
- this.organizationId = organizationId;
- }
-
- public String getMobile() {
- return mobile;
- }
-
- public void setMobile(String mobile) {
- this.mobile = mobile;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getWeixin() {
- return weixin;
- }
-
- public void setWeixin(String weixin) {
- this.weixin = weixin;
- }
-
- public String getIsDelete() {
- return isDelete;
- }
-
- public void setIsDelete(String isDelete) {
- this.isDelete = isDelete;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getExpireTime() {
- return expireTime;
- }
-
- public void setExpireTime(Date expireTime) {
- this.expireTime = expireTime;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/Organization.java b/src/main/java/com/moral/entity/Organization.java
index 983b41f..c615e27 100644
--- a/src/main/java/com/moral/entity/Organization.java
+++ b/src/main/java/com/moral/entity/Organization.java
@@ -2,6 +2,9 @@
import java.util.Date;
+import lombok.Data;
+
+@Data
public class Organization {
private Integer id;
@@ -29,107 +32,4 @@
private String description;
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getRank() {
- return rank;
- }
-
- public void setRank(Integer rank) {
- this.rank = rank;
- }
-
- public Integer getProvinceCode() {
- return provinceCode;
- }
-
- public void setProvinceCode(Integer provinceCode) {
- this.provinceCode = provinceCode;
- }
-
- public Integer getCityCode() {
- return cityCode;
- }
-
- public void setCityCode(Integer cityCode) {
- this.cityCode = cityCode;
- }
-
- public Integer getAreaCode() {
- return areaCode;
- }
-
- public void setAreaCode(Integer areaCode) {
- this.areaCode = areaCode;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public String getTelephone() {
- return telephone;
- }
-
- public void setTelephone(String telephone) {
- this.telephone = telephone;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getIsDelete() {
- return isDelete;
- }
-
- public void setIsDelete(String isDelete) {
- this.isDelete = isDelete;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getExpireTime() {
- return expireTime;
- }
-
- public void setExpireTime(Date expireTime) {
- this.expireTime = expireTime;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/entity/OrganizationRelation.java b/src/main/java/com/moral/entity/OrganizationRelation.java
index bf98d83..008fa4f 100644
--- a/src/main/java/com/moral/entity/OrganizationRelation.java
+++ b/src/main/java/com/moral/entity/OrganizationRelation.java
@@ -1,5 +1,8 @@
package com.moral.entity;
+import lombok.Data;
+
+@Data
public class OrganizationRelation {
private Integer id;
@@ -7,27 +10,4 @@
private Integer childId;
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getParentId() {
- return parentId;
- }
-
- public void setParentId(Integer parentId) {
- this.parentId = parentId;
- }
-
- public Integer getChildId() {
- return childId;
- }
-
- public void setChildId(Integer childId) {
- this.childId = childId;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/mapper/AccountMapper.java b/src/main/java/com/moral/mapper/AccountMapper.java
index 05581d5..6d2c135 100644
--- a/src/main/java/com/moral/mapper/AccountMapper.java
+++ b/src/main/java/com/moral/mapper/AccountMapper.java
@@ -5,6 +5,7 @@
import org.apache.ibatis.annotations.Mapper;
+import com.moral.common.mapper.BaseMapper;
import com.moral.entity.Account;
import com.moral.entity.AccountExample;
diff --git a/src/main/java/com/moral/mapper/DeviceMapper.java b/src/main/java/com/moral/mapper/DeviceMapper.java
index 34eff69..ee2a7f9 100644
--- a/src/main/java/com/moral/mapper/DeviceMapper.java
+++ b/src/main/java/com/moral/mapper/DeviceMapper.java
@@ -4,11 +4,16 @@
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import com.moral.common.mapper.BaseMapper;
import com.moral.entity.Device;
import com.moral.entity.DeviceExample;
@Mapper
-public interface DeviceMapper extends BaseMapper<Device, DeviceExample, Integer> {
- List<Map<String, Object>> getDeviceStates(Map<String, Object> parameters);
+public interface DeviceMapper extends BaseMapper<Device, DeviceExample, Integer>{
+
+ List<Map<String, Object>> getDeviceStatesByAccount(Map<String, Object> parameters);
+
+ List<Map<String, Object>> getSensorsByDevice(@Param("mac")String mac);
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/mapper/HistoryMapper.java b/src/main/java/com/moral/mapper/HistoryMapper.java
index 9fb75fa..8fecdda 100644
--- a/src/main/java/com/moral/mapper/HistoryMapper.java
+++ b/src/main/java/com/moral/mapper/HistoryMapper.java
@@ -5,29 +5,15 @@
import org.apache.ibatis.annotations.Mapper;
-import com.moral.entity.History;
-import com.moral.entity.HistoryExample;
-import org.apache.ibatis.annotations.Param;
-
@Mapper
-public interface HistoryMapper extends BaseMapper<History, HistoryExample, Integer> {
-
- int countByExample(HistoryExample example);
-
- int deleteByExample(HistoryExample example);
-
- int insert(History record);
-
- int insertSelective(History record);
-
- List<History> selectByExample(HistoryExample example);
-
- int updateByExampleSelective(@Param("record") History record, @Param("example") HistoryExample example);
-
- int updateByExample(@Param("record") History record, @Param("example") HistoryExample example);
+public interface HistoryMapper{
Map<String, Double> getDayAQIByDevice(Map<String, Object> parameters);
- List<Map<String, Object>> getAverageByAll(Map<String, Object> parameters);
+ Map<String, Object> getAllSensorAverageByDevice(Map<String, Object> parameters);
+
+ List<Map<String, Object>> getSensorsAverageByDevice4Report(Map<String, Object> parameters);
+
+ List<Map<String, Object>> getAreaAllDataByAccount(Map<String, Object> parameters);
}
\ No newline at end of file
diff --git a/src/main/java/com/moral/mapper/OperateUserMapper.java b/src/main/java/com/moral/mapper/OperateUserMapper.java
index 66693eb..b8b4008 100644
--- a/src/main/java/com/moral/mapper/OperateUserMapper.java
+++ b/src/main/java/com/moral/mapper/OperateUserMapper.java
@@ -2,6 +2,7 @@
import org.apache.ibatis.annotations.Mapper;
+import com.moral.common.mapper.BaseMapper;
import com.moral.entity.OperateUser;
import com.moral.entity.OperateUserExample;
diff --git a/src/main/java/com/moral/mapper/OrganizationMapper.java b/src/main/java/com/moral/mapper/OrganizationMapper.java
index a6fbdc1..1f93400 100644
--- a/src/main/java/com/moral/mapper/OrganizationMapper.java
+++ b/src/main/java/com/moral/mapper/OrganizationMapper.java
@@ -2,6 +2,7 @@
import org.apache.ibatis.annotations.Mapper;
+import com.moral.common.mapper.BaseMapper;
import com.moral.entity.Organization;
import com.moral.entity.OrganizationExample;
diff --git a/src/main/java/com/moral/mapper/OrganizationRelationMapper.java b/src/main/java/com/moral/mapper/OrganizationRelationMapper.java
index 250907b..4fa020c 100644
--- a/src/main/java/com/moral/mapper/OrganizationRelationMapper.java
+++ b/src/main/java/com/moral/mapper/OrganizationRelationMapper.java
@@ -2,6 +2,7 @@
import org.apache.ibatis.annotations.Mapper;
+import com.moral.common.mapper.BaseMapper;
import com.moral.entity.OrganizationRelation;
import com.moral.entity.OrganizationRelationExample;
diff --git a/src/main/java/com/moral/service/AccountService.java b/src/main/java/com/moral/service/AccountService.java
index 20014db..a93a979 100644
--- a/src/main/java/com/moral/service/AccountService.java
+++ b/src/main/java/com/moral/service/AccountService.java
@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Map;
+import com.moral.common.bean.ResultBean;
import com.moral.entity.Account;
public interface AccountService {
@@ -14,5 +15,7 @@
void setOrgIdsByAccount(Map<String, Object> parameters);
+ ResultBean<Account> screenLogin1(Map<String, Object> parameters);
+
}
diff --git a/src/main/java/com/moral/service/DeviceService.java b/src/main/java/com/moral/service/DeviceService.java
index 9e775bd..4e0da7e 100644
--- a/src/main/java/com/moral/service/DeviceService.java
+++ b/src/main/java/com/moral/service/DeviceService.java
@@ -1,8 +1,11 @@
package com.moral.service;
+import java.util.List;
import java.util.Map;
public interface DeviceService {
- Map<String, Object> getDeviceStates(Map<String, Object> parameters);
+ Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters);
+
+ List<Map<String, Object>> getSensorsByDevice(String mac);
}
diff --git a/src/main/java/com/moral/service/HistoryService.java b/src/main/java/com/moral/service/HistoryService.java
index 985dd4e..feb611c 100644
--- a/src/main/java/com/moral/service/HistoryService.java
+++ b/src/main/java/com/moral/service/HistoryService.java
@@ -1,15 +1,18 @@
package com.moral.service;
+import java.util.List;
import java.util.Map;
public interface HistoryService {
- Map<String, Object> getAverageByAll(Map<String, Object> parameters);
+ Map<String, Object> getAllSensorAverageByDevice(Map<String, Object> parameters);
- Map<String, Object> getAverageBySensor(Map<String, Object> parameters);
+ Map<String, Object> getDeviceRankingBySensorAverage(Map<String, Object> parameters);
Map<String, Object> getDayAQIByDevice(Map<String, Object> parameters);
Map<String, Object> getMonthAverageBySensor(Map<String, Object> parameters);
+
+ List<Map<String, Object>> getSensorsAverageByDevice4Report(Map<String, Object> parameters, List<Map<String, Object>> sensorKeys);
}
diff --git a/src/main/java/com/moral/service/impl/AccountServiceImpl.java b/src/main/java/com/moral/service/impl/AccountServiceImpl.java
index 06808ff..aee503f 100644
--- a/src/main/java/com/moral/service/impl/AccountServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/AccountServiceImpl.java
@@ -1,23 +1,28 @@
package com.moral.service.impl;
+import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
+import static com.moral.common.bean.Constants.IS_DELETE_TRUE;
+import static com.moral.common.util.Crypto.md5;
+import static com.moral.common.util.ResourceUtil.getValue;
+import static org.apache.commons.lang3.StringUtils.isNumeric;
+import static org.springframework.util.ObjectUtils.isEmpty;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
+import com.moral.common.bean.ResultBean;
+import com.moral.common.exception.BusinessException;
+import com.moral.common.util.Crypto;
import com.moral.entity.Account;
import com.moral.entity.AccountExample;
import com.moral.mapper.AccountMapper;
import com.moral.service.AccountService;
import com.moral.service.OrganizationService;
-import com.moral.util.BusinessException;
-import com.moral.util.Crypto;
-import com.moral.util.ResourceUtil;
@Service
public class AccountServiceImpl implements AccountService {
@@ -31,14 +36,14 @@
public Map<String, Object> screenLogin(Map<String, Object> parameters) {
Map<String, Object> result = new HashMap<String, Object>();
AccountExample example = new AccountExample();
- String password = Crypto.md5((String) parameters.get("account"));
+ String password = md5((String) parameters.get("account"));
example.or().andAccountNameEqualTo((String) parameters.get("account")).andPasswordEqualTo(password);
List<Account> accounts = accountMapper.selectByExample(example);
- if (ObjectUtils.isEmpty(accounts) || accounts.size() != 1) {
+ if (isEmpty(accounts) || accounts.size() != 1) {
result.put("msg", "���������������������������������");
} else {
Account account = accounts.get(0);
- if ("1".equals(account.getIsDelete())) {
+ if (IS_DELETE_FALSE.equals(account.getIsDelete())) {
result.put("msg", "���������������");
result.put("accountId", account.getId());
} else {
@@ -48,6 +53,29 @@
return result;
}
+ @Override
+ public ResultBean<Account> screenLogin1(Map<String, Object> parameters) {
+ ResultBean<Account> resultBean = new ResultBean<Account>();
+ AccountExample example = new AccountExample();
+ String password = Crypto.md5((String) parameters.get("password"));
+ example.or().andAccountNameEqualTo((String) parameters.get("account")).andPasswordEqualTo(password);
+ List<Account> accounts = accountMapper.selectByExample(example);
+ if (isEmpty(accounts) || accounts.size() != 1) {
+ resultBean.setMsg("���������������������������������");
+ resultBean.setCode(ResultBean.FAIL);
+ } else {
+ Account account = accounts.get(0);
+ if (IS_DELETE_FALSE.equals(account.getIsDelete())) {
+ resultBean.setData(account);
+ } else {
+ resultBean.setCode(ResultBean.NO_PERMISSION);
+ resultBean.setMsg("���������������������������������������������");
+ }
+ }
+ return resultBean;
+ }
+
+
@Override
public List<Account> getAccountLists(String accountName, String password) {
AccountExample example = new AccountExample();
@@ -66,18 +94,18 @@
public void setOrgIdsByAccount(Map<String, Object> parameters) {
String accountId = (String) parameters.get("accountId");
accountId = accountId.replaceFirst("-", "");
- if (!StringUtils.isNumeric((String) parameters.get("accountId"))) {
+ if (!isNumeric((String) parameters.get("accountId"))) {
throw new BusinessException("accountId ������������������");
}
Account account = accountMapper.selectByPrimaryKey((Integer.valueOf(accountId)));
- if (ObjectUtils.isEmpty(account) || "1".equals(account.getIsDelete())) {
- throw new BusinessException(accountId + "���������������������");
+ if (isEmpty(account) || IS_DELETE_TRUE.equals(account.getIsDelete())) {
+ throw new BusinessException(accountId + ":���������������������");
}
Integer orgId = account.getOrganizationId();
// ���������������������������������������������������������������
- if (!("-1".equals(orgId) || ResourceUtil.getValue("orgId").equals(orgId))) {
+ if (!(-1 == orgId || getValue("orgId").equals(orgId))) {
Set<Integer> orgIds = organizationService.getChildOrganizationIds(orgId);
parameters.put("orgIds", orgIds);
}
diff --git a/src/main/java/com/moral/service/impl/DeviceServiceImpl.java b/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
index 6375262..f63cd82 100644
--- a/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/DeviceServiceImpl.java
@@ -21,15 +21,15 @@
private AccountService accountService;
@Override
- public Map<String, Object> getDeviceStates(Map<String, Object> parameters) {
+ public Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters) {
Map<String, Object> result = new HashMap<String, Object>();
accountService.setOrgIdsByAccount(parameters);
- List<Map<String, Object>> list = deviceMapper.getDeviceStates(parameters);
+ List<Map<String, Object>> list = deviceMapper.getDeviceStatesByAccount(parameters);
Long all = 0L, normal = 0L, abnormal = 0L, stop = 0L;
for (Map<String, Object> map : list) {
Long count = (Long) map.get("count");
all += count;
- switch ((Integer) map.get("state")) {
+ switch (Integer.valueOf((String) map.get("state"))) {
case 0:
normal = count;
break;
@@ -46,4 +46,10 @@
result.put("stop", stop);
return result;
}
+
+ @Override
+ public List<Map<String, Object>> getSensorsByDevice(String mac) {
+ return deviceMapper.getSensorsByDevice(mac);
+ }
+
}
diff --git a/src/main/java/com/moral/service/impl/HistoryServiceImpl.java b/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
index 2a4d64b..b01f95b 100644
--- a/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
@@ -1,5 +1,15 @@
package com.moral.service.impl;
+import static com.moral.common.bean.Constants.NULL_VALUE;
+import static org.apache.commons.lang3.time.DateUtils.addDays;
+import static org.apache.commons.lang3.time.DateUtils.addHours;
+import static org.apache.commons.lang3.time.DateUtils.addMinutes;
+import static org.apache.commons.lang3.time.DateUtils.addMonths;
+import static org.apache.commons.lang3.time.DateUtils.parseDate;
+import static org.apache.commons.lang3.time.DateUtils.truncate;
+import static org.springframework.util.ObjectUtils.isEmpty;
+
+import java.text.ParseException;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
@@ -10,22 +20,20 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
import com.mongodb.BasicDBObject;
+import com.moral.common.exception.BusinessException;
+import com.moral.common.util.CalculateUtils;
+import com.moral.common.util.ResourceUtil;
import com.moral.mapper.HistoryMapper;
import com.moral.service.AccountService;
import com.moral.service.HistoryService;
-import com.moral.util.CalculateUtils;
-import com.moral.util.Constants;
-import com.moral.util.ResourceUtil;
@Service
public class HistoryServiceImpl implements HistoryService {
@@ -40,36 +48,41 @@
private MongoTemplate mongoTemplate;
@Override
- public Map<String, Object> getAverageByAll(Map<String, Object> parameters) {
- Map<String, Object> result = new LinkedHashMap<String, Object>();
-
+ public Map<String, Object> getAllSensorAverageByDevice(Map<String, Object> parameters) {
accountService.setOrgIdsByAccount(parameters);
- parameters.put("macKey", "all");
Date date = new Date();
// ������������ -10������
- parameters.put("start", DateUtils.addMinutes(date, -10));
+ parameters.put("start", addMinutes(date, -10));
// ������������ -5������
- parameters.put("end", DateUtils.addMinutes(date, -5));
- List<Map<String, Object>> averageByAll = historyMapper.getAverageByAll(parameters);
-
- for (Map<String, Object> map : averageByAll) {
- result.put((String) map.get("mac_key"), map.get("avg"));
+ parameters.put("end", addMinutes(date, -5));
+ String queryColumns = "";
+ for (int i = 1; i < 20; i++) {
+ if (i == 1) {
+ queryColumns += "AVG(value -> '$.e" + i + "') e" + i;
+ } else {
+ queryColumns += " , AVG(value -> '$.e" + i + "') e" + i;
+ }
}
- return result;
+ parameters.put("queryColumns", queryColumns);
+ parameters.put("macKey", "all");
+ List<Map<String, Object>> list = historyMapper.getAreaAllDataByAccount(parameters);
+
+ return list.get(0);
}
@Override
- public Map<String, Object> getAverageBySensor(Map<String, Object> parameters) {
+ public Map<String, Object> getDeviceRankingBySensorAverage(Map<String, Object> parameters) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
accountService.setOrgIdsByAccount(parameters);
Date date = new Date();
// ������������ -1������
- parameters.put("start", DateUtils.addHours(date, -1));
+ parameters.put("start", addHours(date, -1));
parameters.put("end", date);
- List<Map<String, Object>> averageByAll = historyMapper.getAverageByAll(parameters);
+ parameters.put("macKey", "'$."+ parameters.get("macKey")+"'");
+ List<Map<String, Object>> list = historyMapper.getAreaAllDataByAccount(parameters);
- for (Map<String, Object> map : averageByAll) {
+ for (Map<String, Object> map : list) {
result.put((String) map.get("name"), map.get("avg"));
}
return result;
@@ -80,20 +93,20 @@
Map<String, Object> resultMap = new HashMap<String, Object>();
Date date = new Date();
// ������00:00:00
- parameters.put("start", DateUtils.truncate(DateUtils.addDays(date, -1), Calendar.DATE));
+ parameters.put("start", truncate(addDays(date, -1), Calendar.DATE));
// ������00:00:00
- parameters.put("end", DateUtils.truncate(date, Calendar.DATE));
+ parameters.put("end", truncate(date, Calendar.DATE));
String[] IAQIValues = ResourceUtil.getArrValue("IAQI");
Map<String, Double> average = historyMapper.getDayAQIByDevice(parameters);
- if (ObjectUtils.isEmpty(average)) {
- resultMap.put("AQI", Constants.NULL_VALUE);
+ if (isEmpty(average)) {
+ resultMap.put("AQI", NULL_VALUE);
} else {
Set<Double> IAQIs = new HashSet<Double>();
for (Map.Entry<String, Double> entry : average.entrySet()) {
double minMacKey = 0, maxMacKey = 0, minIAQI = 0, maxIAQI = 0;
String[] macKeyValues = ResourceUtil.getArrValue(entry.getKey());
Double avg = entry.getValue();
- if (ObjectUtils.isEmpty(avg)) {
+ if (isEmpty(avg)) {
IAQIs.add(null);
} else {
int index = -1;
@@ -120,8 +133,8 @@
}
}
IAQIs.remove(null);
- if (ObjectUtils.isEmpty(IAQIs)) {
- resultMap.put("AQI", Constants.NULL_VALUE);
+ if (isEmpty(IAQIs)) {
+ resultMap.put("AQI", NULL_VALUE);
} else {
Double AQI = Collections.max(IAQIs);
if (AQI == Double.MAX_VALUE) {
@@ -138,14 +151,14 @@
public Map<String, Object> getMonthAverageBySensor(Map<String, Object> parameters) {
Map<String, Object> result = new HashMap<String, Object>();
Date date = new Date();
- Long end = DateUtils.truncate(date, Calendar.DATE).getTime(),start;
+ Long end = truncate(date, Calendar.DATE).getTime(), start;
// ���������������������������������������
if (1 == Calendar.getInstance().get(Calendar.DAY_OF_MONTH)) {
// ���������1���00:00:00
- start = DateUtils.truncate(DateUtils.addMonths(date, -1), Calendar.MONTH).getTime();
+ start = truncate(addMonths(date, -1), Calendar.MONTH).getTime();
} else {
// ���������1���00:00:00
- start = DateUtils.truncate(date, Calendar.MONTH).getTime();
+ start = truncate(date, Calendar.MONTH).getTime();
}
Aggregation aggregation = Aggregation.newAggregation(
Aggregation.match(Criteria.where("mac").is(parameters.get("mac"))),
@@ -155,8 +168,8 @@
);
AggregationResults<BasicDBObject> results = mongoTemplate.aggregate(aggregation, "data", BasicDBObject.class);
List<BasicDBObject> list = results.getMappedResults();
- if (ObjectUtils.isEmpty(list)) {
- result.put("average", Constants.NULL_VALUE);
+ if (isEmpty(list)) {
+ result.put("average", NULL_VALUE);
} else {
result = list.get(0);
result.put("average", String.format("%.2f", result.get("average")));
@@ -164,4 +177,37 @@
return result;
}
+ @Override
+ public List<Map<String, Object>> getSensorsAverageByDevice4Report(Map<String, Object> parameters,List<Map<String, Object>> sensors) {
+ Object type = parameters.get("type");
+ if ("hour".equals(type)) {
+ parameters.put("type", "%Y-%m-%d %H:00");
+ } else if ("minute".equals(type)) {
+ parameters.put("type", "%Y-%m-%d %H:%i:00");
+ } else {
+ throw new BusinessException("type���������������������");
+ }
+
+ try {
+ Date start = parseDate((String)parameters.get("time"), "yyyy-MM-dd");
+ parameters.put("start", start);
+ parameters.put("end", addDays(start, 1));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ throw new BusinessException("time���������������������");
+ }
+ String queryColumns = "";
+ for (int i = 0; i < sensors.size(); i++) {
+ String sensorKey = (String) sensors.get(i).get("key");
+ if (i == sensors.size() - 1) {
+ queryColumns += "AVG(value -> '$." + sensorKey + "') " + sensorKey;
+ } else {
+ queryColumns += "AVG(value -> '$." + sensorKey + "') " + sensorKey +",";
+ }
+ }
+ parameters.put("queryColumns", queryColumns);
+
+ return historyMapper.getSensorsAverageByDevice4Report(parameters);
+ }
+
}
diff --git a/src/main/java/com/moral/service/impl/OrganizationServiceImpl.java b/src/main/java/com/moral/service/impl/OrganizationServiceImpl.java
index 0ee4d6d..ba62670 100644
--- a/src/main/java/com/moral/service/impl/OrganizationServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/OrganizationServiceImpl.java
@@ -1,5 +1,7 @@
package com.moral.service.impl;
+import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
+
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -13,7 +15,6 @@
import com.moral.mapper.OrganizationMapper;
import com.moral.mapper.OrganizationRelationMapper;
import com.moral.service.OrganizationService;
-import com.moral.util.Constants;
@Service
public class OrganizationServiceImpl implements OrganizationService {
@@ -31,7 +32,7 @@
OrganizationRelationExample example = new OrganizationRelationExample();
example.or().andParentIdEqualTo(orgId);
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
- if (Constants.IS_DELETE_FALSE.equals(organization.getIsDelete())) {
+ if (IS_DELETE_FALSE.equals(organization.getIsDelete())) {
List<OrganizationRelation> organizationRelations = organizationRelationMapper.selectByExample(example);
for (OrganizationRelation organizationRelation : organizationRelations) {
Set<Integer> organizationIds = getChildOrganizationIds(organizationRelation.getParentId());
diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index 846d2b7..d9ff9bf 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -1,344 +1,430 @@
-<?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.moral.mapper.DeviceMapper" >
- <resultMap id="BaseResultMap" type="com.moral.entity.Device" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="name" property="name" jdbcType="VARCHAR" />
- <result column="address" property="address" jdbcType="VARCHAR" />
- <result column="longitude" property="longitude" jdbcType="REAL" />
- <result column="latitude" property="latitude" jdbcType="REAL" />
- <result column="mac" property="mac" jdbcType="VARCHAR" />
- <result column="state" property="state" jdbcType="CHAR" />
- <result column="operate_user_id" property="operateUserId" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="install_time" property="installTime" jdbcType="TIMESTAMP" />
- <result column="monitor_point_id" property="monitorPointId" jdbcType="INTEGER" />
- <result column="device_version_id" property="deviceVersionId" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Example_Where_Clause" >
- <where >
- <foreach collection="oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause" >
- <where >
- <foreach collection="example.oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List" >
- id, name, address, longitude, latitude, mac, state, operate_user_id, create_time,
- install_time, monitor_point_id, device_version_id
- </sql>
- <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.entity.DeviceExample" >
- select
- <if test="distinct" >
- distinct
- </if>
- <include refid="Base_Column_List" />
- from device
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null" >
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from device
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from device
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <delete id="deleteByExample" parameterType="com.moral.entity.DeviceExample" >
- delete from device
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.moral.entity.Device" >
- insert into device (id, name, address,
- longitude, latitude, mac,
- state, operate_user_id, create_time,
- install_time, monitor_point_id, device_version_id
- )
- values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
- #{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{mac,jdbcType=VARCHAR},
- #{state,jdbcType=CHAR}, #{operateUserId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
- #{installTime,jdbcType=TIMESTAMP}, #{monitorPointId,jdbcType=INTEGER}, #{deviceVersionId,jdbcType=INTEGER}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.moral.entity.Device" >
- insert into device
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="name != null" >
- name,
- </if>
- <if test="address != null" >
- address,
- </if>
- <if test="longitude != null" >
- longitude,
- </if>
- <if test="latitude != null" >
- latitude,
- </if>
- <if test="mac != null" >
- mac,
- </if>
- <if test="state != null" >
- state,
- </if>
- <if test="operateUserId != null" >
- operate_user_id,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="installTime != null" >
- install_time,
- </if>
- <if test="monitorPointId != null" >
- monitor_point_id,
- </if>
- <if test="deviceVersionId != null" >
- device_version_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=INTEGER},
- </if>
- <if test="name != null" >
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="address != null" >
- #{address,jdbcType=VARCHAR},
- </if>
- <if test="longitude != null" >
- #{longitude,jdbcType=REAL},
- </if>
- <if test="latitude != null" >
- #{latitude,jdbcType=REAL},
- </if>
- <if test="mac != null" >
- #{mac,jdbcType=VARCHAR},
- </if>
- <if test="state != null" >
- #{state,jdbcType=CHAR},
- </if>
- <if test="operateUserId != null" >
- #{operateUserId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="installTime != null" >
- #{installTime,jdbcType=TIMESTAMP},
- </if>
- <if test="monitorPointId != null" >
- #{monitorPointId,jdbcType=INTEGER},
- </if>
- <if test="deviceVersionId != null" >
- #{deviceVersionId,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.moral.entity.DeviceExample" resultType="java.lang.Integer" >
- select count(*) from device
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map" >
- update device
- <set >
- <if test="record.id != null" >
- id = #{record.id,jdbcType=INTEGER},
- </if>
- <if test="record.name != null" >
- name = #{record.name,jdbcType=VARCHAR},
- </if>
- <if test="record.address != null" >
- address = #{record.address,jdbcType=VARCHAR},
- </if>
- <if test="record.longitude != null" >
- longitude = #{record.longitude,jdbcType=REAL},
- </if>
- <if test="record.latitude != null" >
- latitude = #{record.latitude,jdbcType=REAL},
- </if>
- <if test="record.mac != null" >
- mac = #{record.mac,jdbcType=VARCHAR},
- </if>
- <if test="record.state != null" >
- state = #{record.state,jdbcType=CHAR},
- </if>
- <if test="record.operateUserId != null" >
- operate_user_id = #{record.operateUserId,jdbcType=INTEGER},
- </if>
- <if test="record.createTime != null" >
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.installTime != null" >
- install_time = #{record.installTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.monitorPointId != null" >
- monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER},
- </if>
- <if test="record.deviceVersionId != null" >
- device_version_id = #{record.deviceVersionId,jdbcType=INTEGER},
- </if>
- </set>
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map" >
- update device
- set id = #{record.id,jdbcType=INTEGER},
- name = #{record.name,jdbcType=VARCHAR},
- address = #{record.address,jdbcType=VARCHAR},
- longitude = #{record.longitude,jdbcType=REAL},
- latitude = #{record.latitude,jdbcType=REAL},
- mac = #{record.mac,jdbcType=VARCHAR},
- state = #{record.state,jdbcType=CHAR},
- operate_user_id = #{record.operateUserId,jdbcType=INTEGER},
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- install_time = #{record.installTime,jdbcType=TIMESTAMP},
- monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER},
- device_version_id = #{record.deviceVersionId,jdbcType=INTEGER}
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Device" >
- update device
- <set >
- <if test="name != null" >
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="address != null" >
- address = #{address,jdbcType=VARCHAR},
- </if>
- <if test="longitude != null" >
- longitude = #{longitude,jdbcType=REAL},
- </if>
- <if test="latitude != null" >
- latitude = #{latitude,jdbcType=REAL},
- </if>
- <if test="mac != null" >
- mac = #{mac,jdbcType=VARCHAR},
- </if>
- <if test="state != null" >
- state = #{state,jdbcType=CHAR},
- </if>
- <if test="operateUserId != null" >
- operate_user_id = #{operateUserId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="installTime != null" >
- install_time = #{installTime,jdbcType=TIMESTAMP},
- </if>
- <if test="monitorPointId != null" >
- monitor_point_id = #{monitorPointId,jdbcType=INTEGER},
- </if>
- <if test="deviceVersionId != null" >
- device_version_id = #{deviceVersionId,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.moral.entity.Device" >
- update device
- set name = #{name,jdbcType=VARCHAR},
- address = #{address,jdbcType=VARCHAR},
- longitude = #{longitude,jdbcType=REAL},
- latitude = #{latitude,jdbcType=REAL},
- mac = #{mac,jdbcType=VARCHAR},
- state = #{state,jdbcType=CHAR},
- operate_user_id = #{operateUserId,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- install_time = #{installTime,jdbcType=TIMESTAMP},
- monitor_point_id = #{monitorPointId,jdbcType=INTEGER},
- device_version_id = #{deviceVersionId,jdbcType=INTEGER}
- where id = #{id,jdbcType=INTEGER}
- </update>
-
- <select id="getDeviceStates" resultType="map">
- SELECT
- COUNT( d.state ) count,
- d.state
- FROM
- device d
- <if test="orgIds != null and orgIds.size > 0">
- ,monitor_point mp,
- monitor_point_organization mpo
- WHERE
- d.monitor_point_id = mp.id
- AND mp.id = mpo.monitor_point_id
- AND mpo.organization_id IN
- <foreach collection="orgIds" item="listItem" open="(" separator="," close=")" >
- #{listItem}
- </foreach>
- </if>
- GROUP BY d.state
- </select>
-
+<?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.moral.mapper.DeviceMapper">
+ <resultMap id="BaseResultMap" type="com.moral.entity.Device">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ <id column="id" jdbcType="INTEGER" property="id" />
+ <result column="name" jdbcType="VARCHAR" property="name" />
+ <result column="address" jdbcType="VARCHAR" property="address" />
+ <result column="longitude" jdbcType="REAL" property="longitude" />
+ <result column="latitude" jdbcType="REAL" property="latitude" />
+ <result column="mac" jdbcType="VARCHAR" property="mac" />
+ <result column="operate_user_id" jdbcType="INTEGER" property="operateUserId" />
+ <result column="state" jdbcType="CHAR" property="state" />
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+ <result column="install_time" jdbcType="TIMESTAMP" property="installTime" />
+ <result column="monitor_point_id" jdbcType="INTEGER" property="monitorPointId" />
+ <result column="device_version_id" jdbcType="INTEGER" property="deviceVersionId" />
+ </resultMap>
+ <sql id="Example_Where_Clause">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ <where>
+ <foreach collection="oredCriteria" item="criteria" separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" prefixOverrides="and" suffix=")">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Update_By_Example_Where_Clause">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ <where>
+ <foreach collection="example.oredCriteria" item="criteria" separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" prefixOverrides="and" suffix=")">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Base_Column_List">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ id, name, address, longitude, latitude, mac, operate_user_id, state, create_time,
+ install_time, monitor_point_id, device_version_id
+ </sql>
+ <select id="selectByExample" parameterType="com.moral.entity.DeviceExample" resultMap="BaseResultMap">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ select
+ <if test="distinct">
+ distinct
+ </if>
+ <include refid="Base_Column_List" />
+ from device
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ <if test="orderByClause != null">
+ order by ${orderByClause}
+ </if>
+ </select>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ select
+ <include refid="Base_Column_List" />
+ from device
+ where id = #{id,jdbcType=INTEGER}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ delete from device
+ where id = #{id,jdbcType=INTEGER}
+ </delete>
+ <delete id="deleteByExample" parameterType="com.moral.entity.DeviceExample">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ delete from device
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </delete>
+ <insert id="insert" parameterType="com.moral.entity.Device">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ insert into device (id, name, address,
+ longitude, latitude, mac,
+ operate_user_id, state, create_time,
+ install_time, monitor_point_id, device_version_id
+ )
+ values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
+ #{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{mac,jdbcType=VARCHAR},
+ #{operateUserId,jdbcType=INTEGER}, #{state,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP},
+ #{installTime,jdbcType=TIMESTAMP}, #{monitorPointId,jdbcType=INTEGER}, #{deviceVersionId,jdbcType=INTEGER}
+ )
+ </insert>
+ <insert id="insertSelective" parameterType="com.moral.entity.Device">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ insert into device
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="name != null">
+ name,
+ </if>
+ <if test="address != null">
+ address,
+ </if>
+ <if test="longitude != null">
+ longitude,
+ </if>
+ <if test="latitude != null">
+ latitude,
+ </if>
+ <if test="mac != null">
+ mac,
+ </if>
+ <if test="operateUserId != null">
+ operate_user_id,
+ </if>
+ <if test="state != null">
+ state,
+ </if>
+ <if test="createTime != null">
+ create_time,
+ </if>
+ <if test="installTime != null">
+ install_time,
+ </if>
+ <if test="monitorPointId != null">
+ monitor_point_id,
+ </if>
+ <if test="deviceVersionId != null">
+ device_version_id,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=INTEGER},
+ </if>
+ <if test="name != null">
+ #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="address != null">
+ #{address,jdbcType=VARCHAR},
+ </if>
+ <if test="longitude != null">
+ #{longitude,jdbcType=REAL},
+ </if>
+ <if test="latitude != null">
+ #{latitude,jdbcType=REAL},
+ </if>
+ <if test="mac != null">
+ #{mac,jdbcType=VARCHAR},
+ </if>
+ <if test="operateUserId != null">
+ #{operateUserId,jdbcType=INTEGER},
+ </if>
+ <if test="state != null">
+ #{state,jdbcType=CHAR},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="installTime != null">
+ #{installTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="monitorPointId != null">
+ #{monitorPointId,jdbcType=INTEGER},
+ </if>
+ <if test="deviceVersionId != null">
+ #{deviceVersionId,jdbcType=INTEGER},
+ </if>
+ </trim>
+ </insert>
+ <select id="countByExample" parameterType="com.moral.entity.DeviceExample" resultType="java.lang.Integer">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ select count(*) from device
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </select>
+ <update id="updateByExampleSelective" parameterType="map">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ update device
+ <set>
+ <if test="record.id != null">
+ id = #{record.id,jdbcType=INTEGER},
+ </if>
+ <if test="record.name != null">
+ name = #{record.name,jdbcType=VARCHAR},
+ </if>
+ <if test="record.address != null">
+ address = #{record.address,jdbcType=VARCHAR},
+ </if>
+ <if test="record.longitude != null">
+ longitude = #{record.longitude,jdbcType=REAL},
+ </if>
+ <if test="record.latitude != null">
+ latitude = #{record.latitude,jdbcType=REAL},
+ </if>
+ <if test="record.mac != null">
+ mac = #{record.mac,jdbcType=VARCHAR},
+ </if>
+ <if test="record.operateUserId != null">
+ operate_user_id = #{record.operateUserId,jdbcType=INTEGER},
+ </if>
+ <if test="record.state != null">
+ state = #{record.state,jdbcType=CHAR},
+ </if>
+ <if test="record.createTime != null">
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.installTime != null">
+ install_time = #{record.installTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.monitorPointId != null">
+ monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER},
+ </if>
+ <if test="record.deviceVersionId != null">
+ device_version_id = #{record.deviceVersionId,jdbcType=INTEGER},
+ </if>
+ </set>
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByExample" parameterType="map">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ update device
+ set id = #{record.id,jdbcType=INTEGER},
+ name = #{record.name,jdbcType=VARCHAR},
+ address = #{record.address,jdbcType=VARCHAR},
+ longitude = #{record.longitude,jdbcType=REAL},
+ latitude = #{record.latitude,jdbcType=REAL},
+ mac = #{record.mac,jdbcType=VARCHAR},
+ operate_user_id = #{record.operateUserId,jdbcType=INTEGER},
+ state = #{record.state,jdbcType=CHAR},
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
+ install_time = #{record.installTime,jdbcType=TIMESTAMP},
+ monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER},
+ device_version_id = #{record.deviceVersionId,jdbcType=INTEGER}
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Device">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ update device
+ <set>
+ <if test="name != null">
+ name = #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="address != null">
+ address = #{address,jdbcType=VARCHAR},
+ </if>
+ <if test="longitude != null">
+ longitude = #{longitude,jdbcType=REAL},
+ </if>
+ <if test="latitude != null">
+ latitude = #{latitude,jdbcType=REAL},
+ </if>
+ <if test="mac != null">
+ mac = #{mac,jdbcType=VARCHAR},
+ </if>
+ <if test="operateUserId != null">
+ operate_user_id = #{operateUserId,jdbcType=INTEGER},
+ </if>
+ <if test="state != null">
+ state = #{state,jdbcType=CHAR},
+ </if>
+ <if test="createTime != null">
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="installTime != null">
+ install_time = #{installTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="monitorPointId != null">
+ monitor_point_id = #{monitorPointId,jdbcType=INTEGER},
+ </if>
+ <if test="deviceVersionId != null">
+ device_version_id = #{deviceVersionId,jdbcType=INTEGER},
+ </if>
+ </set>
+ where id = #{id,jdbcType=INTEGER}
+ </update>
+ <update id="updateByPrimaryKey" parameterType="com.moral.entity.Device">
+ <!--
+ WARNING - @mbggenerated
+ This element is automatically generated by MyBatis Generator, do not modify.
+ This element was generated on Wed Nov 29 16:17:59 CST 2017.
+ -->
+ update device
+ set name = #{name,jdbcType=VARCHAR},
+ address = #{address,jdbcType=VARCHAR},
+ longitude = #{longitude,jdbcType=REAL},
+ latitude = #{latitude,jdbcType=REAL},
+ mac = #{mac,jdbcType=VARCHAR},
+ operate_user_id = #{operateUserId,jdbcType=INTEGER},
+ state = #{state,jdbcType=CHAR},
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+ install_time = #{installTime,jdbcType=TIMESTAMP},
+ monitor_point_id = #{monitorPointId,jdbcType=INTEGER},
+ device_version_id = #{deviceVersionId,jdbcType=INTEGER}
+ where id = #{id,jdbcType=INTEGER}
+ </update>
+ <select id="getDeviceStatesByAccount" resultType="map">
+ SELECT
+ COUNT( d.state ) count,
+ d.state
+ FROM
+ device d
+ <if test="orgIds != null and orgIds.size > 0">
+ ,monitor_point mp
+ WHERE
+ d.monitor_point_id = mp.id
+ AND mp.organization_id IN
+ <foreach close=")" collection="orgIds" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </if>
+ GROUP BY d.state
+ </select>
+ <select id="getSensorsByDevice" resultType="map">
+ SELECT
+ s.`key`,
+ s.`name`
+ FROM
+ sensor s,
+ device d,
+ device_version_sensor dvs
+ WHERE
+ d.mac = #{mac}
+ AND d.device_version_id = dvs.version_id
+ AND dvs.sensor_id = s.id
+ ORDER BY
+ s.id
+ </select>
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml
index 5f805da..b5027bc 100644
--- a/src/main/resources/mapper/HistoryMapper.xml
+++ b/src/main/resources/mapper/HistoryMapper.xml
@@ -1,376 +1,90 @@
<?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.moral.mapper.HistoryMapper">
- <resultMap id="BaseResultMap" type="com.moral.entity.History">
- <result column="mac" jdbcType="VARCHAR" property="mac" />
- <result column="value" jdbcType="OTHER" property="value" />
- <result column="time" jdbcType="TIMESTAMP" property="time" />
- <result column="version" jdbcType="INTEGER" property="version" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- mac, value, time, version
- </sql>
- <select id="selectByExample" parameterType="com.moral.entity.HistoryExample" resultMap="BaseResultMap">
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <delete id="deleteByExample" parameterType="com.moral.entity.HistoryExample">
- delete from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.moral.entity.History">
- insert into history (mac, value, time,
- version)
- values (#{mac,jdbcType=VARCHAR}, #{value,jdbcType=OTHER}, #{time,jdbcType=TIMESTAMP},
- #{version,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.moral.entity.History">
- insert into history
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="mac != null">
- mac,
- </if>
- <if test="value != null">
- value,
- </if>
- <if test="time != null">
- time,
- </if>
- <if test="version != null">
- version,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="mac != null">
- #{mac,jdbcType=VARCHAR},
- </if>
- <if test="value != null">
- #{value,jdbcType=OTHER},
- </if>
- <if test="time != null">
- #{time,jdbcType=TIMESTAMP},
- </if>
- <if test="version != null">
- #{version,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.moral.entity.HistoryExample" resultType="java.lang.Integer">
- select count(*) from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- update history
- <set>
- <if test="record.mac != null">
- mac = #{record.mac,jdbcType=VARCHAR},
- </if>
- <if test="record.value != null">
- value = #{record.value,jdbcType=OTHER},
- </if>
- <if test="record.time != null">
- time = #{record.time,jdbcType=TIMESTAMP},
- </if>
- <if test="record.version != null">
- version = #{record.version,jdbcType=INTEGER},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- update history
- set mac = #{record.mac,jdbcType=VARCHAR},
- value = #{record.value,jdbcType=OTHER},
- time = #{record.time,jdbcType=TIMESTAMP},
- version = #{record.version,jdbcType=INTEGER}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <resultMap id="BaseResultMap" type="com.moral.entity.History">
- <result column="device_mac" jdbcType="VARCHAR" property="deviceMac" />
- <result column="value" jdbcType="OTHER" property="value" />
- <result column="time" jdbcType="TIMESTAMP" property="time" />
- <result column="version" jdbcType="VARCHAR" property="version" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- device_mac, value, time, version
- </sql>
- <select id="selectByExample" parameterType="com.moral.entity.HistoryExample" resultMap="BaseResultMap">
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <delete id="deleteByExample" parameterType="com.moral.entity.HistoryExample">
- delete from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.moral.entity.History">
- insert into history (device_mac, value, time,
- version)
- values (#{deviceMac,jdbcType=VARCHAR}, #{value,jdbcType=OTHER}, #{time,jdbcType=TIMESTAMP},
- #{version,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.moral.entity.History">
- insert into history
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="deviceMac != null">
- device_mac,
- </if>
- <if test="value != null">
- value,
- </if>
- <if test="time != null">
- time,
- </if>
- <if test="version != null">
- version,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="deviceMac != null">
- #{deviceMac,jdbcType=VARCHAR},
- </if>
- <if test="value != null">
- #{value,jdbcType=OTHER},
- </if>
- <if test="time != null">
- #{time,jdbcType=TIMESTAMP},
- </if>
- <if test="version != null">
- #{version,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.moral.entity.HistoryExample" resultType="java.lang.Integer">
- select count(*) from history
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- update history
- <set>
- <if test="record.deviceMac != null">
- device_mac = #{record.deviceMac,jdbcType=VARCHAR},
- </if>
- <if test="record.value != null">
- value = #{record.value,jdbcType=OTHER},
- </if>
- <if test="record.time != null">
- time = #{record.time,jdbcType=TIMESTAMP},
- </if>
- <if test="record.version != null">
- version = #{record.version,jdbcType=VARCHAR},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- update history
- set device_mac = #{record.deviceMac,jdbcType=VARCHAR},
- value = #{record.value,jdbcType=OTHER},
- time = #{record.time,jdbcType=TIMESTAMP},
- version = #{record.version,jdbcType=VARCHAR}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <select id="getDayAQIBySensor" resultType="map">
+ <select id="getDayAQIByDevice" resultType="map">
SELECT
- AVG(value -> '$.e1') e1,
- AVG(value -> '$.e2') e2,
- AVG(value -> '$.e10') e10,
- AVG(value -> '$.e11') e11,
- AVG(value -> '$.e15') e15,
- AVG(value -> '$.e16') e16
+ AVG(value -> '$.e1') e1,
+ AVG(value -> '$.e2') e2,
+ AVG(value -> '$.e10') e10,
+ AVG(value -> '$.e11') e11,
+ AVG(value -> '$.e15') e15,
+ AVG(value -> '$.e16') e16
FROM
history
WHERE
- device_mac = #{mac}
+ mac = #{mac}
AND time > #{start}
AND time < #{end}
</select>
- <select id="getAverageByAll" resultType="map">
- SELECT
- <if test="macKey != null and macKey != 'all'">
- e.name,
- </if>
- <if test="macKey == 'all'">
- h.mac_key,
- </if>
- AVG(h.mac_value) avg
- FROM
- history h,
- monitorpoint m,
- equipment e
- WHERE
- m.areacode = #{areaCode}
- AND m.id = epoint
- AND e.mac = h.mac
- AND h.time > #{start}
- AND h.time < #{end}
- <if test="orgIds != null and orgIds.size > 0">
- <!-- JOIN org_equ oe ON e.id = oe.equid -->
- AND e.owner_id IN
- <foreach close=")" collection="orgIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="macKey != null and macKey != 'all'">
- AND h.mac_key = #{macKey}
- GROUP BY e.id
- ORDER BY avg
- </if>
- <if test="macKey == 'all'">
- GROUP BY h.mac_key
- </if>
- </select>
+ <select id="getAllSensorAverageByDevice" resultType="java.util.LinkedHashMap">
+ SELECT
+ ${queryColumns}
+ FROM
+ history h,
+ device d,
+ monitor_point mp
+ <if test="orgIds != null and orgIds.size > 0">
+ LEFT JOIN monitor_point_organization mpo ON mpo.monitor_point_id = mp.id
+ AND mpo.organization_id IN
+ <foreach close=")" collection="orgIds" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </if>
+ WHERE
+ mp.area_code = #{areaCode}
+ AND h.time > #{start}
+ AND h.time < #{end}
+ AND h.mac = d.mac
+ AND d.monitor_point_id = mp.id
+ </select>
+
+ <select id="getAreaAllDataByAccount" resultType="java.util.LinkedHashMap">
+ SELECT
+ <if test="macKey == 'all'">
+ ${queryColumns}
+ </if>
+ <if test="macKey != 'all'">
+ d.`name`,
+ AVG( h.`value` -> ${macKey}) avg
+ </if>
+ FROM
+ history h,
+ device d,
+ monitor_point mp
+ WHERE
+ mp.area_code = #{areaCode}
+ AND h.time > #{start}
+ AND h.time < #{end}
+ <if test="orgIds != null and orgIds.size > 0">
+ AND mp.organization_id IN
+ <foreach close=")" collection="orgIds" item="listItem" open="(" separator=",">
+ #{listItem}
+ </foreach>
+ </if>
+ AND h.mac = d.mac
+ AND d.monitor_point_id = mp.id
+ <if test="macKey != 'all'">
+ GROUP BY d.id
+ ORDER BY avg desc
+ </if>
+ </select>
+
+ <select id="getSensorsAverageByDevice4Report" resultType="map">
+ SELECT
+ DATE_FORMAT(time, #{type}) time,
+ ${queryColumns}
+ FROM
+ history h
+ WHERE
+ h.mac = #{mac}
+ AND h.time >= #{start}
+ AND h.time < #{end}
+ GROUP BY
+ DATE_FORMAT(time, #{type})
+ ORDER BY
+ time
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/system/alarmLevels.json b/src/main/resources/system/alarmLevels.json
index 5ff876f..88e94de 100644
--- a/src/main/resources/system/alarmLevels.json
+++ b/src/main/resources/system/alarmLevels.json
@@ -2,96 +2,115 @@
"e1":{
"level1":35,
"level2":115,
- "level3":250
+ "level3":250,
+ "enable":1
},
"e2":{
"level1":50,
"level2":250,
- "level3":420
+ "level3":420,
+ "enable":1
},
"e3":{
- "level1":2000,
- "level2":5000,
- "level3":8000
+ "level1":20000,
+ "level2":30000,
+ "level3":40000,
+ "enable":0
},
"e4":{
- "level1":10,
- "level2":30,
- "level3":60
+ "level1":30,
+ "level2":75,
+ "level3":100,
+ "enable":0
},
"e5":{
"level1":0.01,
"level2":0.02,
- "level3":0.05
+ "level3":0.05,
+ "enable":0
},
"e6":{
"level1":60,
"level2":100,
- "level3":160
+ "level3":160,
+ "enable":0
},
"e7":{
"level1":35,
"level2":30,
- "level3":40
+ "level3":40,
+ "enable":0
},
"e8":{
"level1":30,
"level2":40,
- "level3":50
+ "level3":50,
+ "enable":0
},
"e9":{
"level1":0.01,
"level2":0.02,
- "level3":0.03
+ "level3":0.03,
+ "enable":0
},
"e10":{
"level1":2,
"level2":14,
- "level3":36
+ "level3":36,
+ "enable":1
},
"e11":{
- "level1":0.05,
- "level2":0.475,
- "level3":1.6
+ "level1":50,
+ "level2":475,
+ "level3":1600,
+ "enable":1
},
"e12":{
"level1":10000,
"level2":15000,
- "level3":25000
+ "level3":20000,
+ "enable":0
},
"e13":{
- "level1":30,
- "level2":50,
- "level3":90
+ "level1":60,
+ "level2":90,
+ "level3":120,
+ "enable":0
},
"e14":{
- "level1":2,
- "level2":4,
- "level3":6
+ "level1":100,
+ "level2":200,
+ "level3":300,
+ "enable":0
},
"e15":{
- "level1":0.16,
- "level2":0.3,
- "level3":0.8
+ "level1":160,
+ "level2":300,
+ "level3":800,
+ "enable":1
},
"e16":{
- "level1":0.04,
- "level2":0.18,
- "level3":0.565
+ "level1":40,
+ "level2":180,
+ "level3":565,
+ "enable":1
},
"e17":{
- "level1":1,
- "level2":2,
- "level3":5
+ "level1":1.5,
+ "level2":3,
+ "level3":5,
+ "enable":0
},
"e18":{
"level1":5,
"level2":6,
- "level3":8
+ "level3":8,
+ "enable":0
},
"e19":{
- "level1":480,
- "level2":580,
- "level3":680
+ "level1":3000,
+ "level2":4000,
+ "level3":5000,
+ "enable":0
}
}
\ No newline at end of file
--
Gitblit v1.8.0