|
|
@ -1,6 +1,11 @@ |
|
|
|
package com.iflytop.handacid.app.controller; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.iflytop.handacid.common.base.BasePageQuery; |
|
|
|
import com.iflytop.handacid.common.model.entity.AuditRecord; |
|
|
|
import com.iflytop.handacid.common.model.entity.Formulation; |
|
|
|
import com.iflytop.handacid.common.result.PageResult; |
|
|
|
import com.iflytop.handacid.common.result.Result; |
|
|
|
import com.iflytop.handacid.common.service.AuditRecordService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
@ -22,34 +27,43 @@ public class AuditRecordController { |
|
|
|
@Autowired |
|
|
|
private AuditRecordService auditRecordService; |
|
|
|
|
|
|
|
@GetMapping |
|
|
|
@GetMapping("/list") |
|
|
|
@Operation(summary = "获取list数据") |
|
|
|
public List<AuditRecord> getAll() { |
|
|
|
return auditRecordService.list(); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/page") |
|
|
|
@Operation(summary = "获取分页数据") |
|
|
|
public PageResult<AuditRecord> getPage(BasePageQuery query) { |
|
|
|
return PageResult.success(auditRecordService.page(new Page<>(query.getPageNum(), query.getPageSize()))); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/{id}") |
|
|
|
@Operation(summary = "根据ID获取记录") |
|
|
|
public AuditRecord getById(@PathVariable Integer id) { |
|
|
|
return auditRecordService.getById(id); |
|
|
|
public Result<AuditRecord> getById(@PathVariable Integer id) { |
|
|
|
return Result.success(auditRecordService.getById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping |
|
|
|
@Operation(summary = "增加记录") |
|
|
|
public boolean create(@RequestBody AuditRecord auditRecord) { |
|
|
|
return auditRecordService.save(auditRecord); |
|
|
|
public Result<String> create(@RequestBody AuditRecord auditRecord) { |
|
|
|
boolean flag= auditRecordService.save(auditRecord); |
|
|
|
return flag ? Result.success("添加成功") : Result.failed("添加失败"); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping |
|
|
|
@Operation(summary = "修改记录") |
|
|
|
public boolean update(@RequestBody AuditRecord auditRecord) { |
|
|
|
return auditRecordService.updateById(auditRecord); |
|
|
|
public Result<String> update(@RequestBody AuditRecord auditRecord) { |
|
|
|
boolean flag = auditRecordService.updateById(auditRecord); |
|
|
|
return flag ? Result.success("修改成功"): Result.failed("修改失败"); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/{id}") |
|
|
|
@Operation(summary = "删除记录") |
|
|
|
public boolean delete(@PathVariable Integer id) { |
|
|
|
return auditRecordService.removeById(id); |
|
|
|
public Result<String> delete(@PathVariable Integer id) { |
|
|
|
boolean flag = auditRecordService.removeById(id); |
|
|
|
return flag ? Result.success("删除成功"): Result.failed("删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|