组织菜单成员列表添加角色列
This commit is contained in:
parent
cf828f87b2
commit
27b57dcb9a
|
@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
|
|||
import io.metersphere.base.domain.User;
|
||||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
||||
import io.metersphere.dto.OrganizationMemberDTO;
|
||||
import io.metersphere.dto.UserRoleHelpDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -15,4 +16,8 @@ public interface ExtUserRoleMapper {
|
|||
List<User> getMemberList(@Param("member") QueryMemberRequest request);
|
||||
|
||||
List<User> getOrgMemberList(@Param("orgMember") QueryOrgMemberRequest request);
|
||||
|
||||
List<OrganizationMemberDTO> getOrganizationMemberDTO(@Param("orgMember") QueryOrgMemberRequest request);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,21 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="io.metersphere.base.mapper.ext.ExtUserRoleMapper">
|
||||
|
||||
<resultMap id="BaseOrganizationMemberDTOMap" type="io.metersphere.dto.OrganizationMemberDTO">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="email" jdbcType="VARCHAR" property="email" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="language" jdbcType="VARCHAR" property="language" />
|
||||
<collection property="roles" ofType="io.metersphere.base.domain.Role">
|
||||
<id column="rid" jdbcType="VARCHAR" property="id" />
|
||||
<result column="rname" jdbcType="VARCHAR" property="name" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserRoleHelpList" parameterType="java.lang.String"
|
||||
resultType="io.metersphere.dto.UserRoleHelpDTO">
|
||||
SELECT
|
||||
|
@ -38,4 +53,16 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getOrganizationMemberDTO" resultMap="BaseOrganizationMemberDTOMap">
|
||||
select u.id, u.name, u.email, u.language, u.create_time, u.update_time, u.phone,
|
||||
o.id, o.name, ur.id, r.id as rid, r.name as rname
|
||||
from organization o
|
||||
join user_role ur on o.id = ur.source_id
|
||||
join user u on ur.user_id = u.id
|
||||
join role r on r.id = ur.role_id
|
||||
where o.id = #{orgMember.organizationId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
|
@ -10,6 +10,7 @@ import io.metersphere.controller.request.member.AddMemberRequest;
|
|||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
||||
import io.metersphere.dto.OrganizationMemberDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.dto.UserRoleDTO;
|
||||
import io.metersphere.service.UserService;
|
||||
|
@ -139,4 +140,10 @@ 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);
|
||||
return PageUtils.setPageInfo(page, userService.getOrganizationMemberDTO(request));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import io.metersphere.base.domain.Role;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrganizationMemberDTO {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String email;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String status;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String language;
|
||||
|
||||
private List<Role> roles = new ArrayList<>();
|
||||
|
||||
public List<Role> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<Role> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Long updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import io.metersphere.controller.request.member.AddMemberRequest;
|
|||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
||||
import io.metersphere.dto.OrganizationMemberDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.dto.UserRoleDTO;
|
||||
import io.metersphere.dto.UserRoleHelpDTO;
|
||||
|
@ -306,4 +307,8 @@ public class UserService {
|
|||
example.createCriteria().andIdEqualTo(userId).andPasswordEqualTo(CodingUtil.md5(password));
|
||||
return userMapper.countByExample(example) > 0;
|
||||
}
|
||||
|
||||
public List<OrganizationMemberDTO> getOrganizationMemberDTO(QueryOrgMemberRequest request) {
|
||||
return extUserRoleMapper.getOrganizationMemberDTO(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
<el-table-column prop="name" label="用户名"/>
|
||||
<el-table-column prop="email" label="邮箱"/>
|
||||
<el-table-column prop="phone" label="电话"/>
|
||||
<el-table-column prop="roles" label="角色" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark">
|
||||
{{ role.name }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
|
||||
|
@ -77,7 +85,7 @@
|
|||
btnTips: "添加组织成员",
|
||||
createVisible: false,
|
||||
form: {},
|
||||
queryPath: "/user/orgmember/list",
|
||||
queryPath: "/user/orgmemberdto/list",
|
||||
condition: "",
|
||||
tableData: [],
|
||||
rules: {
|
||||
|
|
Loading…
Reference in New Issue