系统菜单下用户搜索
This commit is contained in:
parent
c703a2f7f3
commit
42b4dfac7f
|
@ -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.utils.PageUtils;
|
||||
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.QueryMemberRequest;
|
||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||
|
@ -44,9 +45,9 @@ public class UserController {
|
|||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
@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);
|
||||
return PageUtils.setPageInfo(page, userService.getUserList());
|
||||
return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request));
|
||||
}
|
||||
|
||||
@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.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtUserMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
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.QueryMemberRequest;
|
||||
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.UserRoleDTO;
|
||||
import io.metersphere.dto.UserRoleHelpDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.user.SessionUser;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -42,6 +43,8 @@ public class UserService {
|
|||
private OrganizationMapper organizationMapper;
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
@Resource
|
||||
private ExtUserMapper extUserMapper;
|
||||
|
||||
public UserDTO insert(User user) {
|
||||
checkUserParam(user);
|
||||
|
@ -112,6 +115,10 @@ public class UserService {
|
|||
return userMapper.selectByExample(null);
|
||||
}
|
||||
|
||||
public List<User> getUserListWithRequest(UserRequest request) {
|
||||
return extUserMapper.getUserList(request);
|
||||
}
|
||||
|
||||
public void deleteUser(String userId) {
|
||||
userMapper.deleteByPrimaryKey(userId);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<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>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -226,8 +228,14 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.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;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
|
|
Loading…
Reference in New Issue