新增返回结果集对象
parent
4f5d99be68
commit
e4a37169f8
|
@ -27,19 +27,19 @@ public class CustomerListReq {
|
||||||
/**
|
/**
|
||||||
* 服务/客户名称
|
* 服务/客户名称
|
||||||
*/
|
*/
|
||||||
@Schema(type = "String",description = "客户名称,为微服务中文名称")
|
@Schema(type = "String",defaultValue = "客户名称1",description = "客户名称,为微服务中文名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务/客户编码
|
* 服务/客户编码
|
||||||
*/
|
*/
|
||||||
@Schema(name = "服务/客户编码", type = "String",description = "客户名称,为微服务名称")
|
@Schema(defaultValue = "customer_code",type = "String",description = "客户名称,为微服务名称")
|
||||||
private String appCode;
|
private String appCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户描述
|
* 客户描述
|
||||||
*/
|
*/
|
||||||
@Schema(name = "是否开启",type = "String", description = "客户状态,Y是开启,N关闭")
|
@Schema(type = "String",defaultValue = "Y", description = "客户状态,Y是开启,N关闭")
|
||||||
@IsSystemYesNo
|
@IsSystemYesNo
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.muyu.cloud.pay.domain.resp;
|
||||||
|
|
||||||
|
import cn.hutool.db.sql.Order;
|
||||||
|
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 lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:zhangchengzhi
|
||||||
|
* @Package:com.muyu.cloud.pay.domain.resp
|
||||||
|
* @Project:cloud-pay
|
||||||
|
* @name:CustomerListResp
|
||||||
|
* @Date:2024/8/1 0:09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "客户信息相应对象",description = "负责客户信息查询的响应结果")
|
||||||
|
public class CustomerResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@Schema(description = "客户ID", defaultValue = "1", type = "Long")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "客户名称", defaultValue = "商品服务", type = "String")
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务/客户编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "客户ID", defaultValue = "cloud_order", type = "String")
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Schema(description = "客户状态,同数据字典-系统是否", defaultValue = "Y", type = "String")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "创建人", defaultValue = "muyu", type = "String")
|
||||||
|
private String createBy;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Schema(description = "创建时间", defaultValue = "2024-8-1 0:22:36", type = "Date")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
public static CustomerResp customerBuild (OrderPayCustomer orderPayCustomer){
|
||||||
|
return CustomerResp.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.OrderPayCustomer;
|
||||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||||
|
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
@ -42,7 +43,7 @@ public class OrderPayCustomerController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||||
@Operation(summary = "查看客户",description = "根据客户的名称,编码,是否开启等可以进行客户的筛选")
|
@Operation(summary = "查看客户",description = "根据客户的名称,编码,是否开启等可以进行客户的筛选")
|
||||||
public Result<List<OrderPayCustomer>> selectList(@Validated @RequestBody CustomerListReq customerListReq){
|
public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq){
|
||||||
|
|
||||||
return Result.success(orderPayCustomerService.selectList(customerListReq));
|
return Result.success(orderPayCustomerService.selectList(customerListReq));
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||||
|
|
||||||
|
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,10 +19,11 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询客户集合
|
* 查询客户集合
|
||||||
|
*
|
||||||
* @param customerListReq 请求参数
|
* @param customerListReq 请求参数
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public List<OrderPayCustomer> selectList(CustomerListReq customerListReq);
|
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
package com.muyu.cloud.pay.service.impl;
|
package com.muyu.cloud.pay.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||||
|
|
||||||
|
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,25 +29,31 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderPayCustomer> selectList(CustomerListReq customerListReq) {
|
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||||
|
|
||||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(customerListReq.getAppName()),
|
queryWrapper.like(StringUtils.isNotEmpty(customerListReq.getAppName()),
|
||||||
OrderPayCustomer::getAppName,customerListReq.getAppName()
|
OrderPayCustomer::getAppName, customerListReq.getAppName()
|
||||||
);
|
);
|
||||||
|
|
||||||
queryWrapper.like(
|
queryWrapper.like(
|
||||||
StringUtils.isNotEmpty(customerListReq.getAppCode()),
|
StringUtils.isNotEmpty(customerListReq.getAppCode()),
|
||||||
OrderPayCustomer::getAppCode,customerListReq.getAppCode()
|
OrderPayCustomer::getAppCode, customerListReq.getAppCode()
|
||||||
);
|
);
|
||||||
|
|
||||||
queryWrapper.eq(
|
queryWrapper.eq(
|
||||||
StringUtils.isNotEmpty(customerListReq.getStatus()),
|
StringUtils.isNotEmpty(customerListReq.getStatus()),
|
||||||
OrderPayCustomer::getStatus,customerListReq.getStatus()
|
OrderPayCustomer::getStatus, customerListReq.getStatus()
|
||||||
);
|
);
|
||||||
|
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||||
|
List<CustomerResp> customerRespList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
return this.list(queryWrapper);
|
customerRespList = orderPayCustomerList.stream()
|
||||||
|
.map(CustomerResp::customerBuild).toList();
|
||||||
|
|
||||||
|
|
||||||
|
return customerRespList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue