| | |
| | | package com.iailab.module.shasteel.job.controller.admin; |
| | | |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | |
| | | import com.iailab.module.shasteel.job.service.ScheduleJobService; |
| | | import com.iailab.module.shasteel.job.vo.ScheduleJobReqVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | * @author Mark sunlightcs@gmail.com |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/job/schedule") |
| | | @RequestMapping("/shasteel/job/schedule") |
| | | @Tag(name = "定时任务") |
| | | public class ScheduleJobController { |
| | | @Resource |
| | |
| | | |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | @Parameters({ |
| | | @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
| | | @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
| | | @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
| | | @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") , |
| | | @Parameter(name = "beanName", description = "beanName") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('data:schedule:query')") |
| | | @PreAuthorize("@ss.hasPermission('shasteel:schedule:query')") |
| | | public CommonResult<PageResult<ScheduleJobDTO>> page(@Validated ScheduleJobReqVO reqVO){ |
| | | reqVO.setTenantId(TenantContextHolder.getTenantId()); |
| | | PageResult<ScheduleJobEntity> page = scheduleJobService.page(reqVO); |
| | |
| | | |
| | | @GetMapping("info") |
| | | @Operation(summary = "信息") |
| | | @PreAuthorize("@ss.hasPermission('data:schedule:query')") |
| | | @PreAuthorize("@ss.hasPermission('shasteel:schedule:query')") |
| | | public CommonResult<ScheduleJobDTO> info(@RequestParam("id") Long id){ |
| | | ScheduleJobDTO schedule = scheduleJobService.get(id); |
| | | |
| | |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "保存") |
| | | @PreAuthorize("@ss.hasPermission('data:schedule:create')") |
| | | @PreAuthorize("@ss.hasPermission('shasteel:schedule:create')") |
| | | public CommonResult save(@RequestBody ScheduleJobDTO dto){ |
| | | ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
| | | |
| | |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "修改") |
| | | @PreAuthorize("@ss.hasPermission('data:schedule:update')") |
| | | @PreAuthorize("@ss.hasPermission('shasteel:schedule:update')") |
| | | public CommonResult update(@RequestBody ScheduleJobDTO dto){ |
| | | ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class); |
| | | |
| | |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | @PreAuthorize("@ss.hasPermission('data:schedule:delete')") |
| | | @PreAuthorize("@ss.hasPermission('shasteel:schedule:delete')") |
| | | public CommonResult delete(@RequestParam("id") Long id){ |
| | | scheduleJobService.deleteBatch(id); |
| | | |