增加选择条件,处理问题
This commit is contained in:
parent
7671d3be28
commit
a81d4ad49b
@ -88,6 +88,7 @@ public class CoreManageController extends DefaultBaseController {
|
|||||||
|
|
||||||
@ApiOperation(value = "组织部门用户列表", notes = "组织部门用户列表接口")
|
@ApiOperation(value = "组织部门用户列表", notes = "组织部门用户列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "searchLevel", value = "搜索级别", paramType = "query"),
|
||||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "query"),
|
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "query"),
|
||||||
@ApiImplicitParam(name = "roleId", value = "部门ID", paramType = "query"),
|
@ApiImplicitParam(name = "roleId", value = "部门ID", paramType = "query"),
|
||||||
@ApiImplicitParam(name = "positionId", value = "部门ID", paramType = "query"),
|
@ApiImplicitParam(name = "positionId", value = "部门ID", paramType = "query"),
|
||||||
|
@ -8,6 +8,11 @@ import ink.wgink.interfaces.consts.ISystemConstant;
|
|||||||
import ink.wgink.interfaces.user.mongo.IMongoLoginUserService;
|
import ink.wgink.interfaces.user.mongo.IMongoLoginUserService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||||
|
import ink.wgink.pojo.dtos.group.GroupUserDTO;
|
||||||
|
import ink.wgink.pojo.dtos.position.PositionUserDTO;
|
||||||
|
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||||
|
import ink.wgink.pojo.dtos.role.RoleUserDTO;
|
||||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
import ink.wgink.pojo.pos.DepartmentPO;
|
import ink.wgink.pojo.pos.DepartmentPO;
|
||||||
import ink.wgink.pojo.pos.GroupPO;
|
import ink.wgink.pojo.pos.GroupPO;
|
||||||
@ -112,6 +117,18 @@ public class CoreManageServiceImpl extends DefaultBaseService implements ICoreMa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<UserDTO>> listPageUser(ListPage page) {
|
public SuccessResultList<List<UserDTO>> listPageUser(ListPage page) {
|
||||||
|
Object searchLevelObject = page.getParams().get("searchLevel");
|
||||||
|
String searchLevel = searchLevelObject != null ? searchLevelObject.toString() : null;
|
||||||
|
|
||||||
|
Object departmentIdObject = page.getParams().get("departmentId");
|
||||||
|
String departmentId = departmentIdObject != null ? departmentIdObject.toString() : null;
|
||||||
|
|
||||||
|
if ((!StringUtils.isBlank(searchLevel) && StringUtils.equals("part", searchLevel)) && !StringUtils.isBlank(departmentId)) {
|
||||||
|
DepartmentPO departmentPO = departmentService.getPO(departmentId);
|
||||||
|
page.getParams().remove("departmentId");
|
||||||
|
page.getParams().put("departmentCodeLike", departmentPO.getDepartmentCode());
|
||||||
|
}
|
||||||
|
|
||||||
PageHelper.startPage(page.getPage(), page.getRows());
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
List<UserDTO> userDTOs = listUser(page.getParams());
|
List<UserDTO> userDTOs = listUser(page.getParams());
|
||||||
PageInfo<UserDTO> pageInfo = new PageInfo<>(userDTOs);
|
PageInfo<UserDTO> pageInfo = new PageInfo<>(userDTOs);
|
||||||
@ -124,43 +141,44 @@ public class CoreManageServiceImpl extends DefaultBaseService implements ICoreMa
|
|||||||
if (userIds.isEmpty()) {
|
if (userIds.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DepartmentPO> departmentPOS = departmentUserService.listDepartmentPOByUserIds(userIds);
|
List<DepartmentUserDTO> departmentUserDTOS = departmentUserService.listByUserIds(userIds);
|
||||||
List<RolePO> rolePOS = roleUserService.listRolePOByUserIds(userIds);
|
List<RoleUserDTO> roleUserDTOS = roleUserService.listByUserIds(userIds);
|
||||||
List<PositionPO> positionPOS = positionUserService.listPositionPOByUserIds(userIds);
|
List<PositionUserDTO> positionUserDTOS = positionUserService.listByUserIds(userIds);
|
||||||
List<GroupPO> groupPOS = groupUserService.listGroupPOByUserIds(userIds);
|
List<GroupUserDTO> groupUserDTOS = groupUserService.listByUserIds(userIds);
|
||||||
userDTOS.forEach(userDTO -> {
|
userDTOS.forEach(userDTO -> {
|
||||||
|
// 组织机构
|
||||||
List<String> departmentIds = new ArrayList<>();
|
List<String> departmentIds = new ArrayList<>();
|
||||||
List<String> departmentNames = new ArrayList<>();
|
List<String> departmentNames = new ArrayList<>();
|
||||||
departmentPOS.forEach(departmentPO -> {
|
departmentUserDTOS.stream().filter(departmentUserDTO -> StringUtils.equals(userDTO.getUserId(), departmentUserDTO.getUserId())).forEach(departmentUserDTO -> {
|
||||||
departmentIds.add(departmentPO.getDepartmentId());
|
departmentIds.add(departmentUserDTO.getDepartmentId());
|
||||||
departmentNames.add(departmentPO.getDepartmentName());
|
departmentNames.add(departmentUserDTO.getDepartmentName());
|
||||||
});
|
});
|
||||||
userDTO.setDepartmentIds(StringUtils.join(departmentIds, ","));
|
userDTO.setDepartmentIds(StringUtils.join(departmentIds, ","));
|
||||||
userDTO.setDepartmentNames(StringUtils.join(departmentNames, ","));
|
userDTO.setDepartmentNames(StringUtils.join(departmentNames, ","));
|
||||||
|
// 角色
|
||||||
List<String> roleIds = new ArrayList<>();
|
List<String> roleIds = new ArrayList<>();
|
||||||
List<String> roleNames = new ArrayList<>();
|
List<String> roleNames = new ArrayList<>();
|
||||||
rolePOS.forEach(rolePO -> {
|
roleUserDTOS.stream().filter(roleUserDTO -> StringUtils.equals(userDTO.getUserId(), roleUserDTO.getUserId())).forEach(roleUserDTO -> {
|
||||||
roleIds.add(rolePO.getRoleId());
|
roleIds.add(roleUserDTO.getRoleId());
|
||||||
roleNames.add(rolePO.getRoleName());
|
roleNames.add(roleUserDTO.getRoleName());
|
||||||
});
|
});
|
||||||
userDTO.setRoleIds(StringUtils.join(roleIds, ","));
|
userDTO.setRoleIds(StringUtils.join(roleIds, ","));
|
||||||
userDTO.setRoleNames(StringUtils.join(roleNames, ","));
|
userDTO.setRoleNames(StringUtils.join(roleNames, ","));
|
||||||
|
// 职位
|
||||||
List<String> positionIds = new ArrayList<>();
|
List<String> positionIds = new ArrayList<>();
|
||||||
List<String> positionNames = new ArrayList<>();
|
List<String> positionNames = new ArrayList<>();
|
||||||
positionPOS.forEach(positionPO -> {
|
positionUserDTOS.stream().filter(positionUserDTO -> StringUtils.equals(userDTO.getUserId(), positionUserDTO.getUserId())).forEach(positionUserDTO -> {
|
||||||
positionIds.add(positionPO.getPositionId());
|
positionIds.add(positionUserDTO.getPositionId());
|
||||||
positionNames.add(positionPO.getPositionName());
|
positionNames.add(positionUserDTO.getPositionName());
|
||||||
});
|
});
|
||||||
userDTO.setPositionIds(StringUtils.join(positionIds, ","));
|
userDTO.setPositionIds(StringUtils.join(positionIds, ","));
|
||||||
userDTO.setPositionNames(StringUtils.join(positionNames, ","));
|
userDTO.setPositionNames(StringUtils.join(positionNames, ","));
|
||||||
|
// 组
|
||||||
List<String> groupIds = new ArrayList<>();
|
List<String> groupIds = new ArrayList<>();
|
||||||
List<String> groupNames = new ArrayList<>();
|
List<String> groupNames = new ArrayList<>();
|
||||||
groupPOS.forEach(groupPO -> {
|
groupUserDTOS.stream().filter(groupUserDTO -> StringUtils.equals(userDTO.getUserId(), groupUserDTO.getUserId())).forEach(groupUserDTO -> {
|
||||||
groupIds.add(groupPO.getGroupId());
|
groupIds.add(groupUserDTO.getGroupId());
|
||||||
groupNames.add(groupPO.getGroupName());
|
groupNames.add(groupUserDTO.getGroupName());
|
||||||
});
|
});
|
||||||
userDTO.setGroupIds(StringUtils.join(groupIds, ","));
|
userDTO.setGroupIds(StringUtils.join(groupIds, ","));
|
||||||
userDTO.setGroupNames(StringUtils.join(groupNames, ","));
|
userDTO.setGroupNames(StringUtils.join(groupNames, ","));
|
||||||
|
@ -59,6 +59,23 @@
|
|||||||
t1.user_id NOT IN (SELECT st1.user_id FROM sys_department_user st1)
|
t1.user_id NOT IN (SELECT st1.user_id FROM sys_department_user st1)
|
||||||
</if>
|
</if>
|
||||||
<!-- 组织部门用户 -->
|
<!-- 组织部门用户 -->
|
||||||
|
<if test="departmentCodeLike != null and departmentCodeLike != ''">
|
||||||
|
AND
|
||||||
|
t1.user_id IN (
|
||||||
|
SELECT
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
sys_department_user st1
|
||||||
|
INNER JOIN
|
||||||
|
sys_department st11
|
||||||
|
ON
|
||||||
|
st1.department_id = st11.department_id
|
||||||
|
WHERE
|
||||||
|
st11.is_delete = 0
|
||||||
|
AND
|
||||||
|
st11.department_code LIKE CONCAT(#{departmentCodeLike}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="departmentId != null and departmentId != ''">
|
<if test="departmentId != null and departmentId != ''">
|
||||||
AND
|
AND
|
||||||
t1.user_id IN (
|
t1.user_id IN (
|
||||||
@ -66,7 +83,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_department_user st1
|
sys_department_user st1
|
||||||
|
INNER JOIN
|
||||||
|
sys_department st11
|
||||||
|
ON
|
||||||
|
st11.department_id = st11.department_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st11.is_delete = 0
|
||||||
|
AND
|
||||||
st1.department_id = #{departmentId}
|
st1.department_id = #{departmentId}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
@ -77,7 +100,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_department_user st1
|
sys_department_user st1
|
||||||
|
INNER JOIN
|
||||||
|
sys_department st11
|
||||||
|
ON
|
||||||
|
st1.department_id = st11.department_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st11.is_delete = 0
|
||||||
|
AND
|
||||||
st1.department_id IN
|
st1.department_id IN
|
||||||
<foreach collection="departmentIds" index="index" open="(" separator="," close=")">
|
<foreach collection="departmentIds" index="index" open="(" separator="," close=")">
|
||||||
#{departmentIds[${index}]}
|
#{departmentIds[${index}]}
|
||||||
@ -121,7 +150,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_role_user st2
|
sys_role_user st2
|
||||||
|
INNER JOIN
|
||||||
|
sys_role st21
|
||||||
|
ON
|
||||||
|
st2.role_id = st21.role_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st21.is_delete = 0
|
||||||
|
AND
|
||||||
st2.role_id = #{roleId}
|
st2.role_id = #{roleId}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
@ -132,7 +167,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_role_user st2
|
sys_role_user st2
|
||||||
|
INNER JOIN
|
||||||
|
sys_role st21
|
||||||
|
ON
|
||||||
|
st2.role_id = st21.role_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st21.is_delete = 0
|
||||||
|
AND
|
||||||
st2.role_id IN
|
st2.role_id IN
|
||||||
<foreach collection="roleIds" index="index" open="(" separator="," close=")">
|
<foreach collection="roleIds" index="index" open="(" separator="," close=")">
|
||||||
#{roleIds[${index}]}
|
#{roleIds[${index}]}
|
||||||
@ -151,7 +192,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_position_user st3
|
sys_position_user st3
|
||||||
|
INNER JOIN
|
||||||
|
sys_position st31
|
||||||
|
ON
|
||||||
|
st3.position_id = st31.position_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st31.is_delete = 0
|
||||||
|
AND
|
||||||
st3.position_id = #{positionId}
|
st3.position_id = #{positionId}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
@ -162,7 +209,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_position_user st3
|
sys_position_user st3
|
||||||
|
INNER JOIN
|
||||||
|
sys_position st31
|
||||||
|
ON
|
||||||
|
st3.position_id = st31.position_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st31.is_delete = 0
|
||||||
|
AND
|
||||||
st3.position_id IN
|
st3.position_id IN
|
||||||
<foreach collection="positionIds" index="index" open="(" separator="," close=")">
|
<foreach collection="positionIds" index="index" open="(" separator="," close=")">
|
||||||
#{positionIds[${index}]}
|
#{positionIds[${index}]}
|
||||||
@ -181,6 +234,12 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_group_user st4
|
sys_group_user st4
|
||||||
|
INNER JOIN
|
||||||
|
sys_group st41
|
||||||
|
ON
|
||||||
|
st4.group_id = st41.group_id
|
||||||
|
WHERE
|
||||||
|
st41.is_delete = 0
|
||||||
WHERE
|
WHERE
|
||||||
st4.group_id = #{groupId}
|
st4.group_id = #{groupId}
|
||||||
)
|
)
|
||||||
@ -192,7 +251,13 @@
|
|||||||
user_id
|
user_id
|
||||||
FROM
|
FROM
|
||||||
sys_group_user st4
|
sys_group_user st4
|
||||||
|
INNER JOIN
|
||||||
|
sys_group st41
|
||||||
|
ON
|
||||||
|
st4.group_id = st41.group_id
|
||||||
WHERE
|
WHERE
|
||||||
|
st41.is_delete = 0
|
||||||
|
AND
|
||||||
st4.group_id IN
|
st4.group_id IN
|
||||||
<foreach collection="groupIds" index="index" open="(" separator="," close=")">
|
<foreach collection="groupIds" index="index" open="(" separator="," close=")">
|
||||||
#{groupIds[${index}]}
|
#{groupIds[${index}]}
|
||||||
|
@ -50,7 +50,6 @@ function initMultiSelectInputTree($, treeselect) {
|
|||||||
url: 'url'
|
url: 'url'
|
||||||
},
|
},
|
||||||
onInitSelectedDataFilter: function(selectedData) {
|
onInitSelectedDataFilter: function(selectedData) {
|
||||||
console.log(selectedData);
|
|
||||||
$.each(selectedData, function(i, item) {
|
$.each(selectedData, function(i, item) {
|
||||||
item.id = item.departmentId;
|
item.id = item.departmentId;
|
||||||
item.name = item.departmentName;
|
item.name = item.departmentName;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<div class="layui-inline layui-form search-item">
|
<div class="layui-inline layui-form search-item">
|
||||||
<select id="searchLevel" name="searchLevel" lay-filter="searchLevelFilter">
|
<select id="searchLevel" name="searchLevel" lay-filter="searchLevelFilter">
|
||||||
<option value="this">本级</option>
|
<option value="this">本级</option>
|
||||||
|
<option value="part">局部</option>
|
||||||
<option value="global">全局</option>
|
<option value="global">全局</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -330,6 +331,7 @@
|
|||||||
endTime: $('#endTime').val(),
|
endTime: $('#endTime').val(),
|
||||||
userType: $('#userType').val(),
|
userType: $('#userType').val(),
|
||||||
userState: $('#userState').val(),
|
userState: $('#userState').val(),
|
||||||
|
searchLevel: $('#searchLevel').val(),
|
||||||
noDepartment: noDepartment ? 1 : 0,
|
noDepartment: noDepartment ? 1 : 0,
|
||||||
noRole: noRole ? 1 : 0,
|
noRole: noRole ? 1 : 0,
|
||||||
roleId: noRole ? '' : $('#roleId').val(),
|
roleId: noRole ? '' : $('#roleId').val(),
|
||||||
@ -622,7 +624,7 @@
|
|||||||
|
|
||||||
$('#noDepartmentContainer').hide();
|
$('#noDepartmentContainer').hide();
|
||||||
form.on('select(searchLevelFilter)', function(data) {
|
form.on('select(searchLevelFilter)', function(data) {
|
||||||
if(data.value === 'this') {
|
if(data.value === 'this' || data.value === 'part') {
|
||||||
$('#noDepartmentContainer').hide();
|
$('#noDepartmentContainer').hide();
|
||||||
$('input[name="noDepartment"]').prop('checked', false);
|
$('input[name="noDepartment"]').prop('checked', false);
|
||||||
noDepartment = false;
|
noDepartment = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user