Commit 345c76fe by guojuxing

协作人分页查询修改:分组过滤条件添加

parent 36eb1e43
......@@ -4,6 +4,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.gic.auth.constant.AccountGroupMemberTypeEnum;
import com.gic.auth.entity.TabSysAccountGroupRel;
import com.gic.auth.service.AccountGroupRelService;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.service.EnterpriseApiService;
import org.apache.commons.collections.CollectionUtils;
......@@ -45,6 +48,8 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
private CollaboratorRoleRelService collaboratorRoleRelService;
@Autowired
private EnterpriseApiService enterpriseApiService;
@Autowired
private AccountGroupRelService accountGroupRelService;
@Override
public ServiceResponse<Integer> save(CollaboratorDTO dto) {
......@@ -60,6 +65,23 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
@Override
public ServiceResponse<Page<CollaboratorListDTO>> page(CollaboratorListQO params) {
if (params.getAccountGroupId() != null) {
//查询分组下的管理员列表
List<TabSysAccountGroupRel> list = accountGroupRelService.listByAccountGroupId(params.getAccountGroupId(),
AccountGroupMemberTypeEnum.COLLABORATOR.getCode());
if (CollectionUtils.isNotEmpty(list)) {
List<Integer> userIdList = new ArrayList<>(list.size());
for (TabSysAccountGroupRel temp : list) {
userIdList.add(temp.getUserId());
}
params.setCollaboratorIdList(userIdList);
}
//如果是空的,则返回空
if (CollectionUtils.isEmpty(params.getCollaboratorIdList())) {
return ServiceResponse.success(new Page<>());
}
}
com.github.pagehelper.Page<CollaboratorListDTO> page = collaboratorService.page(params);
Page<CollaboratorListDTO> resultPage = PageHelperUtils.changePageHelperToCurrentPage(page);
return ServiceResponse.success(resultPage);
......@@ -128,7 +150,8 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
}
result.setSubAppIdList(subAppList);
}
ServiceResponse<EnterpriseDTO> enterpriseResult = enterpriseApiService.getEnterpriseById(record.getCollaborationEnterpriseId());
ServiceResponse<EnterpriseDTO> enterpriseResult = enterpriseApiService
.getEnterpriseById(record.getCollaborationEnterpriseId());
if (enterpriseResult.isSuccess()) {
result.setCollaborationEnterpriseName(enterpriseResult.getResult().getEnterpriseName());
}
......
......@@ -193,8 +193,7 @@ public class UserApiServiceImpl implements UserApiService {
@Override
public ServiceResponse<Void> editAdmin(UserDTO userDTO) {
//超级官员
TabSysUser adminUser = userService
.getUserByEnterpriseId(userDTO.getEnterpriseId());
TabSysUser adminUser = userService.getUserByEnterpriseId(userDTO.getEnterpriseId());
if (adminUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "超级管理员不存在,操作有误");
}
......@@ -245,7 +244,8 @@ public class UserApiServiceImpl implements UserApiService {
result.setUserResourceIds(userResourceResult.substring(0, userResourceResult.length() - 1));
}
//账号分组
List<TabSysAccountGroupRel> tabSysAccountGroupRelList = accountGroupRelService.listByUserId(userId, AccountGroupMemberTypeEnum.ADMIN.getCode());
List<TabSysAccountGroupRel> tabSysAccountGroupRelList = accountGroupRelService.listByUserId(userId,
AccountGroupMemberTypeEnum.ADMIN.getCode());
StringBuilder accountGroupIdStr = new StringBuilder();
if (CollectionUtils.isNotEmpty(tabSysAccountGroupRelList)) {
for (TabSysAccountGroupRel accountGroupRel : tabSysAccountGroupRelList) {
......@@ -321,7 +321,8 @@ public class UserApiServiceImpl implements UserApiService {
public ServiceResponse<Page<UserListDTO>> pageUser(UserListQO params) {
if (params.getAccountGroupId() != null) {
//查询分组下的管理员列表
List<TabSysAccountGroupRel> list = accountGroupRelService.listByAccountGroupId(params.getAccountGroupId());
List<TabSysAccountGroupRel> list = accountGroupRelService.listByAccountGroupId(params.getAccountGroupId(),
AccountGroupMemberTypeEnum.ADMIN.getCode());
if (CollectionUtils.isNotEmpty(list)) {
List<Integer> userIdList = new ArrayList<>(list.size());
for (TabSysAccountGroupRel temp : list) {
......
......@@ -201,6 +201,12 @@
<if test="status != null">
and a.status = #{status}
</if>
<if test="collaboratorIdList != null and collaboratorIdList.size() > 0">
and a.collaborator_id in
<foreach collection="collaboratorIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="listByCollaboratorIdList" resultMap="BaseResultMap">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment