src/main/java/com/moral/controller/DeviceController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/controller/MonitorPointController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/controller/SensorController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/entity/Device.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/DeviceService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/MonitorPointService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/SensorService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/impl/DeviceServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/impl/SensorServiceImpl.java | ●●●●● patch | view | raw | blame | history |
src/main/java/com/moral/controller/DeviceController.java
@@ -6,6 +6,8 @@ import com.moral.service.DeviceService; import org.springframework.web.bind.annotation.*; import java.util.List; import javax.annotation.Resource; @RestController @@ -30,4 +32,11 @@ ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); return resultBean; } @GetMapping("monitorPointId") public ResultBean<List<Device>> getDevicesByMonitorPointId(@RequestParam(name="monitorPointId")Integer monitorPointId) { List<Device> devices = deviceService.getDevicesByMonitorPointId(monitorPointId); return new ResultBean<List<Device>>(devices); } } src/main/java/com/moral/controller/MonitorPointController.java
@@ -6,6 +6,8 @@ import com.moral.service.MonitorPointService; import org.springframework.web.bind.annotation.*; import java.util.List; import javax.annotation.Resource; @@ -44,4 +46,11 @@ ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); return resultBean; } @GetMapping("list/{name}") public ResultBean<List<MonitorPoint>> getMonitorPointsByName(@PathVariable("name") String name) { List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsByName(name); return new ResultBean<List<MonitorPoint>>(monitorPoints); } } src/main/java/com/moral/controller/SensorController.java
@@ -31,4 +31,11 @@ ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); return resultBean; } @GetMapping("all") public ResultBean<List<Sensor>> getAllSensors() { List<Sensor> sensors = sensorService.getAllSensors(); return new ResultBean<List<Sensor>>(sensors); } } src/main/java/com/moral/entity/Device.java
@@ -32,12 +32,12 @@ * 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 double longitude; private Double 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 double latitude; private Double 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 src/main/java/com/moral/service/DeviceService.java
@@ -22,4 +22,6 @@ void deleteByIds(Integer[] ids); void addOrModify(Device device); List<Device> getDevicesByMonitorPointId(Integer monitorPointId); } src/main/java/com/moral/service/MonitorPointService.java
@@ -16,4 +16,7 @@ public void addOrModify(MonitorPoint monitorPoint); public void deleteByIds(Integer... ids); List<MonitorPoint> getMonitorPointsByName(String name); } src/main/java/com/moral/service/SensorService.java
@@ -1,5 +1,7 @@ package com.moral.service; import java.util.List; import com.moral.common.bean.PageBean; import com.moral.entity.Sensor; @@ -7,4 +9,6 @@ public PageBean queryByPageBean(PageBean pageBean); public void addOrModify(Sensor sensor); public void deleteByIds(Integer... ids); public List<Sensor> getAllSensors(); } src/main/java/com/moral/service/impl/DeviceServiceImpl.java
@@ -151,5 +151,12 @@ } } @Override public List<Device> getDevicesByMonitorPointId(Integer monitorPointId) { Device device = new Device(); device.setMonitorPointId(monitorPointId); device.setIsDelete(Constants.IS_DELETE_FALSE); return deviceMapper.select(device); } } src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
@@ -18,6 +18,7 @@ import com.moral.mapper.MonitorPointMapper; import com.moral.service.MonitorPointService; import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example.Criteria; @Service public class MonitorPointServiceImpl implements MonitorPointService { @@ -83,4 +84,15 @@ } } @Override public List<MonitorPoint> getMonitorPointsByName(String name) { Example example = new Example(MonitorPoint.class); Criteria criteria = example.createCriteria(); criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andLike("name", "%" + name + "%"); example.or().andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andCondition("getPY(name) like ", "%" + name + "%"); List<MonitorPoint> monitorPoints = monitorPointMapper.selectByExample(example); return monitorPoints; } } src/main/java/com/moral/service/impl/SensorServiceImpl.java
@@ -10,6 +10,7 @@ import javax.annotation.Resource; import java.util.Arrays; import java.util.List; @Service public class SensorServiceImpl implements SensorService{ @@ -46,4 +47,9 @@ } } @Override public List<Sensor> getAllSensors() { return sensorMapper.selectAll(); } }