fix: 修复预约相关逻辑
This commit is contained in:
parent
3c04019af4
commit
3c7c8d1f73
@ -39,6 +39,16 @@ public class AppointmentController {
|
||||
return Map.of("code", 200, "data", appointments);
|
||||
}
|
||||
|
||||
/** 预约详情 */
|
||||
@GetMapping("/detail")
|
||||
public Map<String, Object> detail(@RequestParam Long id) {
|
||||
Appointment appointment = appointmentService.getById(id);
|
||||
if (appointment != null) {
|
||||
return Map.of("code", 200, "data", appointment);
|
||||
}
|
||||
return Map.of("code", 404, "message", "预约不存在");
|
||||
}
|
||||
|
||||
/** 创建预约 */
|
||||
@PostMapping("/create")
|
||||
public Map<String, Object> create(@RequestBody Map<String, Object> params) {
|
||||
|
||||
@ -33,6 +33,10 @@ public class AppointmentService {
|
||||
return appointmentMapper.findByStoreIdAndStatus(storeId, status);
|
||||
}
|
||||
|
||||
public Appointment getById(Long id) {
|
||||
return appointmentMapper.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
public Appointment create(Appointment appointment) {
|
||||
appointment.setCreateTime(LocalDateTime.now());
|
||||
appointment.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user