2025-10-11 16:18:18 +08:00
|
|
|
package com.dota.nexus.controller;
|
|
|
|
|
|
|
|
import com.dota.nexus.entity.Anniversary;
|
|
|
|
import com.dota.nexus.entity.R;
|
|
|
|
import com.dota.nexus.service.AnniversaryService;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("anniversary")
|
|
|
|
public class AnniversaryController {
|
|
|
|
AnniversaryService anniversaryService;
|
|
|
|
|
|
|
|
public AnniversaryController(AnniversaryService anniversaryService) {
|
|
|
|
this.anniversaryService = anniversaryService;
|
|
|
|
}
|
|
|
|
|
2025-10-12 14:08:16 +08:00
|
|
|
/**
|
2025-10-14 22:45:42 +08:00
|
|
|
* 获取未来所有周年日和纪念日
|
2025-10-12 14:08:16 +08:00
|
|
|
*/
|
2025-10-14 22:45:42 +08:00
|
|
|
@GetMapping("future")
|
|
|
|
public R getFuture() {
|
|
|
|
return R.ok(anniversaryService.getFuture());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取过去的纪念日
|
|
|
|
*/
|
|
|
|
@GetMapping("past")
|
|
|
|
public R getPast() {
|
|
|
|
return R.ok(anniversaryService.getPast());
|
2025-10-12 14:08:16 +08:00
|
|
|
}
|
|
|
|
|
2025-10-11 16:18:18 +08:00
|
|
|
@PostMapping
|
|
|
|
public R add(Anniversary anniversary) {
|
2025-10-14 22:45:42 +08:00
|
|
|
anniversaryService.saveOrUpdate(anniversary);
|
2025-10-11 16:18:18 +08:00
|
|
|
return R.ok();
|
|
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping
|
|
|
|
public R del(Integer id) {
|
|
|
|
anniversaryService.removeById(id);
|
|
|
|
return R.ok();
|
|
|
|
}
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
public R update(Anniversary anniversary) {
|
|
|
|
anniversaryService.saveOrUpdate(anniversary);
|
|
|
|
return R.ok();
|
|
|
|
}
|
|
|
|
}
|