getCompanyCount

This commit is contained in:
sxu 2024-12-17 11:11:39 +08:00
parent 25e213e9d8
commit cc906040ba
3 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -58,6 +59,13 @@ public class DevInfoController extends BaseController {
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} }
@ApiOperation(value = "统计公司上架数")
@PostMapping("/getCompanyCount")
public AjaxResult getCompanyCount(@RequestBody DevInfoVo devInfo) {
Map<String, Long> map = devInfoService.getCompanyCount(devInfo);
return AjaxResult.success(map);
}
/** /**
* 获取公司列表(供装备新增及首页所属公司筛选使用) * 获取公司列表(供装备新增及首页所属公司筛选使用)
* @param obj * @param obj

View File

@ -35,6 +35,8 @@ public interface DevInfoService {
*/ */
List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo); List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo);
Map<String, Long> getCompanyCount(DevInfoVo devInfo);
List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo); List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo);
AjaxResult selectDevInfoHotList(DevInfoVo devInfo); AjaxResult selectDevInfoHotList(DevInfoVo devInfo);

View File

@ -171,6 +171,13 @@ public class DevInfoServiceImpl implements DevInfoService {
return voList; return voList;
} }
@Override
public Map<String, Long> getCompanyCount(DevInfoVo devInfo) {
List<DevInfoVo> voList = devInfoMapper.selectDevInfoList(devInfo);
Map<String, Long> map = voList.stream().collect(Collectors.groupingBy(DevInfoVo::getCompanyId, Collectors.counting()));
return map;
}
/** /**
* 查询设备收藏列表 * 查询设备收藏列表
* *