This commit is contained in:
xiaofajia 2024-12-17 13:52:13 +08:00
parent 68512f2e92
commit 8f92fd463f
3 changed files with 52 additions and 0 deletions

View File

@ -5,9 +5,16 @@ import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.InspectionRoleCommon; import cn.iocoder.yudao.common.InspectionRoleCommon;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo;
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
import cn.iocoder.yudao.module.inspection.service.IInspectionEquInfoService;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -15,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -36,6 +45,12 @@ public class InspectionUtilController {
@Resource @Resource
private RoleApi roleApi; private RoleApi roleApi;
@Resource
private IInspectionEquInfoService equInfoService;
@Resource
private IInspectionFileService fileService;
/** /**
* 根据用户取出当前用户的角色只针对检测 * 根据用户取出当前用户的角色只针对检测
* *
@ -71,4 +86,17 @@ public class InspectionUtilController {
} }
return success(name); return success(name);
} }
@GetMapping("/getTypeCount")
public CommonResult<?> getTypeCount(@RequestParam("partnerId")Long partnerId){
Map<String, Long> map = new HashMap<>();
Long staffCount = roleApi.selectListByRoleId();
map.put("staff", staffCount);
Page<InspectionEquInfo> page = new Page<>(1, 1000);
IPage<InspectionEquInfo> equs = equInfoService.selectInspectionEquInfoList(page, new InspectionEquInfo());
map.put("equ", equs.getTotal());
long fileCount = fileService.count(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getType, "2"));
map.put("file", fileCount);
return success(map);
}
} }

View File

@ -40,4 +40,11 @@ public interface RoleApi {
**/ **/
List<UserDTO> selectUserListByRoleCode(Long tenantId,String code); List<UserDTO> selectUserListByRoleCode(Long tenantId,String code);
/**
* 通过角色id查询角色
*
* @author 小李
* @date 13:21 2024/12/17
**/
Long selectListByRoleId();
} }

View File

@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.system.api.permission;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.permission.RoleService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -64,4 +66,19 @@ public class RoleApiImpl implements RoleApi {
public List<UserDTO> selectUserListByRoleCode(Long tenantId,String code) { public List<UserDTO> selectUserListByRoleCode(Long tenantId,String code) {
return roleService.selectByRoleCode(tenantId,code); return roleService.selectByRoleCode(tenantId,code);
} }
/**
* 通过角色id查询角色
*
* @author 小李
* @date 13:21 2024/12/17
**/
@Override
public Long selectListByRoleId(){
RolePageReqVO rolePageReqVO = new RolePageReqVO();
rolePageReqVO.setPageNo(1);
rolePageReqVO.setPageSize(1000);
IPage<UserDTO> userDTOIPage = roleService.selectListByRoleId(rolePageReqVO);
return userDTOIPage.getTotal();
}
} }