顾客checkIn修改为只提供vipId

This commit is contained in:
2025-11-20 14:18:27 +08:00
parent dbf6c45ec8
commit a16cb37c7f
4 changed files with 12 additions and 7 deletions

View File

@@ -28,8 +28,8 @@ public class CustomerController {
description = "验证顾客身份并创建入店记录,如果是新顾客则自动注册到系统中。" description = "验证顾客身份并创建入店记录,如果是新顾客则自动注册到系统中。"
) )
@GetMapping("/checkIn") @GetMapping("/checkIn")
public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String name, @RequestParam String email) { public ApiResponse<CustomerCheckInVO> customerCheckIn(@RequestParam String vipId) {
return ApiResponse.success(customerService.customerCheckIn(name, email)); return ApiResponse.success(customerService.customerCheckIn(vipId));
} }
@PostMapping("/getAllCustomer") @PostMapping("/getAllCustomer")

View File

@@ -20,6 +20,12 @@ import java.time.LocalDateTime;
@TableName("customers") @TableName("customers")
public class Customer extends BaseEntity { public class Customer extends BaseEntity {
/**
* vip ID
*/
@TableField("vip_id")
private String vipId;
/** /**
* 顾客姓名 * 顾客姓名
*/ */

View File

@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface CustomerService extends IService<Customer> { public interface CustomerService extends IService<Customer> {
CustomerCheckInVO customerCheckIn(String name, String email); CustomerCheckInVO customerCheckIn(String vipId);
IPage<CustomerVO> getAllCustomer(BaseRequest request); IPage<CustomerVO> getAllCustomer(BaseRequest request);

View File

@@ -30,10 +30,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
private final VisitRecordService visitRecordService; private final VisitRecordService visitRecordService;
// 选择顾客登录并添加入店记录 // 选择顾客登录并添加入店记录
public CustomerCheckInVO customerCheckIn(String name, String email) { public CustomerCheckInVO customerCheckIn(String vipId) {
// 1. 判断当前顾客信息在数据库中是否有存储 // 1. 判断当前顾客信息在数据库中是否有存储
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Customer::getName, name).eq(Customer::getEmail, email); queryWrapper.eq(Customer::getVipId, vipId);
Customer customer = getOne(queryWrapper); Customer customer = getOne(queryWrapper);
@@ -45,8 +45,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
// 如果找到了,则添加到数据库 // 如果找到了,则添加到数据库
// 3. 添加当前顾客到本系统数据库 // 3. 添加当前顾客到本系统数据库
customer = new Customer(); customer = new Customer();
customer.setName(name); customer.setVipId(vipId);
customer.setEmail(email);
customer.setCreatedTime(LocalDateTime.now()); customer.setCreatedTime(LocalDateTime.now());
save(customer); save(customer);