| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "任务名称", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "status", value = "任务状态", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "type", value = "任务类别", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<TaskEntity>> selectByPageAndCount(String name, Integer status, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<TaskEntity>> selectByPageAndCount(String name, Integer status, String type, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | int count = taskService.selectCount(name, status); |
| | | int count = taskService.selectCount(name, status, type); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<TaskEntity> rs = taskService.selectByPage(name, status, pageSize, pageSize * (pageIndex - 1)); |
| | | List<TaskEntity> rs = taskService.selectByPage(name, status, type, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | public ResponseMsg<Object> deleteTask(int id, HttpServletRequest req) { |
| | | try { |
| | | TaskEntity task = taskService.selectById(id); |
| | | if (null == task) { |
| | | return fail("任务不存在", -1); |
| | | if (null == task || 1 != task.getStatus()) { |
| | | return fail("任务不存在或无需结束", -1); |
| | | } |
| | | |
| | | List<Integer> ids = new ArrayList<>(); |