diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDetailController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDetailController.java deleted file mode 100644 index 9874c94..0000000 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDetailController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bonus.canteen.core.cook.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import com.bonus.common.log.enums.OperaType; -//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; -import com.bonus.canteen.core.cook.domain.CookRecipeDetail; -import com.bonus.canteen.core.cook.service.ICookRecipeDetailService; -import com.bonus.common.core.web.controller.BaseController; -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.core.utils.poi.ExcelUtil; -import com.bonus.common.core.web.page.TableDataInfo; - -/** - * 菜品计划详情信息Controller - * - * @author xsheng - * @date 2025-05-25 - */ -@Api(tags = "菜品计划详情信息接口") -@RestController -@RequestMapping("/cook_recipe_detail") -public class CookRecipeDetailController extends BaseController { - @Autowired - private ICookRecipeDetailService cookRecipeDetailService; - - /** - * 查询菜品计划详情信息列表 - */ - @ApiOperation(value = "查询菜品计划详情信息列表") - //@RequiresPermissions("cook:detail:list") - @GetMapping("/list") - public TableDataInfo list(CookRecipeDetail cookRecipeDetail) { - startPage(); - List list = cookRecipeDetailService.selectCookRecipeDetailList(cookRecipeDetail); - return getDataTable(list); - } - - /** - * 导出菜品计划详情信息列表 - */ - @ApiOperation(value = "导出菜品计划详情信息列表") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:detail:export") - @SysLog(title = "菜品计划详情信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出菜品计划详情信息") - @PostMapping("/export") - public void export(HttpServletResponse response, CookRecipeDetail cookRecipeDetail) { - List list = cookRecipeDetailService.selectCookRecipeDetailList(cookRecipeDetail); - ExcelUtil util = new ExcelUtil(CookRecipeDetail.class); - util.exportExcel(response, list, "菜品计划详情信息数据"); - } - - /** - * 获取菜品计划详情信息详细信息 - */ - @ApiOperation(value = "获取菜品计划详情信息详细信息") - //@RequiresPermissions("cook:detail:query") - @GetMapping(value = "/{recipeDetailId}") - public AjaxResult getInfo(@PathVariable("recipeDetailId") Long recipeDetailId) { - return success(cookRecipeDetailService.selectCookRecipeDetailByRecipeDetailId(recipeDetailId)); - } - - /** - * 新增菜品计划详情信息 - */ - @ApiOperation(value = "新增菜品计划详情信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:detail:add") - @SysLog(title = "菜品计划详情信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增菜品计划详情信息") - @PostMapping - public AjaxResult add(@RequestBody CookRecipeDetail cookRecipeDetail) { - try { - return toAjax(cookRecipeDetailService.insertCookRecipeDetail(cookRecipeDetail)); - } catch (Exception e) { - return error(e.getMessage()); - } - } - - /** - * 修改菜品计划详情信息 - */ - @ApiOperation(value = "修改菜品计划详情信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:detail:edit") - @SysLog(title = "菜品计划详情信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改菜品计划详情信息") - @PostMapping("/edit") - public AjaxResult edit(@RequestBody CookRecipeDetail cookRecipeDetail) { - try { - return toAjax(cookRecipeDetailService.updateCookRecipeDetail(cookRecipeDetail)); - } catch (Exception e) { - return error(e.getMessage()); - } - } - - /** - * 删除菜品计划详情信息 - */ - @ApiOperation(value = "删除菜品计划详情信息") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:detail:remove") - @SysLog(title = "菜品计划详情信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除菜品计划详情信息") - @PostMapping("/del/{recipeDetailIds}") - public AjaxResult remove(@PathVariable Long[] recipeDetailIds) { - return toAjax(cookRecipeDetailService.deleteCookRecipeDetailByRecipeDetailIds(recipeDetailIds)); - } -} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDishesController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDishesController.java deleted file mode 100644 index c7370b6..0000000 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeDishesController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bonus.canteen.core.cook.controller; - -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import com.bonus.common.log.enums.OperaType; -//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; -import com.bonus.canteen.core.cook.domain.CookRecipeDishes; -import com.bonus.canteen.core.cook.service.ICookRecipeDishesService; -import com.bonus.common.core.web.controller.BaseController; -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.core.utils.poi.ExcelUtil; -import com.bonus.common.core.web.page.TableDataInfo; - -/** - * 菜品计划菜品关联Controller - * - * @author xsheng - * @date 2025-05-25 - */ -@Api(tags = "菜品计划菜品关联接口") -@RestController -@RequestMapping("/cook_recipe_dishes") -public class CookRecipeDishesController extends BaseController { - @Autowired - private ICookRecipeDishesService cookRecipeDishesService; - - /** - * 查询菜品计划菜品关联列表 - */ - @ApiOperation(value = "查询菜品计划菜品关联列表") - //@RequiresPermissions("cook:dishes:list") - @GetMapping("/list") - public TableDataInfo list(CookRecipeDishes cookRecipeDishes) { - startPage(); - List list = cookRecipeDishesService.selectCookRecipeDishesList(cookRecipeDishes); - return getDataTable(list); - } - - /** - * 导出菜品计划菜品关联列表 - */ - @ApiOperation(value = "导出菜品计划菜品关联列表") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:dishes:export") - @SysLog(title = "菜品计划菜品关联", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出菜品计划菜品关联") - @PostMapping("/export") - public void export(HttpServletResponse response, CookRecipeDishes cookRecipeDishes) { - List list = cookRecipeDishesService.selectCookRecipeDishesList(cookRecipeDishes); - ExcelUtil util = new ExcelUtil(CookRecipeDishes.class); - util.exportExcel(response, list, "菜品计划菜品关联数据"); - } - - /** - * 获取菜品计划菜品关联详细信息 - */ - @ApiOperation(value = "获取菜品计划菜品关联详细信息") - //@RequiresPermissions("cook:dishes:query") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(cookRecipeDishesService.selectCookRecipeDishesById(id)); - } - - /** - * 新增菜品计划菜品关联 - */ - @ApiOperation(value = "新增菜品计划菜品关联") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:dishes:add") - @SysLog(title = "菜品计划菜品关联", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增菜品计划菜品关联") - @PostMapping - public AjaxResult add(@RequestBody CookRecipeDishes cookRecipeDishes) { - try { - return toAjax(cookRecipeDishesService.insertCookRecipeDishes(cookRecipeDishes)); - } catch (Exception e) { - return error(e.getMessage()); - } - } - - /** - * 修改菜品计划菜品关联 - */ - @ApiOperation(value = "修改菜品计划菜品关联") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:dishes:edit") - @SysLog(title = "菜品计划菜品关联", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改菜品计划菜品关联") - @PostMapping("/edit") - public AjaxResult edit(@RequestBody CookRecipeDishes cookRecipeDishes) { - try { - return toAjax(cookRecipeDishesService.updateCookRecipeDishes(cookRecipeDishes)); - } catch (Exception e) { - return error(e.getMessage()); - } - } - - /** - * 删除菜品计划菜品关联 - */ - @ApiOperation(value = "删除菜品计划菜品关联") - //@PreventRepeatSubmit - //@RequiresPermissions("cook:dishes:remove") - @SysLog(title = "菜品计划菜品关联", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除菜品计划菜品关联") - @PostMapping("/del/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(cookRecipeDishesService.deleteCookRecipeDishesByIds(ids)); - } -} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java index a636ab9..1e31043 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDetailMapper.java @@ -57,4 +57,6 @@ public interface CookRecipeDetailMapper { * @return 结果 */ public int deleteCookRecipeDetailByRecipeDetailIds(Long[] recipeDetailIds); + + public List getToDeleteCookRecipeDetailIds(Long recipeId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDishesMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDishesMapper.java index 202972f..5930af8 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDishesMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeDishesMapper.java @@ -57,4 +57,6 @@ public interface CookRecipeDishesMapper { * @return 结果 */ public int deleteCookRecipeDishesByIds(Long[] ids); + + public int deleteCookRecipeDishesByCookRecipeDetailIds(Long[] recipeDetailIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index 68e796f..5802474 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -96,8 +96,10 @@ public class CookRecipeServiceImpl implements ICookRecipeService { // 指定日期菜谱,删掉指定日期的菜谱 // 循环菜谱,删掉模板数据 + 今日开始的详情数据 if (!isCreate) { - - + List cookRecipeDetailIds = cookRecipeDetailMapper.getToDeleteCookRecipeDetailIds(cookRecipeDTO.getRecipeId()); + Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new); + cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray); + cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray); } // 插入指定日期、日循环摸板、周循环模板 if (!CollectionUtils.isEmpty(cookRecipeDTO.getRecipeDateList())) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml index 7913cbe..70cff6e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDetailMapper.xml @@ -98,4 +98,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{recipeDetailId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDishesMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDishesMapper.xml index a35bb35..0c1aa10 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDishesMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeDishesMapper.xml @@ -118,4 +118,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + delete from cook_recipe_dishes where recipe_detail_id in + + #{id} + + \ No newline at end of file