35 lines
882 B
Java
35 lines
882 B
Java
|
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;
|
||
|
}
|
||
|
|
||
|
@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();
|
||
|
}
|
||
|
}
|