package com.ycl.jxkg.controller.admin; import com.ycl.jxkg.group.Update; import com.ycl.jxkg.group.Add; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; import lombok.RequiredArgsConstructor; import java.util.List; import org.springframework.validation.annotation.Validated; import javax.validation.constraints.NotEmpty; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import com.ycl.jxkg.service.CheatRecordService; import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.form.CheatRecordForm; import com.ycl.jxkg.domain.query.CheatRecordQuery; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; /** * 作弊记录 前端控制器 * * @author xp * @since 2024-07-03 */ @Validated @RequiredArgsConstructor @Api(value = "作弊记录", tags = "作弊记录管理") @RestController @RequestMapping("/api/cheat-record") public class CheatRecordController { private final CheatRecordService cheatRecordService; @PostMapping @ApiOperation(value = "添加", notes = "添加") @PreAuthorize("hasAuthority('cheatRecord:add')") public Result add(@RequestBody @Validated(Add.class) CheatRecordForm form) { return cheatRecordService.add(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('cheatRecord:edit')") public Result update(@RequestBody @Validated(Update.class) CheatRecordForm form) { return cheatRecordService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") @PreAuthorize("hasAuthority('cheatRecord:del')") public Result removeById(@PathVariable("id") String id) { return cheatRecordService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") @PreAuthorize("hasAuthority('cheatRecord:del:batch')") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List ids) { return cheatRecordService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") @PreAuthorize("hasAuthority('cheatRecord:page')") public Result page(CheatRecordQuery query) { return cheatRecordService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") @PreAuthorize("hasAuthority('cheatRecord:detail')") public Result detail(@PathVariable("id") Integer id) { return cheatRecordService.detail(id); } @GetMapping("/list") @PreAuthorize("hasAuthority('cheatRecord:list')") @ApiOperation(value = "列表", notes = "列表") public Result list() { return cheatRecordService.all(); } }