Просмотр исходного кода

解决工作台物联设备数量展示不正确问题

tags/V1.3.3^2
wanjing 11 месяцев назад
Родитель
Сommit
5c57d446b1
2 измененных файлов: 1 добавлений и 39 удалений
  1. +1
    -38
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/iotequipment/query/QueryEditIotEquipmentListService.java
  2. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/IotEquipmentMapper.xml

+ 1
- 38
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/iotequipment/query/QueryEditIotEquipmentListService.java Просмотреть файл

@@ -44,10 +44,6 @@ public class QueryEditIotEquipmentListService {

private final IotEquipmentMapper iotEquipmentMapper;

private final RoadInformationMapper roadInformationMapper;

private final SectionMapper sectionMapper;

public JsonResult getList(QueryIotEquipmentListRequest request) {
User user = CurrentUserUtil.getUserInfo();
JsonResult result = this.check(request);
@@ -55,15 +51,12 @@ public class QueryEditIotEquipmentListService {
log.info("查询物联设备列表:校验失败:{}", result.getMsg());
return result;
}

// 获取部门Id的查询范围
List<String> deptIdList = this.getDeptIdList(user);
request.setDeptIdList(deptIdList);
request.setTenantId(user.getTenantId());
List<IotEquipment> iotEquipmentList = iotEquipmentMapper.selectList(request);

List<IotEquipmentVo> iotEquipmentVoList = this.buildIotEquipmentVoList(iotEquipmentList);

return JsonResult.success(iotEquipmentVoList);
}

@@ -104,34 +97,4 @@ public class QueryEditIotEquipmentListService {
List<IotEquipmentVo> iotEquipmentVoList = IotEquipmentConverMapper.INSTANCE.fromIotEquipmentToIotEquipmentVoList(iotEquipmentList);
return iotEquipmentVoList;
}

/**
* 获取公路列表,放到map,减少循环次数
*
* @param iotEquipmentList
* @return
*/
private Map<String, RoadInformation> getRoadInformationMap(List<IotEquipment> iotEquipmentList) {
List<String> roadInformationIdList = iotEquipmentList.stream().map(o -> o.getRoadId()).collect(Collectors.toList());
List<RoadInformation> roadInformationList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>()
.in(RoadInformation::getId, roadInformationIdList)
.eq(RoadInformation::getMark, MarkEnum.VALID.getCode()));
Map<String, RoadInformation> roadInformationMap = roadInformationList.stream().collect(Collectors.toMap(RoadInformation::getId, Function.identity()));
return roadInformationMap;
}

/**
* 获取路段列表,放到map,减少循环次数
*
* @param iotEquipmentList
* @return
*/
private Map<String, Section> getSectionMap(List<IotEquipment> iotEquipmentList) {
List<String> sectionIdList = iotEquipmentList.stream().map(o -> o.getRoadId()).collect(Collectors.toList());
List<Section> roadInformationList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()
.in(Section::getId, sectionIdList)
.eq(Section::getMark, MarkEnum.VALID.getCode()));
Map<String, Section> sectionMap = roadInformationList.stream().collect(Collectors.toMap(Section::getId, Function.identity()));
return sectionMap;
}
}

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/resources/mapper/IotEquipmentMapper.xml Просмотреть файл

@@ -40,7 +40,6 @@
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<!-- <if test="request.sectionName != null and request.sectionName != ''"> and section_name = #{request.sectionName} </if>-->
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">

Загрузка…
Отмена
Сохранить