顾客checkIn修改为只提供vipId
This commit is contained in:
@@ -28,8 +28,8 @@ public class CustomerController {
|
||||
description = "验证顾客身份并创建入店记录,如果是新顾客则自动注册到系统中。"
|
||||
)
|
||||
@GetMapping("/checkIn")
|
||||
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String name, @RequestParam String email) {
|
||||
return ApiResponse.success(customerService.customerCheckIn(name, email));
|
||||
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String vipId) {
|
||||
return ApiResponse.success(customerService.customerCheckIn(vipId));
|
||||
}
|
||||
|
||||
@PostMapping("/getAllCustomer")
|
||||
|
||||
@@ -20,6 +20,12 @@ import java.time.LocalDateTime;
|
||||
@TableName("customers")
|
||||
public class Customer extends BaseEntity {
|
||||
|
||||
/**
|
||||
* vip ID
|
||||
*/
|
||||
@TableField("vip_id")
|
||||
private String vipId;
|
||||
|
||||
/**
|
||||
* 顾客姓名
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface CustomerService extends IService<Customer> {
|
||||
|
||||
CustomerCheckInVO customerCheckIn(String name, String email);
|
||||
CustomerCheckInVO customerCheckIn(String vipId);
|
||||
|
||||
IPage<CustomerVO> getAllCustomer(BaseRequest request);
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
private final VisitRecordService visitRecordService;
|
||||
|
||||
// 选择顾客登录并添加入店记录
|
||||
public CustomerCheckInVO customerCheckIn(String name, String email) {
|
||||
public CustomerCheckInVO customerCheckIn(String vipId) {
|
||||
// 1. 判断当前顾客信息在数据库中是否有存储
|
||||
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Customer::getName, name).eq(Customer::getEmail, email);
|
||||
queryWrapper.eq(Customer::getVipId, vipId);
|
||||
|
||||
Customer customer = getOne(queryWrapper);
|
||||
|
||||
@@ -45,8 +45,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
// 如果找到了,则添加到数据库
|
||||
// 3. 添加当前顾客到本系统数据库
|
||||
customer = new Customer();
|
||||
customer.setName(name);
|
||||
customer.setEmail(email);
|
||||
customer.setVipId(vipId);
|
||||
customer.setCreatedTime(LocalDateTime.now());
|
||||
|
||||
save(customer);
|
||||
|
||||
Reference in New Issue
Block a user