diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java index 5115569..1950dc2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.lang.Assert; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.req.RolePageReq; import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; @@ -60,6 +61,7 @@ public class RoleController { Role role = roleService.getById(id); Assert.notNull(role, "角色不存在"); RoleVO query = BeanUtil.toBean(role, RoleVO.class); + query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); // 菜单 roleManage.buildMenu(query); return query; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java index 025085b..e9d18ec 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java @@ -37,6 +37,9 @@ public class RoleVO extends BaseEntity { @ApiModelProperty(value = "名称") private String name; + @ApiModelProperty("管理角色ID") + private List manageRoleIdList; + /** * 描述 */ diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java index 092fdfa..7b5d953 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java @@ -6,6 +6,7 @@ import cn.hutool.db.Db; import cn.hutool.db.Entity; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.sys.model.entity.Menu; import com.ningdatech.pmapi.sys.model.entity.Role; @@ -71,11 +72,12 @@ class IMenuServiceTest extends AppTests { @Test public void initMenu() { - menuService.remove(null); - roleMenuService.remove(null); - String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); - List obj = JSONUtil.toList(str, JSONObject.class); - save(obj, 0); + // menuService.remove(null); + roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class) + .eq(RoleMenu::getRoleId,1)); + // String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); + // List obj = JSONUtil.toList(str, JSONObject.class); + // save(obj, 0); menuService.list().forEach(w -> { roleMenuService.save(new RoleMenu() {{ setRoleId(1L);