xufenglei
2018-05-14 c0d88c1f82394c0374d2d592f4d2bca951d6334e
src/main/java/com/moral/controller/DeviceController.java
@@ -6,9 +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")
@@ -16,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);
@@ -39,4 +52,11 @@
       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);
    }
}