package com.hnct.business.controller; import com.hnct.common.group.Update; import com.hnct.common.group.Add; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; import lombok.RequiredArgsConstructor; import java.util.List; import javax.validation.constraints.NotEmpty; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import com.hnct.business.service.TestService; import com.hnct.common.base.Result; import com.hnct.business.domain.form.TestForm; import com.hnct.business.domain.query.TestQuery; import org.springframework.web.bind.annotation.*; /** * 定时任务调度表 前端控制器 * * @author xp * @since 2024-10-08 */ @Validated @RequiredArgsConstructor @Api(value = "定时任务调度表", tags = "定时任务调度表管理") @RestController @RequestMapping("/job") public class TestController { private final TestService testService; @PostMapping @ApiOperation(value = "添加", notes = "添加") @PreAuthorize("hasAuthority('job:add')") public Result add(@RequestBody @Validated(Add.class) TestForm form) { return testService.add(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('job:edit')") public Result update(@RequestBody @Validated(Update.class) TestForm form) { return testService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") @PreAuthorize("hasAuthority('job:del')") public Result removeById(@PathVariable("id") String id) { return testService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") @PreAuthorize("hasAuthority('job:del:batch')") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List ids) { return testService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") @PreAuthorize("hasAuthority('job:page')") public Result page(TestQuery query) { return testService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") @PreAuthorize("hasAuthority('job:detail')") public Result detail(@PathVariable("id") Integer id) { return testService.detail(id); } @GetMapping("/list") @PreAuthorize("hasAuthority('job:list')") @ApiOperation(value = "列表", notes = "列表") public Result list() { return testService.all(); } }