|
@@ -11,6 +11,7 @@ import com.huimv.farm.damsubsidy.mapper.AccountGroupMapper;
|
|
|
import com.huimv.farm.damsubsidy.mapper.GroupMenuMapper;
|
|
|
import com.huimv.farm.damsubsidy.mapper.MenuMapper;
|
|
|
import com.huimv.farm.damsubsidy.service.IAuthorizeService;
|
|
|
+import com.huimv.farm.damsubsidy.service.IGroupMenuService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -27,6 +28,8 @@ public class AuthorizeServiceImpl implements IAuthorizeService {
|
|
|
GroupMenuMapper groupMenuMapper;
|
|
|
@Autowired
|
|
|
private MenuMapper menuMapper;
|
|
|
+ @Autowired
|
|
|
+ IGroupMenuService groupMenuService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -60,7 +63,7 @@ public class AuthorizeServiceImpl implements IAuthorizeService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Result saveGroupMenu(String groupId, String menuIds) {
|
|
|
+ public Result saveGroupMenu(String groupId, String menuIds,String isAll) {
|
|
|
/**
|
|
|
* Step1:先删除原先的权限组关联菜单数据;
|
|
|
* Step2:再添加新的账号权限组关联菜单数据;
|
|
@@ -68,18 +71,27 @@ public class AuthorizeServiceImpl implements IAuthorizeService {
|
|
|
groupMenuMapper.removeGroupMenu(groupId);
|
|
|
if (StringUtils.isNotBlank(menuIds)){
|
|
|
String[] menuIdsArray = menuIds.split(",");
|
|
|
- for (int a = 0; a < menuIdsArray.length; a++) {
|
|
|
+ String[] split = isAll.split(",");
|
|
|
|
|
|
- GroupMenu GroupMenu = new GroupMenu();
|
|
|
- GroupMenu.setGroupId(Integer.parseInt(groupId));
|
|
|
- GroupMenu.setMenuId(Integer.parseInt(menuIdsArray[a]));
|
|
|
- groupMenuMapper.insert(GroupMenu);
|
|
|
+ List<GroupMenu> list = new ArrayList();
|
|
|
+ for (int a = 0; a < menuIdsArray.length; a++) {
|
|
|
+ GroupMenu groupMenu = new GroupMenu();
|
|
|
+ groupMenu.setGroupId(Integer.parseInt(groupId));
|
|
|
+ groupMenu.setMenuId(Integer.parseInt(menuIdsArray[a]));
|
|
|
+ list.add(groupMenu);
|
|
|
}
|
|
|
-
|
|
|
+ if (StringUtils.isNotBlank(isAll)){
|
|
|
+ for (GroupMenu groupMenu : list) {
|
|
|
+ for (String s : split) {
|
|
|
+ if (groupMenu.getMenuId()== Integer.parseInt(s)){
|
|
|
+ groupMenu.setIsAll(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupMenuService.saveBatch(list);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- return new Result(10001, "保存权限组关联菜单成功", true);
|
|
|
+ return new Result(10000, "保存权限组关联菜单成功", true);
|
|
|
}
|
|
|
|
|
|
|