| 对比新文件 | 
 |  |  | 
 |  |  | package com.mzl.flower.web.system; | 
 |  |  |  | 
 |  |  | import com.mzl.flower.base.BaseController; | 
 |  |  | import com.mzl.flower.base.R; | 
 |  |  | import com.mzl.flower.base.ReturnDataDTO; | 
 |  |  | import com.mzl.flower.base.annotation.OperationLog; | 
 |  |  | import com.mzl.flower.config.exception.ValidationException; | 
 |  |  | import com.mzl.flower.dto.request.system.CreateAppMenuDTO; | 
 |  |  | import com.mzl.flower.dto.request.system.CreateMenuDTO; | 
 |  |  | import com.mzl.flower.dto.request.system.UpdateAppMenuDTO; | 
 |  |  | import com.mzl.flower.dto.request.system.UpdateMenuDTO; | 
 |  |  | import com.mzl.flower.dto.response.system.*; | 
 |  |  | import com.mzl.flower.entity.flower.FlowerCategory; | 
 |  |  | import com.mzl.flower.entity.log.OperationRecord; | 
 |  |  | import com.mzl.flower.entity.system.AppMenu; | 
 |  |  | import com.mzl.flower.entity.system.Menu; | 
 |  |  | import com.mzl.flower.service.system.AppMenuService; | 
 |  |  | import com.mzl.flower.service.system.MenuService; | 
 |  |  | import com.mzl.flower.utils.ConverterUtil; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiImplicitParam; | 
 |  |  | import io.swagger.annotations.ApiImplicitParams; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.http.ResponseEntity; | 
 |  |  | import org.springframework.validation.annotation.Validated; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | @RequestMapping("/api/app/menu") | 
 |  |  | @Api(value = "小程序菜单管理", tags = "小程序菜单管理") | 
 |  |  | @Validated | 
 |  |  | public class AppMenuController extends BaseController { | 
 |  |  |     @Autowired | 
 |  |  |     private AppMenuService menuService; | 
 |  |  |  | 
 |  |  |     @GetMapping("/list") | 
 |  |  |     @ApiOperation(value = "查询菜单列表") | 
 |  |  |     public ResponseEntity<ReturnDataDTO<List<AppMenuTreeDTO>>> searchMenuList() { | 
 |  |  |         return returnData(R.SUCCESS.getCode(), menuService.searchOperationMenu()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/list/new") | 
 |  |  |     @ApiOperation(value = "新增菜单") | 
 |  |  |     public ResponseEntity<ReturnDataDTO> addTenantMenu(@RequestBody @Validated CreateAppMenuDTO dto) { | 
 |  |  |         if (StringUtils.isNotBlank(dto.getParentId()) && !"-1".equals(dto.getParentId())) { | 
 |  |  |             AppMenu menu = menuService.getMenu(dto.getParentId()); | 
 |  |  |             if (menu == null) { | 
 |  |  |                 throw new ValidationException("父菜单不存在"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         menuService.addMenu(dto); | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping("/list/view") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "id", value = "菜单ID", required = true, dataType = "String", paramType = "query") | 
 |  |  |     }) | 
 |  |  |     @ApiOperation(value = "查询菜单详情") | 
 |  |  |     public ResponseEntity<ReturnDataDTO<AppMenuDTO>> getMenu(String id) { | 
 |  |  |         return returnData(R.SUCCESS.getCode(), menuService.getMenuDetail(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/list/edit") | 
 |  |  |     @ApiOperation(value = "编辑菜单") | 
 |  |  |     public ResponseEntity<ReturnDataDTO> updateTenantMenu(@RequestBody @Validated UpdateAppMenuDTO dto) { | 
 |  |  |         if (StringUtils.isNotBlank(dto.getParentId()) && !"-1".equals(dto.getParentId())) { | 
 |  |  |             AppMenu menu = menuService.getMenu(dto.getParentId()); | 
 |  |  |             if (menu == null) { | 
 |  |  |                 throw new ValidationException("父菜单不存在"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         menuService.updateMenu(dto); | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping("/list/delete") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "id", value = "菜单ID", required = true, dataType = "String", paramType = "query") | 
 |  |  |     }) | 
 |  |  |     @ApiOperation(value = "删除菜单") | 
 |  |  |     public ResponseEntity<ReturnDataDTO> deleteTenantMenu(String id) { | 
 |  |  |         menuService.deleteMenu(id); | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @GetMapping("/tree/shown") | 
 |  |  |     @ApiOperation(value = "子账号显示菜单") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "id", value = "菜单id", required = true, dataType = "String", paramType = "query") | 
 |  |  |     }) | 
 |  |  |     public ResponseEntity<ReturnDataDTO<?>> showMenu(String id){ | 
 |  |  |  | 
 |  |  |         menuService.updateMenuShow(id); | 
 |  |  |  | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null ); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping("/tree/hidden") | 
 |  |  |     @ApiOperation(value = "子账号隐藏菜单") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "id", value = "菜单id", required = true, dataType = "String", paramType = "query") | 
 |  |  |     }) | 
 |  |  |     public ResponseEntity<ReturnDataDTO<?>> hideMenu(String id){ | 
 |  |  |         menuService.updateMenuHidden(id); | 
 |  |  |         return returnData(R.SUCCESS.getCode(), null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @GetMapping("/permission/menu") | 
 |  |  |     @ApiOperation(value = "子账号有权限的菜单") | 
 |  |  |  | 
 |  |  |     public ResponseEntity<ReturnDataDTO<?>> getPermissionMenu(){ | 
 |  |  |         return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(menuService.getPermissionMenu(), AppMenuSimpleDTO.class)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |