Commit df346608 by 邹磊浩

修改代码

parent 21a505c3
...@@ -35,6 +35,8 @@ public class ServicesVo { ...@@ -35,6 +35,8 @@ public class ServicesVo {
* 城市id * 城市id
*/ */
private Integer cityId; private Integer cityId;
private String cityName;
/** /**
* 所属业务 * 所属业务
*/ */
......
...@@ -11,7 +11,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -11,7 +11,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pz.common.utils.JsonUtils; import com.pz.common.utils.JsonUtils;
import com.pz.system.domain.Hospital; import com.pz.system.domain.Hospital;
import com.pz.system.domain.Services; import com.pz.system.domain.Services;
import com.pz.system.domain.vo.CityVo;
import com.pz.system.domain.vo.HospitalVo; import com.pz.system.domain.vo.HospitalVo;
import com.pz.system.domain.vo.ServicesVo;
import com.pz.system.mapper.CityMapper;
import com.pz.system.mapper.HospitalMapper; import com.pz.system.mapper.HospitalMapper;
import com.pz.system.mapper.ServicesMapper; import com.pz.system.mapper.ServicesMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -44,6 +47,8 @@ public class BusinessServiceImpl implements IBusinessService { ...@@ -44,6 +47,8 @@ public class BusinessServiceImpl implements IBusinessService {
private final ServicesMapper servicesMapper; private final ServicesMapper servicesMapper;
private final CityMapper cityMapper;
/** /**
* 查询业务 * 查询业务
*/ */
...@@ -64,25 +69,36 @@ public class BusinessServiceImpl implements IBusinessService { ...@@ -64,25 +69,36 @@ public class BusinessServiceImpl implements IBusinessService {
public TableDataInfo<BusinessVo> queryPageList(BusinessBo bo, PageQuery pageQuery) { public TableDataInfo<BusinessVo> queryPageList(BusinessBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<Business> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<Business> lqw = buildQueryWrapper(bo);
Page<BusinessVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<BusinessVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Optional.ofNullable(result.getRecords()).ifPresent(businessVos -> { if (result.getRecords() != null) {
businessVos.forEach(businessVo -> { List<BusinessVo> businessVos = result.getRecords();
for (BusinessVo businessVo : businessVos) {
if (StringUtils.isNotBlank(businessVo.getHospitals())) { if (StringUtils.isNotBlank(businessVo.getHospitals())) {
//获取绑定所以医院id // 获取绑定的所有医院id
List<Long> ids = JsonUtils.parseArray(businessVo.getHospitals(), Long.class); List<Long> ids = JsonUtils.parseArray(businessVo.getHospitals(), Long.class);
Optional.ofNullable(hospitalMapper.selectVoList(Wrappers.<Hospital>lambdaQuery().in(Hospital::getId, ids))) if (!ids.isEmpty()) {
.ifPresent(hospitalVos -> { List<HospitalVo> hospitalVos = hospitalMapper.selectVoList(Wrappers.<Hospital>lambdaQuery()
businessVo.setHospitalsList(hospitalVos.stream().map(HospitalVo::getName).collect(Collectors.toList())); .in(Hospital::getId, ids));
}); businessVo.setHospitalsList(hospitalVos.stream()
.map(HospitalVo::getName)
.collect(Collectors.toList()));
}
}
// 获取关联服务
List<ServicesVo> servicesVos = servicesMapper.selectVoList(Wrappers.<Services>lambdaQuery()
.eq(Services::getBid, businessVo.getId()));
for (ServicesVo servicesVo : servicesVos) {
CityVo cityVo = cityMapper.selectVoById(servicesVo.getCityId());
if (cityVo != null) {
servicesVo.setCityName(cityVo.getName());
}
} }
//获取关联服务
Optional.ofNullable(servicesMapper.selectVoList(Wrappers.<Services>lambdaQuery().eq(Services::getBid, businessVo.getId())))
.ifPresent(servicesVos -> {
businessVo.setServicesVoList(servicesVos); businessVo.setServicesVoList(servicesVos);
}); }
}); }
});
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
/** /**
......
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