| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.moral.mapper.DeviceMapper; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | public class DeviceController { |
| | | @Resource |
| | | DeviceService deviceService; |
| | | @Resource |
| | | DeviceMapper deviceMapper; |
| | | @GetMapping("count-by-example") |
| | | public ResultBean<Integer> countByExample(PageBean pageBean){ |
| | | return new ResultBean<Integer>(deviceService.countByExample(pageBean)); |
| | |
| | | return new ResultBean<List<Device>>(devices); |
| | | } |
| | | |
| | | @GetMapping("getDeviceByMonitorId") |
| | | public ResultBean<List<Map<String, Object>>> getDeviceByMonitorId() { |
| | | List<Map<String, Object>> devices = deviceMapper.getDevicesByMpId(563); |
| | | return new ResultBean<List<Map<String, Object>>>(devices); |
| | | } |
| | | |
| | | @PostMapping("save-or-update") |
| | | public ResultBean saveOrUpdate(@RequestBody String jsonString){ |
| | | Device device = JSONObject.parseObject(jsonString, Device.class); |
| | |
| | | return new ResultBean<List<Sensor>>(sensors); |
| | | } |
| | | |
| | | @GetMapping("allById") |
| | | public ResultBean<List<Map<String, Object>>> getAllSensorsById() { |
| | | List<Map<String, Object>> sensors = sensorService.getSensorByDId("1230"); |
| | | return new ResultBean<List<Map<String, Object>>>(sensors); |
| | | } |
| | | |
| | | @GetMapping("getSenosrsByOrgId") |
| | | public ResultBean<List<Sensor>> getSenosrsByOrgId(Integer organizationId, String regionCode) { |
| | | Map<String, Object> parameters = new HashMap<>(); |
| | |
| | | List<Sensor> selectSenosrsByOrgId(Map<String, Object> parameters); |
| | | |
| | | List<String> getSensorKeys(); |
| | | |
| | | List<Map<String, Object>> getSensorByDId(String id); |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> getSensorByDeviceId(String id); |
| | | |
| | | List<Map<String, Object>> getSensorByDId(String id); |
| | | |
| | | List<Map<String, Object>> getSensorByMonitorPointId(String monitor_point_id); |
| | | |
| | | Map<String, String> getSensorsMap(Map<String, Object> parameters) throws Exception; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSensorByDId(String id) { |
| | | List<Map<String, Object>> list = sensorMapper.getSensorByDId(id); |
| | | return list; |
| | | } |
| | | @Override |
| | | public List<Map<String, Object>> getSensorByMonitorPointId(String monitor_point_id) { |
| | | List<Map<String, Object>> list = sensorMapper.getSensorByMonitorPointId(monitor_point_id); |
| | | return list; |
| | |
| | | AND d.id = #{id} |
| | | </select> |
| | | |
| | | <select id="getSensorByDId" resultType="java.util.Map"> |
| | | SELECT DISTINCT d.monitor_point_id,s.* |
| | | FROM device d,device_version dv,device_version_sensor dvs,sensor s |
| | | WHERE d.device_version_id = dvs.device_version_id |
| | | AND dvs.sensor_id = s.id |
| | | AND d.id = #{id} |
| | | </select> |
| | | |
| | | |
| | | <select id="getSensorByMonitorPointId" resultType="java.util.Map"> |
| | | SELECT DISTINCT s.sensor_key sensorKey,s.unit,s.name,s.description,s.id |
| | | FROM device d,device_version dv,device_version_sensor dvs,sensor s |