setmeal cache
This commit is contained in:
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,6 +44,7 @@ public class SetmealController {
|
||||
*/
|
||||
@PostMapping
|
||||
@ApiOperation("新增套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache",key = "#setmealDTO.categoryId")
|
||||
public Result insert(@RequestBody SetmealDTO setmealDTO){
|
||||
log.info("新增套餐: {}",setmealDTO);
|
||||
setmealService.insert(setmealDTO);
|
||||
@@ -56,6 +58,7 @@ public class SetmealController {
|
||||
*/
|
||||
@DeleteMapping
|
||||
@ApiOperation("批量删除套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache",allEntries = true)
|
||||
public Result delete(@RequestParam List<Long> ids){
|
||||
log.info("批量删除套餐: {}",ids);
|
||||
setmealService.deleteBatch(ids);
|
||||
@@ -82,6 +85,7 @@ public class SetmealController {
|
||||
*/
|
||||
@PutMapping
|
||||
@ApiOperation("修改套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache",allEntries = true)
|
||||
public Result update(@RequestBody SetmealDTO setmealDTO){
|
||||
log.info("修改套餐: {}",setmealDTO);
|
||||
setmealService.updateWithSetmealDishes(setmealDTO);
|
||||
@@ -96,6 +100,7 @@ public class SetmealController {
|
||||
*/
|
||||
@PostMapping("/status/{status}")
|
||||
@ApiOperation("套餐起售停售")
|
||||
@CacheEvict(cacheNames = "setmealCache",allEntries = true)
|
||||
public Result startOrStop(@PathVariable Integer status,Long id){
|
||||
log.info("套餐起售停售: 状态:{},ID:{}",status,id);
|
||||
setmealService.startOrStop(status,id);
|
||||
|
||||
Reference in New Issue
Block a user