| | |
| | | package com.moral.controller; |
| | | |
| | | import com.moral.common.bean.PageBean; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.entity.Device; |
| | | import com.moral.service.DeviceService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.moral.common.util.WebUtils.getParametersStartingWith; |
| | | |
| | | import java.util.Date; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.moral.common.bean.PageBean; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.entity.Device; |
| | | import com.moral.entity.DeviceProperty; |
| | | import com.moral.service.DeviceService; |
| | | |
| | | @RestController |
| | | @RequestMapping("device") |
| | |
| | | List<Device> devices = deviceService.getDevicesByProfessionId(parameters); |
| | | return new ResultBean<List<Device>>(devices); |
| | | } |
| | | |
| | | @PostMapping("save-or-update") |
| | | public ResultBean saveOrUpdate(@RequestBody String jsonString){ |
| | | Device device = JSONObject.parseObject(jsonString, Device.class); |
| | | DeviceProperty deviceProperty = JSONObject.parseObject(jsonString, DeviceProperty.class); |
| | | deviceService.saveOrUpdate(device,deviceProperty); |
| | | ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | |
| | | @GetMapping("device-list") |
| | | public PageBean getDeviceList(PageBean pageBean) { |
| | | return deviceService.getDeviceList(pageBean); |
| | | } |
| | | |
| | | } |