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