新增查询接口测试
parent
c68ffb8c63
commit
bdfb26a999
|
@ -0,0 +1,78 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerList
|
||||
* @Date:2024/8/4 14:57
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "客户信息相应对象",description = "负责客户信息查询的响应结果")
|
||||
public class CustomerListResp {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(defaultValue = "1",type = "Long",description = "客户id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema(defaultValue = "商品服务",type = "String",description = "客户名称")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(defaultValue = "cloud_server",type = "String",description = "客户编码")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(defaultValue = "Y",type = "String",description = "客户状态:同数据字典 - 系统是否")
|
||||
private String status;
|
||||
|
||||
@Schema(defaultValue = "zy",type = "String",description = "创建人")
|
||||
private String createBy;
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
|
||||
@Schema(defaultValue = "2024年8月4日15:16:18",type = "Date",description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 数据库对象转换为查询结果对象
|
||||
* @param orderPayCustomer 数据库对象
|
||||
* @return 查询结果对象
|
||||
*/
|
||||
public static CustomerListResp customerBuild(OrderPayCustomer orderPayCustomer) {
|
||||
|
||||
return CustomerListResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.cloud.pay.controller;
|
|||
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -33,7 +34,7 @@ public class OrderPayCustomerController {
|
|||
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查看客户",description = "根据客户的名称,编码,是否开启等可以进行客户的筛选")
|
||||
public Result<List<OrderPayCustomer>> selectList(
|
||||
public Result<List<CustomerListResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq customerListReq){
|
||||
|
||||
return Result.success(
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.cloud.pay.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,9 +17,8 @@ import java.util.List;
|
|||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
public List<OrderPayCustomer> selectList(CustomerListReq req);
|
||||
public List<CustomerListResp> selectList(CustomerListReq req);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
|
@ -23,7 +26,7 @@ public class OrderPayCustomerServiceImpl
|
|||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
@Override
|
||||
public List<OrderPayCustomer> selectList(CustomerListReq req) {
|
||||
public List<CustomerListResp> selectList(CustomerListReq req) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(req.getAppName()),
|
||||
|
@ -37,6 +40,10 @@ public class OrderPayCustomerServiceImpl
|
|||
StringUtils.isNotEmpty(req.getStatus()),
|
||||
OrderPayCustomer::getStatus,req.getStatus()
|
||||
);
|
||||
return this.list(queryWrapper);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
List<CustomerListResp> customerListRespList = new ArrayList<>();
|
||||
orderPayCustomerList.stream()
|
||||
.map(CustomerListResp::customerBuild).collect(Collectors.toList());
|
||||
return customerListRespList;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue