| | |
| | | import com.moral.service.DeviceService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.moral.common.util.WebUtils.getParametersStartingWith; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @RestController |
| | | @RequestMapping("device") |
| | |
| | | public class DeviceController { |
| | | @Resource |
| | | DeviceService deviceService; |
| | | @GetMapping("count-by-example") |
| | | public ResultBean<Integer> countByExample(PageBean pageBean){ |
| | | return new ResultBean<Integer>(deviceService.countByExample(pageBean)); |
| | | } |
| | | @GetMapping("count-by-times") |
| | | public ResultBean<List<Map>> countByTimes(Date start, Date end){ |
| | | return new ResultBean<List<Map>>(deviceService.countByTimes(start,end,"%Y-%m")); |
| | | } |
| | | @GetMapping("page-list") |
| | | public PageBean pageList(PageBean pageBean) { |
| | | return deviceService.queryByPageBean(pageBean); |
| | |
| | | List<Device> devices = deviceService.getDevicesByMonitorPointId(monitorPointId); |
| | | return new ResultBean<List<Device>>(devices); |
| | | } |
| | | |
| | | @GetMapping("professionId") |
| | | public ResultBean<List<Device>> getDevicesByProfessionId(HttpServletRequest request) { |
| | | Map<String, Object> parameters = getParametersStartingWith(request, null); |
| | | List<Device> devices = deviceService.getDevicesByProfessionId(parameters); |
| | | return new ResultBean<List<Device>>(devices); |
| | | } |
| | | } |