Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
8025d1102c
|
@ -0,0 +1,11 @@
|
||||||
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.User;
|
||||||
|
import io.metersphere.controller.request.UserRequest;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExtUserMapper {
|
||||||
|
|
||||||
|
List<User> getUserList(@Param("userRequest") UserRequest request);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!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.ExtUserMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.User">
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="email" jdbcType="VARCHAR" property="email" />
|
||||||
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||||
|
<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" />
|
||||||
|
<result column="last_workspace_id" jdbcType="VARCHAR" property="lastWorkspaceId" />
|
||||||
|
<result column="last_organization_id" jdbcType="VARCHAR" property="lastOrganizationId" />
|
||||||
|
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getUserList" resultMap="BaseResultMap">
|
||||||
|
select u.id, u.name, u.email, u.phone, u.language, u.status,
|
||||||
|
u.last_organization_id, u.last_workspace_id, u.language, u.create_time, u.update_time
|
||||||
|
from `user` u
|
||||||
|
<where>
|
||||||
|
<if test="userRequest.id != null">
|
||||||
|
AND u.id like CONCAT('%', #{userRequest.id},'%')
|
||||||
|
</if>
|
||||||
|
<if test="userRequest.name != null">
|
||||||
|
AND u.name like CONCAT('%', #{userRequest.name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="userRequest.email != null">
|
||||||
|
AND u.email like CONCAT('%', #{userRequest.email},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -7,6 +7,7 @@ import io.metersphere.base.domain.User;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
|
import io.metersphere.controller.request.UserRequest;
|
||||||
import io.metersphere.controller.request.member.AddMemberRequest;
|
import io.metersphere.controller.request.member.AddMemberRequest;
|
||||||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||||
|
@ -44,9 +45,9 @@ public class UserController {
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
@RequiresRoles(RoleConstants.ADMIN)
|
@RequiresRoles(RoleConstants.ADMIN)
|
||||||
public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize) {
|
public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody UserRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, userService.getUserList());
|
return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete/{userId}")
|
@GetMapping("/delete/{userId}")
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package io.metersphere.controller.request;
|
||||||
|
|
||||||
|
public class UserRequest {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,11 @@ package io.metersphere.service;
|
||||||
|
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtUserMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.CodingUtil;
|
import io.metersphere.commons.utils.CodingUtil;
|
||||||
|
import io.metersphere.controller.request.UserRequest;
|
||||||
import io.metersphere.controller.request.member.AddMemberRequest;
|
import io.metersphere.controller.request.member.AddMemberRequest;
|
||||||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||||
|
@ -13,7 +15,6 @@ import io.metersphere.dto.OrganizationMemberDTO;
|
||||||
import io.metersphere.dto.UserDTO;
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.dto.UserRoleDTO;
|
import io.metersphere.dto.UserRoleDTO;
|
||||||
import io.metersphere.dto.UserRoleHelpDTO;
|
import io.metersphere.dto.UserRoleHelpDTO;
|
||||||
import io.metersphere.i18n.Translator;
|
|
||||||
import io.metersphere.user.SessionUser;
|
import io.metersphere.user.SessionUser;
|
||||||
import io.metersphere.user.SessionUtils;
|
import io.metersphere.user.SessionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -42,6 +43,8 @@ public class UserService {
|
||||||
private OrganizationMapper organizationMapper;
|
private OrganizationMapper organizationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private WorkspaceMapper workspaceMapper;
|
private WorkspaceMapper workspaceMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtUserMapper extUserMapper;
|
||||||
|
|
||||||
public UserDTO insert(User user) {
|
public UserDTO insert(User user) {
|
||||||
checkUserParam(user);
|
checkUserParam(user);
|
||||||
|
@ -112,6 +115,10 @@ public class UserService {
|
||||||
return userMapper.selectByExample(null);
|
return userMapper.selectByExample(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<User> getUserListWithRequest(UserRequest request) {
|
||||||
|
return extUserMapper.getUserList(request);
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteUser(String userId) {
|
public void deleteUser(String userId) {
|
||||||
userMapper.deleteByPrimaryKey(userId);
|
userMapper.deleteByPrimaryKey(userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default {
|
||||||
'search_by_name': '根据名称搜索',
|
'search_by_name': '根据名称搜索',
|
||||||
'input_name': '请输入项目名称',
|
'input_name': '请输入项目名称',
|
||||||
'owning_workspace': '所属工作空间',
|
'owning_workspace': '所属工作空间',
|
||||||
'please_choose_workspace': '选择工作空间',
|
'please_choose_workspace': '请选择工作空间',
|
||||||
},
|
},
|
||||||
member: {
|
member: {
|
||||||
'create': '添加成员',
|
'create': '添加成员',
|
||||||
|
|
|
@ -53,16 +53,6 @@
|
||||||
<el-form-item :label="$t('commons.description')">
|
<el-form-item :label="$t('commons.description')">
|
||||||
<el-input type="textarea" v-model="form.description"></el-input>
|
<el-input type="textarea" v-model="form.description"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('project.owning_workspace')" v-permission="['org_admin']">
|
|
||||||
<el-select v-model="form.workspaceId" :placeholder="$t('project.please_choose_workspace')" class="select-width">
|
|
||||||
<el-option
|
|
||||||
v-for="item in form.allWorkspace"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
|
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
|
||||||
|
@ -75,6 +65,7 @@
|
||||||
<script>
|
<script>
|
||||||
import MsCreateBox from "../settings/CreateBox";
|
import MsCreateBox from "../settings/CreateBox";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
|
import {TokenKey} from "../../../common/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsProject",
|
name: "MsProject",
|
||||||
|
@ -114,11 +105,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
currentUser: () => {
|
||||||
|
let user = localStorage.getItem(TokenKey);
|
||||||
|
return JSON.parse(user);
|
||||||
|
}
|
||||||
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.createVisible = false;
|
this.createVisible = false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
create() {
|
create() {
|
||||||
|
let workspaceId = this.currentUser.lastWorkspaceId;
|
||||||
|
if (!workspaceId) {
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: this.$t('project.please_choose_workspace')
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.title = this.$t('project.create');
|
this.title = this.$t('project.create');
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
this.form = {};
|
this.form = {};
|
||||||
|
@ -127,13 +132,6 @@
|
||||||
this.title = this.$t('project.edit');
|
this.title = this.$t('project.edit');
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
this.form = Object.assign({}, row);
|
this.form = Object.assign({}, row);
|
||||||
|
|
||||||
let workspaceId = this.form.workspaceId;
|
|
||||||
this.result = this.$get('workspace/list/orgworkspace/', response => {
|
|
||||||
this.$set(this.form, "allWorkspace", response.data);
|
|
||||||
})
|
|
||||||
// 编辑使填充角色信息
|
|
||||||
this.$set(this.form, 'workspaceId', workspaceId);
|
|
||||||
},
|
},
|
||||||
submit(formName) {
|
submit(formName) {
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
|
@ -205,7 +203,4 @@
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-width {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||||
</span>
|
</span>
|
||||||
<span class="search">
|
<span class="search">
|
||||||
<el-input type="text" size="small" :placeholder="$t('member.search_by_name')" prefix-icon="el-icon-search" maxlength="60" v-model="condition" clearable/>
|
<el-input type="text" size="small" :placeholder="$t('member.search_by_name')"
|
||||||
|
prefix-icon="el-icon-search" maxlength="60" @change="search"
|
||||||
|
v-model="condition" clearable/>
|
||||||
</span>
|
</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -226,8 +228,14 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
search() {
|
||||||
|
this.initTableData();
|
||||||
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
this.result = this.$post(this.buildPagePath(this.queryPath),{},response => {
|
let param = {
|
||||||
|
name: this.condition
|
||||||
|
};
|
||||||
|
this.result = this.$post(this.buildPagePath(this.queryPath),param,response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
|
|
Loading…
Reference in New Issue