feat():增删改查
parent
6fd573a502
commit
50303ff0f5
|
@ -4,6 +4,7 @@ import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
|||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
|
@ -29,12 +30,13 @@ import java.util.List;
|
|||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/customer")
|
||||
@Tag(name = "客户控制层",description = "进行客户管理、查看等相关操作")
|
||||
@Tag(name = "客户控制层", description = "进行客户管理、查看等相关操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
public OrderPayCustomerController(){
|
||||
public OrderPayCustomerController() {
|
||||
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户业务层
|
||||
*/
|
||||
|
@ -43,11 +45,12 @@ public class OrderPayCustomerController {
|
|||
|
||||
/**
|
||||
* 查询所有的客户
|
||||
*
|
||||
* @param customerListReq 客户列表请求参数
|
||||
* @return 客户列表
|
||||
*/
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查看客户",description = "根据客户的名称、编码、是否开启等可以进行客户的筛选")
|
||||
@RequestMapping(path = "/list", method = RequestMethod.POST)
|
||||
@Operation(summary = "查看客户", description = "根据客户的名称、编码、是否开启等可以进行客户的筛选")
|
||||
public Result<List<CustomerResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq customerListReq) {
|
||||
return Result.success(
|
||||
|
@ -57,12 +60,13 @@ public class OrderPayCustomerController {
|
|||
|
||||
/**
|
||||
* 获取所有客户的列表
|
||||
*
|
||||
* @return客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||
@Operation(summary = "获取未接入的客户", description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "客户列表", defaultValue = "[\"客户1\",\"客户2\"]", type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
public Result<List<String>> getCustomerAllList() {
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
|
@ -70,13 +74,56 @@ public class OrderPayCustomerController {
|
|||
|
||||
/**
|
||||
* 添加客户
|
||||
*
|
||||
* @param orderCustomerAddReq 客户信息
|
||||
* @return 添加结果
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功才可以使用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq){
|
||||
@Operation(summary = "客户信息添加", description = "添加支付平台客户信息,添加成功才可以使用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq) {
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||
return Result.success(null,"操作成功");
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
*
|
||||
* @param orderCustomerUpdReq 修改客户请求信息
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息修改", description = "通过ID修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户ID", type = "Long", defaultValue = "1", description = "修改客户信息需要依据的唯一条件")
|
||||
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq) {
|
||||
orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId));
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
*
|
||||
* @param orderCustomerId 删除客户请求信息
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息删除", description = "通过ID删除客户信息")
|
||||
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
orderPayCustomerService.removeById(orderCustomerId);
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID获取客户
|
||||
*
|
||||
* @param orderCustomerId ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "通过ID获取客户信息", description = "通过ID获取客户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId), "操作成功");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue