financial-web-server/service/src/main/java/cn/bunny/services/controller/DebtRepaymentPlanController...

73 lines
3.3 KiB
Java
Raw Normal View History

2024-11-11 15:29:50 +08:00
package cn.bunny.services.controller;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.entity.financial.DebtRepaymentPlan;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;
import cn.bunny.dao.pojo.result.ResultCodeEnum;
import cn.bunny.dao.vo.financial.DebtRepaymentPlanVo;
2024-11-11 16:20:42 +08:00
import cn.bunny.services.service.financial.DebtRepaymentPlanService;
2024-11-11 15:29:50 +08:00
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import java.util.List;
/**
* <p>
* 债务还款计划表表 前端控制器
* </p>
*
* @author Bunny
* @since 2024-11-11 14:59:53
*/
@Tag(name = "债务还款计划表", description = "债务还款计划表相关接口")
@RestController
@RequestMapping("admin/debtRepaymentPlan")
public class DebtRepaymentPlanController {
@Autowired
private DebtRepaymentPlanService debtRepaymentPlanService;
@Operation(summary = "分页查询债务还款计划表", description = "分页查询债务还款计划表")
@GetMapping("getDebtRepaymentPlanList/{page}/{limit}")
public Mono<Result<PageResult<DebtRepaymentPlanVo>>> getDebtRepaymentPlanList(
@Parameter(name = "page", description = "当前页", required = true)
@PathVariable("page") Integer page,
@Parameter(name = "limit", description = "每页记录数", required = true)
@PathVariable("limit") Integer limit,
DebtRepaymentPlanDto dto) {
Page<DebtRepaymentPlan> pageParams = new Page<>(page, limit);
PageResult<DebtRepaymentPlanVo> pageResult = debtRepaymentPlanService.getDebtRepaymentPlanList(pageParams, dto);
return Mono.just(Result.success(pageResult));
}
@Operation(summary = "添加债务还款计划表", description = "添加债务还款计划表")
@PostMapping("addDebtRepaymentPlan")
public Mono<Result<String>> addDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanAddDto dto) {
debtRepaymentPlanService.addDebtRepaymentPlan(dto);
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}
@Operation(summary = "更新债务还款计划表", description = "更新债务还款计划表")
@PutMapping("updateDebtRepaymentPlan")
public Mono<Result<String>> updateDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanUpdateDto dto) {
debtRepaymentPlanService.updateDebtRepaymentPlan(dto);
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}
@Operation(summary = "删除债务还款计划表", description = "删除债务还款计划表")
@DeleteMapping("deleteDebtRepaymentPlan")
public Mono<Result<String>> deleteDebtRepaymentPlan(@RequestBody List<Long> ids) {
debtRepaymentPlanService.deleteDebtRepaymentPlan(ids);
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
}
}