2024-01-08 22:15:25 +08:00
|
|
|
package com.sky.controller.admin;
|
|
|
|
|
2024-01-08 22:53:45 +08:00
|
|
|
import com.sky.dto.SetmealDTO;
|
2024-01-09 09:02:59 +08:00
|
|
|
import com.sky.dto.SetmealPageQueryDTO;
|
|
|
|
import com.sky.result.PageResult;
|
2024-01-08 22:53:45 +08:00
|
|
|
import com.sky.result.Result;
|
|
|
|
import com.sky.service.SetmealService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
2024-01-08 22:15:25 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2024-01-09 09:02:59 +08:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
2024-01-08 22:15:25 +08:00
|
|
|
|
2024-01-08 22:53:45 +08:00
|
|
|
import javax.annotation.Resource;
|
2024-01-09 09:57:39 +08:00
|
|
|
import java.util.List;
|
2024-01-08 22:53:45 +08:00
|
|
|
|
2024-01-08 22:15:25 +08:00
|
|
|
@RestController
|
2024-01-08 22:53:45 +08:00
|
|
|
@RequestMapping("/admin/setmeal")
|
|
|
|
@Api(tags = "套餐相关接口")
|
2024-01-08 22:15:25 +08:00
|
|
|
@Slf4j
|
|
|
|
public class SetmealController {
|
2024-01-08 22:53:45 +08:00
|
|
|
@Resource
|
|
|
|
private SetmealService setmealService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增套餐
|
|
|
|
*
|
|
|
|
* @param setmealDTO SetmealDTO
|
|
|
|
* @return Result<String>
|
|
|
|
*/
|
|
|
|
@ApiOperation("新增套餐")
|
|
|
|
@PostMapping()
|
|
|
|
public Result<String> save(@RequestBody SetmealDTO setmealDTO) {
|
|
|
|
setmealService.saveWithDish(setmealDTO);
|
|
|
|
return Result.success();
|
|
|
|
}
|
2024-01-09 09:02:59 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 分页查询
|
|
|
|
*
|
|
|
|
* @param setmealPageQueryDTO 请求参数
|
|
|
|
* @return 返回数据
|
|
|
|
*/
|
|
|
|
@ApiOperation("分页查询")
|
|
|
|
@GetMapping("page")
|
|
|
|
public Result<PageResult> pageResultResult(SetmealPageQueryDTO setmealPageQueryDTO) {
|
|
|
|
PageResult pageResult = setmealService.pageQuery(setmealPageQueryDTO);
|
|
|
|
return Result.success(pageResult);
|
|
|
|
}
|
2024-01-09 09:23:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 套餐起售停售
|
|
|
|
*
|
|
|
|
* @param status Integer
|
|
|
|
* @param id Long
|
|
|
|
* @return Result
|
|
|
|
*/
|
|
|
|
@ApiOperation("套餐起售停售")
|
|
|
|
@PostMapping("status/{status}")
|
|
|
|
public Result startOrStop(@PathVariable Integer status, Long id) {
|
|
|
|
setmealService.startOrStop(status, id);
|
|
|
|
return Result.success();
|
|
|
|
}
|
2024-01-09 09:57:39 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 批量删除套餐
|
|
|
|
*
|
|
|
|
* @param ids 删除集合
|
|
|
|
* @return Null
|
|
|
|
*/
|
|
|
|
@ApiOperation("批量删除套餐")
|
|
|
|
@DeleteMapping("")
|
|
|
|
public Result delete(@RequestParam List<Long> ids) {
|
|
|
|
setmealService.delete(ids);
|
|
|
|
return Result.success();
|
|
|
|
}
|
2024-01-08 22:15:25 +08:00
|
|
|
}
|