Commit c08534be by zhiwj

修改代码

parent 1e1f9191
......@@ -2,6 +2,7 @@ package com.gic.auth.dao.mapper;
import com.gic.auth.dto.AuditedGroupUserRelDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -62,7 +63,8 @@ public interface TabAuditedGroupUserRelMapper {
Integer updateStatusByUserIds(@Param("enterpriseId") Integer enterpriseId, @Param("auditedGroupId") Integer auditedGroupId, @Param("ids") List<Integer> userIdList);
List<Map<Integer,Object>> getUserCountByAuditedGroup(@Param("ids") List<Integer> auditedGroupIds);
@MapKey("auditedGroupId")
Map<Integer, Map<Integer,Long>> getUserCountByAuditedGroup(@Param("ids") List<Integer> auditedGroupIds);
List<TabAuditedGroupUserRel> listAuditedGroup(AuditedGroupUserRelDTO groupUserRel);
......
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -63,7 +64,8 @@ public interface TabAuditorProjectItemRelMapper {
List<TabAuditorProjectItemRel> listRelByAuditorId(TabAuditorProjectItemRel auditorProjectItemRel);
List<Map<String,Object>> getCountByAuditorIds(@Param("ids") List<Integer> auditorIdList);
@MapKey("auditorId")
Map<Integer, Map<Integer,Long>> getCountByAuditorIds(@Param("ids") List<Integer> auditorIdList);
List<Integer> listAuditorIdByProjectId(@Param("enterpriseId") Integer enterpriseId, @Param("projectId") Integer projectId);
}
\ No newline at end of file
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabSysUserResource;
import com.gic.auth.entity.TabSysUserRole;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -58,7 +58,8 @@ public interface TabSysUserResourceMapper {
TabSysUserResource existUserResource(@Param("enterpriseId") Integer enterpriseId, @Param("resourceId") Integer resourceId);
List<Map<String, Object>> countByResourceIds(@Param("enterpriseId") Integer enterpriseId, @Param("ids") List<Integer> resourceIds);
@MapKey("resourceId")
Map<Integer, Map<Integer, Long>> countByResourceIds(@Param("enterpriseId") Integer enterpriseId, @Param("ids") List<Integer> resourceIds);
/**
* 删除用户关联数据
......
......@@ -51,10 +51,11 @@ public class AuditedGroupUserRelServiceImpl implements AuditedGroupUserRelServic
@Override
public Map<Integer, Integer> getUserCountByAuditedGroup(List<Integer> auditedGroupIds) {
List<Map<Integer, Object>> mapList = tabAuditedGroupUserRelMapper.getUserCountByAuditedGroup(auditedGroupIds);
Map<Integer, Map<Integer, Long>> mapList = tabAuditedGroupUserRelMapper.getUserCountByAuditedGroup(auditedGroupIds);
Map<Integer, Integer> resultMap = new HashMap<>(auditedGroupIds.size());
for (Map<Integer, Object> map : mapList) {
resultMap.put(Integer.valueOf(map.get("auditedGroupId").toString()), Integer.valueOf(map.get("userCount").toString()));
for (Map.Entry<Integer, Map<Integer, Long>> entry : mapList.entrySet()) {
Integer auditedGroupId = entry.getKey();
resultMap.put(auditedGroupId, entry.getValue().get("userCount").intValue());
}
return resultMap;
}
......
......@@ -56,10 +56,11 @@ public class AuditorProjectItemRelServiceImpl implements AuditorProjectItemRelSe
@Override
public Map<Integer, Integer> getCountByAuditorIds(List<Integer> auditorIdList) {
List<Map<String, Object>> mapList = tabAuditorProjectItemRelMapper.getCountByAuditorIds(auditorIdList);
Map<Integer, Map<Integer, Long>> mapList = tabAuditorProjectItemRelMapper.getCountByAuditorIds(auditorIdList);
HashMap<Integer, Integer> resultMap = new HashMap<>(mapList.size());
for (Map<String, Object> map : mapList) {
resultMap.put(Integer.valueOf(map.get("auditorId").toString()), Integer.valueOf(map.get("projectItemCount").toString()));
for (Map.Entry<Integer, Map<Integer, Long>> entry : mapList.entrySet()) {
Integer auditorId = entry.getKey();
resultMap.put(auditorId, entry.getValue().get("projectItemCount").intValue());
}
return resultMap;
}
......
package com.gic.auth.service.impl;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.auth.dao.mapper.TabSysUserResourceMapper;
import com.gic.auth.dto.UserResourceDTO;
import com.gic.auth.entity.TabSysUserResource;
import com.gic.auth.service.UserResourceService;
import com.gic.commons.util.EntityUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
*
* @Description:
......@@ -36,9 +35,10 @@ public class UserResourceServiceImpl implements UserResourceService {
if (CollectionUtils.isNotEmpty(resourceIds)) {
//
Map<Integer, Integer> map = new HashMap<>();
List<Map<String, Object>> list = tabSysUserResourceMapper.countByResourceIds(enterpriseId, resourceIds);
for (Map<String, Object> integerIntegerMap : list) {
map.put(Integer.valueOf(integerIntegerMap.get("resourceId").toString()), Integer.valueOf(integerIntegerMap.get("userResourceCount").toString()));
Map<Integer, Map<Integer, Long>> mapMap = tabSysUserResourceMapper.countByResourceIds(enterpriseId, resourceIds);
for (Map.Entry<Integer, Map<Integer, Long>> entry : mapMap.entrySet()) {
Integer resourceId = entry.getKey();
map.put(resourceId, entry.getValue().get("userResourceCount").intValue());
}
return map;
} else {
......
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