调整部门用户选择的业务功能接口
This commit is contained in:
parent
64d42f69ec
commit
b06317db27
@ -3,6 +3,7 @@ package ink.wgink.interfaces.department;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
@ -126,4 +127,21 @@ public interface IDepartmentUserBaseService {
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentDTO> listDepartmentByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> listUserByDepartmentId(String departmentId);
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
*
|
||||
* @param departmentId 部门ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageUserByDepartmentId(String departmentId, ListPage page);
|
||||
}
|
||||
|
@ -30,9 +30,10 @@ public interface IRoleDepartmentUserBaseService {
|
||||
*
|
||||
* @param departmentId 部门ID
|
||||
* @param roleId 角色ID
|
||||
* @param keywords 关键字
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentUserDTO> listUserByDepartmentIdAndRoleId(String departmentId, String roleId);
|
||||
List<DepartmentUserDTO> listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(String departmentId, String roleId, String keywords);
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
@ -42,5 +43,5 @@ public interface IRoleDepartmentUserBaseService {
|
||||
* @param page 分页参数
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page);
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import ink.wgink.pojo.pos.RolePO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -74,7 +75,7 @@ public interface IRoleUserBaseService {
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param roleId
|
||||
* @param roleId 角色ID
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> listUserByRoleId(String roleId);
|
||||
@ -87,4 +88,20 @@ public interface IRoleUserBaseService {
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageUserByRoleId(String roleId, ListPage page);
|
||||
|
||||
/**
|
||||
* 无部门无角色用户
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> listUserNoDepartmentAndNoRole(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 没有角色并且没有组织机构的用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageUserNoDepartmentAndNoRole(ListPage page);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import ink.wgink.annotation.rpc.rest.method.RemotePostMethod;
|
||||
import ink.wgink.annotation.rpc.rest.params.*;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
|
||||
@ -54,4 +55,11 @@ public interface IDepartmentUserRemoteService {
|
||||
|
||||
@RemoteGetMethod("/list-department/user-id/{userId}")
|
||||
List<DepartmentDTO> listDepartmentByUserId(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemotePathParams("userId") String userId);
|
||||
|
||||
@RemoteGetMethod("/list-user/department-id/{departmentId}")
|
||||
List<UserDTO> listUserByDepartmentId(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemotePathParams("departmentId") String departmentId);
|
||||
|
||||
@RemoteGetMethod("/listpage-user/department-id/{departmentId}")
|
||||
SuccessResultList<List<UserDTO>> listPageUserByDepartmentId(String userCenter, @RemotePathParams("departmentId") String departmentId, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParams("page") int page, @RemoteQueryParams("rows") int rows, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,13 @@ import java.util.Map;
|
||||
@RemoteService("/resource/role/department/user")
|
||||
public interface IRoleDepartmentUserRemoteService {
|
||||
|
||||
@RemoteGetMethod("listpage-user/{departmentId}/{roleId}")
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemotePathParams("departmentId") String departmentId, @RemotePathParams("roleId") String roleId, @RemoteQueryParams("page") int page, @RemoteQueryParams("page") int rows, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
@RemoteGetMethod("listpage-department-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUserByDepartmentIdAndRoleId(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemotePathParams("departmentId") String departmentId, @RemotePathParams("roleId") String roleId, @RemoteQueryParams("page") int page, @RemoteQueryParams("page") int rows, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
|
||||
@RemoteGetMethod("list-department-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
List<DepartmentUserDTO> listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(@RemoteServerParams String userCenter,
|
||||
@RemotePathParams("departmentId") String departmentId,
|
||||
@RemotePathParams("roleId") String roleId,
|
||||
@RemoteQueryParams("access_token") String accessToken,
|
||||
@RemoteQueryParams("keywords") String keywords);
|
||||
}
|
||||
|
@ -43,4 +43,10 @@ public interface IRoleUserRemoteService {
|
||||
|
||||
@RemoteGetMethod("/listpage-user/role-id/{roleId}")
|
||||
SuccessResultList<List<UserDTO>> listPageUserByRoleId(@RemoteServerParams String userCenter, @RemotePathParams("roleId") String roleId, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParams("page") int page, @RemoteQueryParams("rows") int rows, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
|
||||
@RemoteGetMethod("/list-user/no-department/no-role")
|
||||
List<UserDTO> listUserNoDepartmentAndNoRole(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
|
||||
@RemoteGetMethod("/listpage-user/no-department/no-role")
|
||||
SuccessResultList<List<UserDTO>> listPageUserNoDepartmentAndNoRole(@RemoteServerParams String userCenter, @RemoteQueryParams("access_token") String accessToken, @RemoteQueryParams("page") int page, @RemoteQueryParams("rows") int rows, @RemoteQueryParamsMap Map<String, Object> params);
|
||||
}
|
||||
|
@ -135,4 +135,14 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
return departmentUserRemoteService.listDepartmentByUserId(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listUserByDepartmentId(String departmentId) {
|
||||
return departmentUserRemoteService.listUserByDepartmentId(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), departmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageUserByDepartmentId(String departmentId, ListPage page) {
|
||||
return departmentUserRemoteService.listPageUserByDepartmentId(apiPathProperties.getUserCenter(), departmentId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), page.getPage(), page.getRows(), page.getParams());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ink.wgink.login.oauth2.client.service.role.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.department.IDepartmentBaseService;
|
||||
import ink.wgink.interfaces.department.IDepartmentUserBaseService;
|
||||
import ink.wgink.login.oauth2.client.remote.role.IRoleDepartmentUserRemoteService;
|
||||
@ -17,6 +19,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -62,22 +66,17 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentUserDTO> listUserByDepartmentIdAndRoleId(String departmentId, String roleId) {
|
||||
List<DepartmentUserDTO> departmentUserDTOs = departmentUserBaseService.list(departmentId);
|
||||
if (departmentUserDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
public List<DepartmentUserDTO> listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(String departmentId, String roleId, String keywords) {
|
||||
try {
|
||||
return roleDepartmentUserRemoteService.listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(apiPathProperties.getUserCenter(), departmentId, roleId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), StringUtils.isBlank(keywords) ? "" : URLEncoder.encode(keywords, ISystemConstant.CHARSET_UTF8));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new SearchException(e);
|
||||
}
|
||||
List<String> roleUserIds = roleUserService.listUserId(roleId);
|
||||
if (roleUserIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
clearNoRoleUser(departmentUserDTOs, roleUserIds);
|
||||
return departmentUserDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page) {
|
||||
return roleDepartmentUserRemoteService.listPageUserByDepartmentIdAndRoleId(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), departmentId, roleId, page.getPage(), page.getRows(), page.getParams());
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page) {
|
||||
return roleDepartmentUserRemoteService.listPageDepartmentUserByDepartmentIdAndRoleId(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), departmentId, roleId, page.getPage(), page.getRows(), page.getParams());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: RoleUserServiceImpl
|
||||
@ -89,4 +90,16 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
||||
public SuccessResultList<List<UserDTO>> listPageUserByRoleId(String roleId, ListPage page) {
|
||||
return roleUserRemoteService.listPageUserByRoleId(apiPathProperties.getUserCenter(), roleId, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), page.getPage(), page.getRows(), page.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listUserNoDepartmentAndNoRole(Map<String, Object> params) {
|
||||
params = params == null ? getHashMap(2) : params;
|
||||
return roleUserRemoteService.listUserNoDepartmentAndNoRole(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageUserNoDepartmentAndNoRole(ListPage page) {
|
||||
return roleUserRemoteService.listPageUserNoDepartmentAndNoRole(apiPathProperties.getUserCenter(), OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(), page.getPage(), page.getRows(), page.getParams());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
@ -135,4 +136,24 @@ public class DepartmentUserResourceController extends DefaultBaseController {
|
||||
return departmentUserService.listDepartmentByUserId(userId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户列表", notes = "通过部门ID获取用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "组织部门ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-user/department-id/{departmentId}")
|
||||
public List<UserDTO> listUserByRoleId(@PathVariable("departmentId") String departmentId) {
|
||||
return departmentUserService.listUserByDepartmentId(departmentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户分页列表", notes = "通过部门ID获取用户分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "组织部门ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage-user/department-id/{departmentId}")
|
||||
public SuccessResultList<List<UserDTO>> listPageUserByDepartmentId(@PathVariable("departmentId") String departmentId, ListPage page) {
|
||||
return departmentUserService.listPageUserByDepartmentId(departmentId, page);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -83,4 +84,12 @@ public interface IDepartmentUserDao extends IInitBaseTable {
|
||||
*/
|
||||
List<String> listDepartmentId(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserDTO> listUser(Map<String, Object> params) throws SearchException;
|
||||
}
|
||||
|
@ -130,5 +130,4 @@ public interface IDepartmentUserService extends IDepartmentUserBaseService {
|
||||
*/
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUser(SuccessResultList<List<UserDTO>> successResultList, List<DepartmentUserDTO> hasDepartmentUsers);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ink.wgink.service.department.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
@ -414,4 +416,18 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
return departmentService.listByIds(departmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listUserByDepartmentId(String departmentId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentId", departmentId);
|
||||
return departmentUserDao.listUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageUserByDepartmentId(String departmentId, ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<UserDTO> userDTOs = listUserByDepartmentId(departmentId);
|
||||
PageInfo<UserDTO> pageInfo = new PageInfo<>(userDTOs);
|
||||
return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="departmentUserDTO" type="ink.wgink.pojo.dtos.department.DepartmentUserDTO">
|
||||
<resultMap id="departmentUserDTO" type="ink.wgink.pojo.dtos.department.DepartmentUserDTO" extends="ink.wgink.service.user.dao.IUserDao.userDTO">
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="user_sort" property="userSort"/>
|
||||
@ -119,7 +119,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listUserId" parameterType="map" resultType="java.lang.String">
|
||||
<select id="listUserId" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
@ -143,6 +143,8 @@
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
user_id, user_sort
|
||||
ORDER BY
|
||||
user_sort
|
||||
</select>
|
||||
@ -160,7 +162,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 部门ID列表 -->
|
||||
<select id="listDepartmentId" parameterType="map" resultType="java.lang.String">
|
||||
<select id="listDepartmentId" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||
SELECT
|
||||
department_id
|
||||
FROM
|
||||
@ -178,4 +180,41 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 用户列表 -->
|
||||
<select id="listUser" parameterType="map" resultMap="ink.wgink.service.user.dao.IUserDao.userDTO" useCache="false">
|
||||
SELECT
|
||||
user_id,
|
||||
user_username,
|
||||
user_name,
|
||||
user_phone,
|
||||
user_email,
|
||||
user_type,
|
||||
user_state
|
||||
FROM
|
||||
sys_user t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
AND
|
||||
t1.user_username != 'admin'
|
||||
<if test="userType != null and userType != ''">
|
||||
AND
|
||||
t1.user_type = #{userType}
|
||||
</if>
|
||||
<if test="excludeUserType != null and excludeUserType != ''">
|
||||
AND
|
||||
t1.user_type != #{excludeUserType}
|
||||
</if>
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_department_user st1
|
||||
WHERE
|
||||
st1.department_id = #{departmentId}
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -158,13 +158,9 @@
|
||||
},
|
||||
callback: {
|
||||
onClick: function(event, treeId, treeNode) {
|
||||
if(treeNode.id == 0) {
|
||||
selectRoleId = undefined;
|
||||
} else {
|
||||
selectRoleId = treeNode.id;
|
||||
}
|
||||
selectRoleId = treeNode.id;
|
||||
$('#searchUser').val('');
|
||||
initUsers(selectedParentId);
|
||||
initUsers(selectedParentId, selectRoleId);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@ -214,7 +210,7 @@
|
||||
}
|
||||
};
|
||||
var zTree = $.fn.zTree.init($('#departmentTree'), setting);
|
||||
zTree.addNodes(null, {id: '1', pId: '-1', name: '自由用户', url: 'javascript:void(0);', isParent: 'false'});
|
||||
zTree.addNodes(null, {id: '1', pId: '-1', name: '无组织部门', url: 'javascript:void(0);', isParent: 'false'});
|
||||
zTree.addNodes(null, {id: '0', pId: '-1', name: '组织部门', url: 'javascript:void(0);', isParent: 'true'});
|
||||
common.refreshTree('departmentTree');
|
||||
}
|
||||
@ -258,12 +254,13 @@
|
||||
done: function(page, next) {
|
||||
var loadLayerIndex;
|
||||
var url = top.restAjax.path('api/department/user/listpage/{department}', [selectedParentId]);
|
||||
if(selectRoleId) {
|
||||
url = top.restAjax.path('api/role/department/user/listpage-user/{department}/{roleId}', [selectedParentId, selectRoleId]);
|
||||
if(typeof(selectRoleId) != 'undefined' && selectRoleId != null) {
|
||||
url = top.restAjax.path('api/role/department/user/listpage-user/department-id/{department}/role-id/{roleId}', [selectedParentId, selectRoleId]);
|
||||
}
|
||||
top.restAjax.get(url, {
|
||||
page: page,
|
||||
rows: 20
|
||||
rows: 20,
|
||||
excludeUserType: 3
|
||||
}, null, function(code, data) {
|
||||
next(addUserDom(data.rows), page < (parseInt(data.total / 20) + 1));
|
||||
}, function(code, data) {
|
||||
@ -282,8 +279,8 @@
|
||||
}
|
||||
var loadLayerIndex;
|
||||
var url = top.restAjax.path('api/department/user/list/{department}', [selectedParentId]);
|
||||
if(selectRoleId) {
|
||||
url = top.restAjax.path('api/role/department/user/list-user/{department}/{roleId}', [selectedParentId, selectRoleId]);
|
||||
if(typeof(selectRoleId) != 'undefined' && selectRoleId != null) {
|
||||
url = top.restAjax.path('api/role/department/user/list-user/department-id/{department}/role-id/{roleId}', [selectedParentId, selectRoleId]);
|
||||
}
|
||||
top.restAjax.get(url, {
|
||||
keywords: searchUser
|
||||
@ -298,8 +295,8 @@
|
||||
});
|
||||
}
|
||||
// 初始化人员列表
|
||||
function initUsers(parentId) {
|
||||
if(selectedParentId == parentId) {
|
||||
function initUsers(parentId, roleParentId) {
|
||||
if(selectedParentId == parentId && (typeof(selectRoleId) == 'undefined' || selectRoleId == null)) {
|
||||
return;
|
||||
}
|
||||
$('#userWrapper').empty();
|
||||
|
@ -9,10 +9,7 @@ import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.role.service.IRoleDepartmentUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -38,7 +35,7 @@ public class RoleDepartmentUserController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", dataType = "String", required = true),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-user/{roleId}/{areaCode}")
|
||||
@GetMapping("list-user/role-id/{roleId}/area-code/{areaCode}")
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("areaCode") String areaCode) {
|
||||
return roleDepartmentUserService.listUserByRoleIdAndAreaCode(roleId, areaCode);
|
||||
@ -48,12 +45,14 @@ public class RoleDepartmentUserController extends DefaultBaseController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path", dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String", required = true),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-user/{departmentId}/{roleId}")
|
||||
@GetMapping("list-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
public List<DepartmentUserDTO> listUserByDepartmentIdAndRoleId(@PathVariable("departmentId") String departmentId,
|
||||
@PathVariable("roleId") String roleId) {
|
||||
return roleDepartmentUserService.listUserByDepartmentIdAndRoleId(departmentId, roleId);
|
||||
@PathVariable("roleId") String roleId,
|
||||
@RequestParam(name = "keywords", required = false) String keywords) {
|
||||
return roleDepartmentUserService.listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(departmentId, roleId, keywords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户分页列表", notes = "通过部门ID、角色ID用户列表接口")
|
||||
@ -65,11 +64,11 @@ public class RoleDepartmentUserController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage-user/{departmentId}/{roleId}")
|
||||
@GetMapping("listpage-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(@PathVariable("departmentId") String departmentId, @PathVariable("roleId") String roleId, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return roleDepartmentUserService.listPageUserByDepartmentIdAndRoleId(departmentId, roleId, page);
|
||||
return roleDepartmentUserService.listPageDepartmentUserByDepartmentIdAndRoleId(departmentId, roleId, page);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,7 @@ import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.role.service.IRoleDepartmentUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -41,11 +38,25 @@ public class RoleDepartmentUserResourceController extends DefaultBaseController
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage-user/{departmentId}/{roleId}")
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(@PathVariable("departmentId") String departmentId, @PathVariable("roleId") String roleId, ListPage page) {
|
||||
@GetMapping("listpage-department-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUserByDepartmentIdAndRoleId(@PathVariable("departmentId") String departmentId, @PathVariable("roleId") String roleId, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return roleDepartmentUserService.listPageUserByDepartmentIdAndRoleId(departmentId, roleId, page);
|
||||
return roleDepartmentUserService.listPageDepartmentUserByDepartmentIdAndRoleId(departmentId, roleId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户列表", notes = "通过部门ID、角色ID用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-department-user/department-id/{departmentId}/role-id/{roleId}")
|
||||
public List<DepartmentUserDTO> listDepartmentUserByDepartmentIdAndRoleId(@PathVariable("departmentId") String departmentId,
|
||||
@PathVariable("roleId") String roleId,
|
||||
@RequestParam(name = "keywords", required = false) String keywords) {
|
||||
return roleDepartmentUserService.listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(departmentId, roleId, keywords);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -114,4 +114,21 @@ public class RoleUserResourceController extends DefaultBaseController {
|
||||
return roleUserService.listPageUserByRoleId(roleId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "无部门无角色用户列表", notes = "无部门无角色用户列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-user/no-department/no-role")
|
||||
public List<UserDTO> listUserNoDepartmentAndNoRole() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return roleUserService.listUserNoDepartmentAndNoRole(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "无部门无角色用户分页列表", notes = "无部门无角色用户分页列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage-user/no-department/no-role")
|
||||
public SuccessResultList<List<UserDTO>> listPageUserNoDepartmentAndNoRole(ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return roleUserService.listPageUserNoDepartmentAndNoRole(page);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -74,4 +75,13 @@ public interface IRoleUserDao extends IInitBaseTable {
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserDTO> listUser(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 部门用户列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<DepartmentUserDTO> listDepartmentUser(Map<String, Object> params) throws SearchException;
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.interfaces.role.IRoleUserBaseService;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -33,4 +35,11 @@ public interface IRoleUserService extends IRoleUserBaseService {
|
||||
*/
|
||||
void delete(String roleId, List<String> userIds);
|
||||
|
||||
/**
|
||||
* 部门用户列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentUserDTO> listDepartmentUser(Map<String, Object> params);
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: RoleDepartmentUserServiceImpl
|
||||
@ -60,43 +62,52 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentUserDTO> listUserByDepartmentIdAndRoleId(String departmentId, String roleId) {
|
||||
public List<DepartmentUserDTO> listDepartmentUserByDepartmentIdAndRoleIdAndKeywords(String departmentId, String roleId, String keywords) {
|
||||
if (StringUtils.equals(departmentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
return listUserByExcludeDepartment(roleId);
|
||||
return listUserByExcludeDepartmentAndKeywords(roleId, keywords);
|
||||
}
|
||||
return listUser(departmentId, roleId);
|
||||
return listUserByDepartmentIdAndRoleIdAndKeywords(departmentId, roleId, keywords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page) {
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUserByDepartmentIdAndRoleId(String departmentId, String roleId, ListPage page) {
|
||||
if (StringUtils.equals(departmentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
return listPageUserByExcludeDepartment(roleId, page);
|
||||
}
|
||||
return listPageUser(departmentId, roleId, page);
|
||||
return listPageDepartmentUser(departmentId, roleId, page);
|
||||
}
|
||||
|
||||
private List<DepartmentUserDTO> listUser(String departmentId, String roleId) {
|
||||
List<DepartmentUserDTO> departmentUserDTOs = departmentUserService.list(departmentId);
|
||||
if (departmentUserDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
private List<DepartmentUserDTO> listUserByDepartmentIdAndRoleIdAndKeywords(String departmentId, String roleId, String keywords) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("departmentId", departmentId);
|
||||
if (!StringUtils.equals(roleId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
// 有部门有角色用户列表
|
||||
params.put("roleId", roleId);
|
||||
return roleUserService.listDepartmentUser(params);
|
||||
}
|
||||
List<String> roleUserIds = roleUserService.listUserId(roleId);
|
||||
if (roleUserIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
clearNoRoleUser(departmentUserDTOs, roleUserIds);
|
||||
return departmentUserDTOs;
|
||||
// 有部门没有角色的用户列表
|
||||
params.put("noRole", true);
|
||||
return roleUserService.listDepartmentUser(params);
|
||||
}
|
||||
|
||||
private List<DepartmentUserDTO> listUserByExcludeDepartment(String roleId) {
|
||||
List<String> roleUserIds = roleUserService.listUserId(roleId);
|
||||
if (roleUserIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
/**
|
||||
* 不包含部门的部门用户
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
private List<DepartmentUserDTO> listUserByExcludeDepartmentAndKeywords(String roleId, String keywords) {
|
||||
Map<String, Object> params = getHashMap(6);
|
||||
params.put("keywords", keywords);
|
||||
params.put("noDepartment", true);
|
||||
params.put("excludeUserType", 3);
|
||||
if (StringUtils.equals(roleId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
// 无部门,无角色
|
||||
params.put("noRole", true);
|
||||
} else {
|
||||
params.put("roleId", roleId);
|
||||
}
|
||||
List<DepartmentUserDTO> hasDepartmentUsers = departmentUserService.list(roleUserIds);
|
||||
List<String> departmentUserIds = ArrayListUtil.listBeanStringIdValue(hasDepartmentUsers, "userId", DepartmentUserDTO.class);
|
||||
List<UserDTO> userDTOs = userService.listByExcludeIds(departmentUserIds, roleUserIds, null);
|
||||
return departmentUserService.listExcludeDepartmentUser(userDTOs);
|
||||
return roleUserService.listDepartmentUser(params);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,15 +118,15 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<DepartmentUserDTO>> listPageUserByExcludeDepartment(String roleId, ListPage page) {
|
||||
List<String> roleUserIds = roleUserService.listUserId(roleId);
|
||||
if (roleUserIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
if (StringUtils.equals(roleId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
// 有部门,没有角色
|
||||
page.getParams().put("noRole", true);
|
||||
} else {
|
||||
// 有部门,有角色
|
||||
page.getParams().put("roleId", roleId);
|
||||
}
|
||||
// 获取所有部门的用户列表
|
||||
List<DepartmentUserDTO> hasDepartmentUsers = departmentUserService.list(getHashMap(0));
|
||||
List<String> hasDepartmentUserIds = ArrayListUtil.listBeanStringIdValue(hasDepartmentUsers, "userId", DepartmentUserDTO.class);
|
||||
SuccessResultList<List<UserDTO>> successResultList = userService.listPageByExcludeIdsAndIncludeIds(hasDepartmentUserIds, roleUserIds, page);
|
||||
return departmentUserService.listPageExcludeDepartmentUser(successResultList);
|
||||
page.getParams().put("noDepartment", true);
|
||||
return listPageDepartmentUser(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,18 +136,29 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<DepartmentUserDTO>> listPageUser(String departmentId, String roleId, ListPage page) {
|
||||
List<String> roleUserIds = roleUserService.listUserId(roleId);
|
||||
if (roleUserIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
private SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUser(String departmentId, String roleId, ListPage page) {
|
||||
if (StringUtils.equals(roleId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
// 有部门,没有角色
|
||||
page.getParams().put("noRole", true);
|
||||
} else {
|
||||
// 有部门,有角色
|
||||
page.getParams().put("roleId", roleId);
|
||||
}
|
||||
List<DepartmentUserDTO> hasDepartmentUsers = departmentUserService.listByDepartmentIdAndUserIds(departmentId, roleUserIds);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
for (DepartmentUserDTO hasDepartmentUserId : hasDepartmentUsers) {
|
||||
userIds.add(hasDepartmentUserId.getUserId());
|
||||
}
|
||||
SuccessResultList<List<UserDTO>> successResultList = userService.listPageByIds(userIds, page);
|
||||
return departmentUserService.listPageDepartmentUser(successResultList, hasDepartmentUsers);
|
||||
page.getParams().put("departmentId", departmentId);
|
||||
return listPageDepartmentUser(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<DepartmentUserDTO>> listPageDepartmentUser(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<DepartmentUserDTO> departmentUserDTOs = roleUserService.listDepartmentUser(page.getParams());
|
||||
PageInfo<DepartmentUserDTO> pageInfo = new PageInfo<>(departmentUserDTOs);
|
||||
return new SuccessResultList<>(departmentUserDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,11 +8,13 @@ import ink.wgink.interfaces.role.IRoleUserDeleteAfterHandler;
|
||||
import ink.wgink.interfaces.role.IRoleUserSaveAfterHandler;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleSimpleDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.pos.RolePO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import ink.wgink.service.role.dao.IRoleUserDao;
|
||||
import ink.wgink.service.role.service.IRoleService;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
@ -44,6 +46,8 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
||||
private IRoleService roleService;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
@Autowired
|
||||
private IDepartmentUserService departmentUserService;
|
||||
@Autowired(required = false)
|
||||
private IRoleUserSaveAfterHandler roleUserSaveAfterHandler;
|
||||
@Autowired(required = false)
|
||||
@ -78,6 +82,12 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentUserDTO> listDepartmentUser(Map<String, Object> params) {
|
||||
params = params == null ? getHashMap(2) : params;
|
||||
return roleUserDao.listDepartmentUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserId(String roleId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
@ -167,6 +177,22 @@ public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUser
|
||||
return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listUserNoDepartmentAndNoRole(Map<String, Object> params) {
|
||||
params = params == null ? getHashMap(2) : params;
|
||||
params.put("noDepartment", true);
|
||||
params.put("noRole", true);
|
||||
return roleUserDao.listUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageUserNoDepartmentAndNoRole(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<UserDTO> userDTOs = listUserNoDepartmentAndNoRole(page.getParams());
|
||||
PageInfo<UserDTO> pageInfo = new PageInfo<>(userDTOs);
|
||||
return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
private List<String> listGroupUserId(Map<String, Object> params) {
|
||||
return roleUserDao.listGroupUserId(params);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listGroupUserId" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||
<select id="listGroupUserId" parameterType="map" resultType="java.lang.String" useCache="false">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
@ -109,7 +109,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 用户列表 -->
|
||||
<select id="listUser" parameterType="map" resultMap="ink.wgink.service.user.dao.IUserDao.userDTO" useCache="true">
|
||||
<select id="listUser" parameterType="map" resultMap="ink.wgink.service.user.dao.IUserDao.userDTO" useCache="false">
|
||||
SELECT
|
||||
user_id,
|
||||
user_username,
|
||||
@ -121,14 +121,152 @@
|
||||
FROM
|
||||
sys_user t1
|
||||
WHERE
|
||||
user_id IN (
|
||||
t1.is_delete = 0
|
||||
AND
|
||||
t1.user_username != 'admin'
|
||||
<if test="userType != null and userType != ''">
|
||||
AND
|
||||
t1.user_type = #{userType}
|
||||
</if>
|
||||
<if test="excludeUserType != null and excludeUserType != ''">
|
||||
AND
|
||||
t1.user_type != #{excludeUserType}
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_name LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_phone LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_email LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
SELECT
|
||||
user_id
|
||||
st1.user_id
|
||||
FROM
|
||||
sys_role_user st1
|
||||
sys_department_user st1
|
||||
WHERE
|
||||
department_id = #{departmentId}
|
||||
)
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
SELECT
|
||||
st2.user_id
|
||||
FROM
|
||||
sys_role_user st2
|
||||
WHERE
|
||||
role_id = #{roleId}
|
||||
)
|
||||
</if>
|
||||
<if test="noDepartment != null and noDepartment = true">
|
||||
AND
|
||||
t1.user_id NOT IN (
|
||||
SELECT
|
||||
st3.user_id
|
||||
FROM
|
||||
sys_department_user st3
|
||||
)
|
||||
</if>
|
||||
<if test="noRole != null and noRole = true">
|
||||
AND
|
||||
t1.user_id NOT IN (
|
||||
SELECT
|
||||
st4.user_id
|
||||
FROM
|
||||
sys_role_user st4
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 部门用户列表 -->
|
||||
<select id="listDepartmentUser" parameterType="map" resultMap="ink.wgink.service.department.dao.IDepartmentUserDao.departmentUserDTO" useCache="false">
|
||||
SELECT
|
||||
t1.user_id,
|
||||
t1.user_username,
|
||||
t1.user_name,
|
||||
t1.user_phone,
|
||||
t1.user_email,
|
||||
t1.user_type,
|
||||
t1.user_state,
|
||||
jt1.department_id,
|
||||
jt1.user_sort
|
||||
FROM
|
||||
sys_user t1
|
||||
LEFT JOIN
|
||||
sys_department_user jt1
|
||||
ON
|
||||
t1.user_id = jt1.user_id
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
AND
|
||||
t1.user_username != 'admin'
|
||||
|
||||
<if test="userType != null and userType != ''">
|
||||
AND
|
||||
t1.user_type = #{userType}
|
||||
</if>
|
||||
<if test="excludeUserType != null and excludeUserType != ''">
|
||||
AND
|
||||
t1.user_type != #{excludeUserType}
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_name LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_phone LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
user_email LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
SELECT
|
||||
st1.user_id
|
||||
FROM
|
||||
sys_department_user st1
|
||||
WHERE
|
||||
department_id = #{departmentId}
|
||||
)
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
t1.user_id IN (
|
||||
SELECT
|
||||
st2.user_id
|
||||
FROM
|
||||
sys_role_user st2
|
||||
WHERE
|
||||
role_id = #{roleId}
|
||||
)
|
||||
</if>
|
||||
<if test="noDepartment != null and noDepartment">
|
||||
AND
|
||||
t1.user_id NOT IN (
|
||||
SELECT
|
||||
st3.user_id
|
||||
FROM
|
||||
sys_department_user st3
|
||||
)
|
||||
</if>
|
||||
<if test="noRole != null and noRole">
|
||||
AND
|
||||
t1.user_id NOT IN (
|
||||
SELECT
|
||||
st4.user_id
|
||||
FROM
|
||||
sys_role_user st4
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -393,6 +393,14 @@
|
||||
user_email LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="userType != null and userType != ''">
|
||||
AND
|
||||
user_type = #{userType}
|
||||
</if>
|
||||
<if test="excludeUserType != null and excludeUserType != ''">
|
||||
AND
|
||||
user_type != #{excludeUserType}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="sort != null and (sort == 'userUsername' or sort == 'userName' or sort == 'userPhone' or sort == 'userEmail' or sort == 'userState' or sort == 'lastLoginAddress' or sort == 'lastLoginTime')">
|
||||
ORDER BY
|
||||
@ -447,6 +455,10 @@
|
||||
AND
|
||||
user_type = #{userType}
|
||||
</if>
|
||||
<if test="excludeUserType != null and excludeUserType != ''">
|
||||
AND
|
||||
user_type != #{excludeUserType}
|
||||
</if>
|
||||
<if test="userState != null">
|
||||
AND
|
||||
user_state = #{userState}
|
||||
|
@ -29,6 +29,14 @@
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item search-item-width-100" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="userType" name="userType" lay-filter="typeFilter">
|
||||
<option value="">选择类型</option>
|
||||
<option value="1">系统用户</option>
|
||||
<option value="2">普通用户</option>
|
||||
<option value="3">公共用户</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
@ -93,6 +101,8 @@
|
||||
return '<span class="layui-badge layui-bg-green">系统用户</span>';
|
||||
} else if(item.userType == 2) {
|
||||
return '<span class="layui-badge layui-bg-orange">普通用户</span>';
|
||||
} else if(item.userType == 3) {
|
||||
return '<span class="layui-badge layui-bg-gray">公共用户</span>';
|
||||
}
|
||||
return '<span class="layui-badge">类型错误</span>';
|
||||
}
|
||||
@ -217,7 +227,8 @@
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
endTime: $('#endTime').val(),
|
||||
userType: $('#userType').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
|
@ -46,8 +46,15 @@
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userType" value="1" title="系统用户">
|
||||
<input type="radio" name="userType" value="2" title="普通用户" checked>
|
||||
<input type="radio" name="userType" value="3" title="公共用户">
|
||||
</div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
<div><b>类型说明</b></div>
|
||||
<div>系统用户:具有后台登录权限且参与后台、APP业务的用户</div>
|
||||
<div>普通用户:具有APP登录权限且参与APP业务的用户</div>
|
||||
<div>公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户</div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">状态 *</label>
|
||||
<div class="layui-input-block">
|
||||
|
@ -46,8 +46,15 @@
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="userType" value="1" title="系统用户">
|
||||
<input type="radio" name="userType" value="2" title="普通用户">
|
||||
<input type="radio" name="userType" value="3" title="公共用户">
|
||||
</div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
<div><b>类型说明</b></div>
|
||||
<div>系统用户:具有后台登录权限且参与后台、APP业务的用户</div>
|
||||
<div>普通用户:具有APP登录权限且参与APP业务的用户</div>
|
||||
<div>公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户</div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">状态 *</label>
|
||||
<div class="layui-input-block">
|
||||
|
Loading…
Reference in New Issue
Block a user