46 lines
1.6 KiB
Java
46 lines
1.6 KiB
Java
package com.gunshi.project.xyt.service;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.gunshi.project.xyt.entity.vo.ProfilePressTreeVo;
|
|
import com.gunshi.project.xyt.mapper.AttDamProfileMapper;
|
|
import com.gunshi.project.xyt.model.AttDamProfile;
|
|
import com.gunshi.project.xyt.model.OsmoticPressDevice;
|
|
import com.gunshi.project.xyt.model.OsmoticPressDeviceAutoDao;
|
|
import com.gunshi.project.xyt.util.MyBeanUtil;
|
|
import jakarta.annotation.Resource;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 描述: 监测断面信息表
|
|
* author: xusan
|
|
* date: 2024-07-08 17:30:37
|
|
*/
|
|
@Service
|
|
@Slf4j
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public class AttDamProfileService extends ServiceImpl<AttDamProfileMapper, AttDamProfile>
|
|
{
|
|
@Resource
|
|
private OsmoticPressDeviceAutoDao pressDeviceAutoDao;
|
|
|
|
public List<ProfilePressTreeVo> tree() {
|
|
List<AttDamProfile> list = this.list();
|
|
List<ProfilePressTreeVo> res = MyBeanUtil.collectionCopy(list,ProfilePressTreeVo.class);
|
|
for(ProfilePressTreeVo vo : res){
|
|
List<OsmoticPressDevice> pressList = pressDeviceAutoDao.list(new QueryWrapper<OsmoticPressDevice>().eq("profile_code", vo.getProfileCode()));
|
|
vo.setChildren(pressList.stream().map(OsmoticPressDevice::getStationCode).sorted().collect(Collectors.toList()));
|
|
}
|
|
return res;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|