|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.iflytop.handacid.common.base.BasePageQuery; |
|
|
|
import com.iflytop.handacid.common.model.entity.ReceiveRecord; |
|
|
|
import com.iflytop.handacid.common.result.PageResult; |
|
|
|
import com.iflytop.handacid.common.result.Result; |
|
|
|
import com.iflytop.handacid.common.service.ReceiveRecordService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
@ -27,8 +28,8 @@ public class ReceiveRecordController { |
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
@Operation(summary = "获取List数据") |
|
|
|
public List<ReceiveRecord> getAll() { |
|
|
|
return receiveRecordService.list(); |
|
|
|
public Result<List<ReceiveRecord>> getAll() { |
|
|
|
return Result.success(receiveRecordService.list()); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/page") |
|
|
@ -39,26 +40,29 @@ public class ReceiveRecordController { |
|
|
|
|
|
|
|
@GetMapping("/{id}") |
|
|
|
@Operation(summary = "根据ID获取") |
|
|
|
public ReceiveRecord getById(@PathVariable Integer id) { |
|
|
|
return receiveRecordService.getById(id); |
|
|
|
public Result<ReceiveRecord> getById(@PathVariable Integer id) { |
|
|
|
return Result.success(receiveRecordService.getById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping |
|
|
|
@Operation(summary = "新增记录") |
|
|
|
public boolean create(@RequestBody ReceiveRecord receiveRecord) { |
|
|
|
return receiveRecordService.save(receiveRecord); |
|
|
|
public Result<String> create(@RequestBody ReceiveRecord receiveRecord) { |
|
|
|
boolean flag = receiveRecordService.save(receiveRecord); |
|
|
|
return flag? Result.success("添加成功") : Result.failed("添加失败"); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping |
|
|
|
@Operation(summary = "修改记录") |
|
|
|
public boolean update(@RequestBody ReceiveRecord receiveRecord) { |
|
|
|
return receiveRecordService.updateById(receiveRecord); |
|
|
|
public Result<String> update(@RequestBody ReceiveRecord receiveRecord) { |
|
|
|
boolean flag = receiveRecordService.updateById(receiveRecord); |
|
|
|
return flag? Result.success("修改成功") : Result.failed("修改失败"); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/{id}") |
|
|
|
@Operation(summary = "删除记录") |
|
|
|
public boolean delete(@PathVariable Integer id) { |
|
|
|
return receiveRecordService.removeById(id); |
|
|
|
public Result<String> delete(@PathVariable Integer id) { |
|
|
|
boolean flag = receiveRecordService.removeById(id); |
|
|
|
return flag? Result.success("删除成功") : Result.failed("删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|