提交 84c779ce 编写于 作者: S shiziyuan9527

组织菜单成员列表角色列更改查询方式

上级 4fb03996
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.Role;
import io.metersphere.base.domain.User;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
......@@ -19,5 +20,7 @@ public interface ExtUserRoleMapper {
List<OrganizationMemberDTO> getOrganizationMemberDTO(@Param("orgMember") QueryOrgMemberRequest request);
List<Role> getOrganizationMemberRoles(@Param("orgId") String orgId, @Param("userId") String userId);
}
......@@ -63,6 +63,14 @@
where o.id = #{orgMember.organizationId}
</select>
<select id="getOrganizationMemberRoles" resultType="io.metersphere.base.domain.Role">
select r.id, r.name
from organization o
join user_role ur on o.id = ur.source_id
join role r on r.id = ur.role_id
where o.id = #{orgId} and ur.user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
......@@ -140,6 +140,9 @@ public class UserController {
return PageUtils.setPageInfo(page, userService.getOrgMemberList(request));
}
/**
* 查询组织成员列表 带角色信息
*/
@PostMapping("/orgmemberdto/list/{goPage}/{pageSize}")
public Pager<List<OrganizationMemberDTO>> getOrganizationMemberDTO(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
......
package io.metersphere.controller;
import io.metersphere.base.domain.Role;
import io.metersphere.service.UserRoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RequestMapping("userrole")
@RestController
public class UserRoleController {
@Resource
private UserRoleService userRoleService;
@GetMapping("/list/{orgId}/{userId}")
public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) {
return userRoleService.getOrganizationMemberRoles(orgId, userId);
}
}
package io.metersphere.service;
import io.metersphere.base.domain.Role;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class UserRoleService {
@Resource
private ExtUserRoleMapper extUserRoleMapper;
public List<Role> getOrganizationMemberRoles(String orgId, String userId) {
return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId);
}
}
......@@ -85,7 +85,7 @@
btnTips: "添加组织成员",
createVisible: false,
form: {},
queryPath: "/user/orgmemberdto/list",
queryPath: "/user/orgmember/list",
condition: "",
tableData: [],
rules: {
......@@ -111,8 +111,15 @@
};
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
let url = "/userrole/list/" + this.currentUser().lastOrganizationId;
for (let i = 0; i < this.tableData.length; i++) {
this.$get(url + "/" + this.tableData[i].id, response => {
let roles = response.data;
this.$set(this.tableData[i], "roles", roles);
})
}
this.total = data.itemCount;
})
},
buildPagePath(path) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册