| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.ydtech.modules.protocols.service.impl;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.ydtech.modules.protocols.dao.PtlAgreementDispatchRulesDictMapper;
- import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDict;
- import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
- import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictLabalService;
- import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesDictService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
- /**
- * @Author: tz
- * @description 协议承保规则属性字典 service实现类
- * @createDate 2024-2-22 15:44:29
- * @Entity com.ydtech.modules.protocol.entity.po.PtlAgreementDispatchRulesdictMapper
- */
- @Service
- public class PtlAgreementDispatchRulesDictServiceImpl extends ServiceImpl<PtlAgreementDispatchRulesDictMapper, PtlAgreementDispatchRulesDict>
- implements PtlAgreementDispatchRulesDictService {
- @Autowired
- PtlAgreementDispatchRulesDictLabalService ptlAgreementDispatchRulesDictLabalService;
- /**
- * 获取所有规则字典列表
- * @return
- */
- @Override
- public List<PtlAgreementDispatchRulesDictLabal> getDispatchRulesDictList() {
- List<PtlAgreementDispatchRulesDict> ptlAgreementDispatchRulesDicts = baseMapper.selectList(new QueryWrapper<>(new PtlAgreementDispatchRulesDict()));
- List<PtlAgreementDispatchRulesDictLabal> list = ptlAgreementDispatchRulesDictLabalService.list();
- Map<Integer,List<PtlAgreementDispatchRulesDictLabal>> collect = list.stream().collect(Collectors.groupingBy(PtlAgreementDispatchRulesDictLabal::getParentId));
- list = collect.get(0);
- for(Map.Entry<Integer, List<PtlAgreementDispatchRulesDictLabal>> map : collect.entrySet()){
- Integer key = map.getKey();
- List<PtlAgreementDispatchRulesDictLabal> value = map.getValue();
- list.stream().filter(x -> x.getId() == key).forEach(x -> x.setChildren(value));
- }
- return list;
- }
- }
|