package org.springblade.modules.absentrecords.controller; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.modules.absentrecords.entity.AbsentRecords; import org.springblade.modules.absentrecords.service.AbsentRecordsService; import org.springframework.web.bind.annotation.*; /** * @author zhongrj * @time 2021-11-18 * @desc 缺考记录控制层 */ @RestController @AllArgsConstructor @RequestMapping("/absentRecords") public class AbsentRecordsController { private final AbsentRecordsService absentRecordsService; // /** // * 自定义分页 // * @param query page,size // * @param absentRecords 缺考记录信息对象 // */ // @GetMapping("/page") // public R> page(AbsentRecordsVo absentRecords, Query query) { // IPage pages = absentRecordsService.selectAbsentRecordsPage(Condition.getPage(query), absentRecords); // return R.data(pages); // } /** * 新增 * @param absentRecords 缺考记录信息对象 */ @PostMapping("/save") @ApiOperation(value = "新增", notes = "传入absentRecords") public R save(@RequestBody AbsentRecords absentRecords){ return R.data(absentRecordsService.save(absentRecords)); } /** * 修改 * @param absentRecords 缺考记录信息对象 */ @PostMapping("/update") public R update(@RequestBody AbsentRecords absentRecords){ return R.status(absentRecordsService.updateById(absentRecords)); } /** * 新增或修改 * @param absentRecords 缺考记录信息对象 */ @PostMapping("/submit") public R submit(@RequestBody AbsentRecords absentRecords){ return R.data(absentRecordsService.saveOrUpdate(absentRecords)); } /** * 删除 * @param ids 缺考记录信息ids 数组 */ @PostMapping("/remove") public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { return R.status(absentRecordsService.removeByIds(Func.toLongList(ids))); } /** * 详情 * @param absentRecords 缺考记录信息对象 */ @GetMapping("/detail") @ApiOperation(value = "详情", notes = "传入absentRecords") public R detail(AbsentRecords absentRecords) { AbsentRecords detail = absentRecordsService.getOne(Condition.getQueryWrapper(absentRecords)); return R.data(detail); } }