|
@@ -1,5 +1,8 @@
|
|
|
package com.jd.brume.controller
|
|
|
|
|
|
+import com.jd.brume.service.MenuService
|
|
|
+import com.jd.brume.service.RoleMenuService
|
|
|
+
|
|
|
import javax.annotation.Resource
|
|
|
import javax.validation.constraints.NotNull
|
|
|
|
|
@@ -18,7 +21,6 @@ import com.jd.brume.entity.func.MenuButtonFunc
|
|
|
import com.jd.brume.entity.resultmap.MenuButtonSelect
|
|
|
import com.jd.brume.service.DictService
|
|
|
import com.jd.brume.service.MenuButtonService
|
|
|
-import com.jd.brume.util.Constant
|
|
|
import com.jd.brume.util.Result
|
|
|
import com.jd.brume.util.ResultEnum
|
|
|
import com.jd.brume.vo.MenuButtonVo
|
|
@@ -41,6 +43,12 @@ class MenuButtonController {
|
|
|
|
|
|
@Resource
|
|
|
DictService dictService
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ MenuService menuService
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ RoleMenuService roleMenuService
|
|
|
|
|
|
/**
|
|
|
* 分页查询
|
|
@@ -92,6 +100,14 @@ class MenuButtonController {
|
|
|
*/
|
|
|
@DeleteMapping('delete')
|
|
|
def deleteMenuButton(@NotNull Integer btnId) {
|
|
|
+ def count = roleMenuService.count(Wrappers.lambdaQuery().apply(" FIND_IN_SET({0}, button_ids)", btnId))
|
|
|
+ if (count > 0){
|
|
|
+ return new Result().msg(100, '按钮已被角色使用')
|
|
|
+ }
|
|
|
+ count = menuService.count(Wrappers.lambdaQuery().apply(" FIND_IN_SET({0}, btn_ids)", btnId))
|
|
|
+ if (count > 0){
|
|
|
+ return new Result().msg(100, '按钮已被菜单使用')
|
|
|
+ }
|
|
|
return new Result().ok(menuButtonService.removeById(btnId))
|
|
|
}
|
|
|
|