xufenglei
2018-08-07 e66b0932eb782c6ec771ffaa9957e6d5d5361286
src/main/java/com/moral/controller/DeviceController.java
@@ -6,7 +6,14 @@
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")
@@ -14,6 +21,14 @@
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);
@@ -30,4 +45,18 @@
        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);
    }
    @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);
    }
}