增加查询接口
parent
f49061d4e2
commit
f7cbc0f643
|
@ -23,6 +23,7 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-core</artifactId>
|
<artifactId>cloud-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.muyu;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("Hello world!");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.cloud.pay.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.validation.IsSystemYesNo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
@Tag(name = "客户列表请求对象")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CustomerListReq {
|
||||||
|
/**
|
||||||
|
* 服务/客户名称
|
||||||
|
*/
|
||||||
|
@Schema(name = "服务/客户名称",type = "string",description = "客户名称:为微服务中文名称")
|
||||||
|
private String appName;
|
||||||
|
/**
|
||||||
|
* 服务/客户编码
|
||||||
|
*/
|
||||||
|
@Schema(name = "服务/客户编码",type = "string",description = "客户名称:为微服务名称")
|
||||||
|
private String appCode;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Schema(name = "是否开启",type = "string",description = "客户状态:Y是开启,N是关闭")
|
||||||
|
@IsSystemYesNo
|
||||||
|
private String status;
|
||||||
|
}
|
|
@ -85,6 +85,13 @@
|
||||||
<artifactId>cloud-common-rabbit</artifactId>
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--支付公共依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-pay-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
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.service.OrderPayCustomerService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/customer")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "客户控制层", description = "进行客户管理、查看等相关操作")
|
||||||
|
public class OrderPayCustomerController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户业务层
|
||||||
|
*/
|
||||||
|
private final OrderPayCustomerService orderPayCustomerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有的客户
|
||||||
|
* @param customerListReq 客户列表请求参数
|
||||||
|
* @return 客户列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||||
|
@Operation(summary ="查看客户",description = "根据客户的名称、编码、是否开启等可以进行客户的筛选")
|
||||||
|
public Result<List<OrderPayCustomer>> selectList(@Validated @RequestBody CustomerListReq customerListReq){
|
||||||
|
return Result.success(orderPayCustomerService.selectList(customerListReq)); //查询客户集合 | 封装返回结果
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.cloud.pay.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RequestMapping("/test")
|
|
||||||
@RestController
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
public Result<String> post(){
|
|
||||||
return Result.success("测试Post成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public Result<String> get(){
|
|
||||||
return Result.success("测试Get成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.muyu.cloud.pay.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OrderPayCustomerMapper extends BaseMapper<OrderPayCustomer> {
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||||
|
/**
|
||||||
|
* 查询客户集合
|
||||||
|
* @param customerListReq 请求参数
|
||||||
|
* @return 客户集合
|
||||||
|
*/
|
||||||
|
public List<OrderPayCustomer> selectList(CustomerListReq customerListReq);
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.cloud.pay.service.impl;
|
||||||
|
|
||||||
|
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.mapper.OrderPayCustomerMapper;
|
||||||
|
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer> implements OrderPayCustomerService {
|
||||||
|
@Override
|
||||||
|
public List<OrderPayCustomer> selectList(CustomerListReq customerListReq) {
|
||||||
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(customerListReq.getAppName()), //服务/客户名称
|
||||||
|
OrderPayCustomer::getAppName, customerListReq.getAppName() //服务/客户名称
|
||||||
|
);
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(customerListReq.getAppCode()), //服务/客户编码
|
||||||
|
OrderPayCustomer::getAppCode, customerListReq.getAppCode() //服务/客户编码
|
||||||
|
);
|
||||||
|
queryWrapper.eq(
|
||||||
|
StringUtils.isNotEmpty(customerListReq.getStatus()), //是否开启
|
||||||
|
OrderPayCustomer::getStatus, customerListReq.getStatus() //是否开启
|
||||||
|
);
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue