|
@ -1,10 +1,19 @@ |
|
|
package com.kms.enterprise.service; |
|
|
package com.kms.enterprise.service; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
import com.kms.enterprise.domain.BsSgcYxjdEnterpriseInfo; |
|
|
|
|
|
import com.kms.enterprise.mapper.BsSgcYxjdEnterpriseInfoMapper; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.jianwei.common.core.service.BaseService; |
|
|
import com.jianwei.common.core.service.BaseService; |
|
|
import com.kms.enterprise.mapper.BsSgcYxjdQualificationsMapper; |
|
|
import com.kms.enterprise.mapper.BsSgcYxjdQualificationsMapper; |
|
|
import com.kms.enterprise.domain.BsSgcYxjdQualifications; |
|
|
import com.kms.enterprise.domain.BsSgcYxjdQualifications; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 企业资质Service接口 |
|
|
* 企业资质Service接口 |
|
|
* |
|
|
* |
|
@ -14,4 +23,51 @@ import com.kms.enterprise.domain.BsSgcYxjdQualifications; |
|
|
@Service |
|
|
@Service |
|
|
public class BsSgcYxjdQualificationsService extends BaseService<BsSgcYxjdQualificationsMapper, BsSgcYxjdQualifications>{ |
|
|
public class BsSgcYxjdQualificationsService extends BaseService<BsSgcYxjdQualificationsMapper, BsSgcYxjdQualifications>{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private BsSgcYxjdQualificationsMapper qualificationsMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private BsSgcYxjdEnterpriseInfoMapper enterpriseInfoMapper; |
|
|
|
|
|
|
|
|
|
|
|
public List<BsSgcYxjdQualifications> listByEid(String eid) { |
|
|
|
|
|
//构造条件
|
|
|
|
|
|
LambdaQueryWrapper<BsSgcYxjdQualifications> queryWrapper = Wrappers.lambdaQuery(BsSgcYxjdQualifications.class); |
|
|
|
|
|
queryWrapper.eq(BsSgcYxjdQualifications::getEnterpriseId, eid); |
|
|
|
|
|
//查询全部同企业信息
|
|
|
|
|
|
List<BsSgcYxjdQualifications> list = qualificationsMapper |
|
|
|
|
|
.selectList(queryWrapper); |
|
|
|
|
|
//获取parentid为null的集合
|
|
|
|
|
|
List<BsSgcYxjdQualifications> master = list.stream().filter(e -> e.getParentId() == null).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
//遍历获取子资质
|
|
|
|
|
|
for (BsSgcYxjdQualifications bsSgcYxjdQualifications : master) { |
|
|
|
|
|
List<BsSgcYxjdQualifications> children = list.stream().filter(e -> e.getParentId() != null && e.getParentId().equals(bsSgcYxjdQualifications.getId())) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
//设置子资质数量
|
|
|
|
|
|
bsSgcYxjdQualifications.setNumber(children.size()); |
|
|
|
|
|
|
|
|
|
|
|
bsSgcYxjdQualifications.setChildren(children); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return master; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<BsSgcYxjdQualifications> getParent(String eid) { |
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<BsSgcYxjdQualifications> queryWrapper = Wrappers.lambdaQuery(BsSgcYxjdQualifications.class); |
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.eq(BsSgcYxjdQualifications::getEnterpriseId, eid); |
|
|
|
|
|
queryWrapper.isNull(BsSgcYxjdQualifications::getParentId); |
|
|
|
|
|
|
|
|
|
|
|
List<BsSgcYxjdQualifications> list = qualificationsMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|