Files
Nexus-api/src/main/java/com/dota/nexus/controller/AnniversaryController.java

43 lines
1.0 KiB
Java
Raw Normal View History

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
/**
* 获取所有周年日和纪念日
*/
@GetMapping
public R get() {
return R.ok(anniversaryService.getAll());
}
2025-10-11 16:18:18 +08:00
@PostMapping
public R add(Anniversary anniversary) {
anniversaryService.save(anniversary);
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();
}
}