企业信息统计 根据审核状态统计企业数据

This commit is contained in:
lc 2024-06-20 14:17:38 +08:00
parent 7b662fad1a
commit c1aa400445
3 changed files with 24 additions and 0 deletions

View File

@ -126,4 +126,11 @@ public class EnterpriseInformationController {
Map<String, Long> stringLongMap = enterpriseInformationService.selectEnterpriseByMonth();
return success(stringLongMap);
}
@GetMapping("/statisticByStatus")
@Operation(summary = "根据审核状态统计企业数据")
public CommonResult<Map<Integer,Long>> statisticByStatus(){
Map<Integer, Long> integerLongMap = enterpriseInformationService.statisticByStatus();
return success(integerLongMap);
}
}

View File

@ -100,4 +100,10 @@ public interface EnterpriseInformationService {
* @return
*/
Map<String, Long> selectEnterpriseByMonth();
/**
* 根据审核状态统计企业数据
* @return
*/
Map<Integer,Long> statisticByStatus();
}

View File

@ -308,6 +308,17 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
return monthlyCounts;
}
/**
* 根据审核状态统计企业数据
* @return
*/
@Override
public Map<Integer, Long> statisticByStatus() {
List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList();
Map<Integer, Long> statusCounts = enterpriseInformationDOS.stream().collect(Collectors.groupingBy(EnterpriseInformationDO::getStatus, Collectors.counting()));
return statusCounts;
}
private void validateLeaveExists(Long id) {
if (enterpriseInformationMapper.selectById(id) == null) {
throw exception(ENTERPRISE_INFORMATION_NOT_EXISTS);