From 2f6f3f994a8df81bd3dfa873e165d46b198c189c Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 22 Jun 2018 13:44:31 +0800 Subject: [PATCH] 地区枚举实现 --- src/main/java/com/moral/controller/MobileController.java | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/moral/controller/MobileController.java b/src/main/java/com/moral/controller/MobileController.java index 1e290e6..b9f1174 100644 --- a/src/main/java/com/moral/controller/MobileController.java +++ b/src/main/java/com/moral/controller/MobileController.java @@ -74,7 +74,14 @@ OperateUser operateUser = operateUserService.updatePassword(uid,password,newpassword); return new AppData<OperateUser>(operateUser); } - + /** + * ������ ������id ��������������������� + */ + @RequestMapping("deviceInfo") + public AppData<Device> deviceInfo(Integer id){ + Device device = deviceService.queryById(id); + return new AppData<Device>(device); + } /** * * @param equDeviceAdapter @@ -82,7 +89,7 @@ */ @RequestMapping("reportDevice") public AppData<String> installDevice(EquDeviceAdapter equDeviceAdapter) { - deviceService.saveOrUpdateDevice(equDeviceAdapter.toDevice()); + deviceService.addOrModify(equDeviceAdapter.toDevice()); return new AppData<String>(""); } @@ -110,10 +117,14 @@ @RequestMapping("getEquInfoByMac") public AppData<Map> getDeviceByMac(@RequestParam(value="mac", required=true)String mac) { Device device = deviceService.getDeviceByMac(mac,false);//��������������� - Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device)); - deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint")); - deviceMap.remove("monitorPoint"); - return new AppData<Map>(deviceMap); + if(device!=null){ + Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device)); + deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint")); + deviceMap.remove("monitorPoint"); + return new AppData<Map>(deviceMap); + }else{ + return new AppData("mac���������������",AppData.FAIL); + } } /** -- Gitblit v1.8.0