package com.elephant.framework.galaxy.aroad.module.zhjc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.zhjc.entity.ZhjcXmjcGhxm;
import com.elephant.framework.galaxy.aroad.module.zhjc.mapper.ZhjcXmjcGhxmMapper;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcXmjcGhxmService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 规划项目
 *
 * @author zyw
 * @date 2019-04-22 23:22:37
 */
@Service
@AllArgsConstructor
public class ZhjcXmjcGhxmServiceImpl extends ServiceImpl<ZhjcXmjcGhxmMapper, ZhjcXmjcGhxm> implements ZhjcXmjcGhxmService {

    private final ZhjcXmjcGhxmMapper zhjcXmjcGhxmMapper;



    @Override
    public Map<String, List<ZhjcXmjcGhxm>> getList(ZhjcXmjcGhxm zhjcXmjcGhxm) {

        List<ZhjcXmjcGhxm> list =zhjcXmjcGhxmMapper.selectGhxm(zhjcXmjcGhxm);

        Map<String,List<ZhjcXmjcGhxm>> map = new HashMap<>();
        List<ZhjcXmjcGhxm> dzxList = list.stream().filter(a->"大中修项目".equals(a.getXmlx())).collect(Collectors.toList());
        List<ZhjcXmjcGhxm> xgjList = list.stream().filter(a->"新改建项目".equals(a.getXmlx())).collect(Collectors.toList());
        map.put("xgj",xgjList);
        map.put("dzx",dzxList);
        return map;
    }

    @Override
    public Map<String, List<ZhjcXmjcGhxm>> getGCList() {

        List<ZhjcXmjcGhxm> list =zhjcXmjcGhxmMapper.selectGCGhxm();

        Map<String,List<ZhjcXmjcGhxm>> map = new HashMap<>();
        List<ZhjcXmjcGhxm> dzxList = list.stream().filter(a->"大中修项目".equals(a.getXmlx())).collect(Collectors.toList());
        List<ZhjcXmjcGhxm> xgjList = list.stream().filter(a->"新改建项目".equals(a.getXmlx())).collect(Collectors.toList());
        map.put("xgj",xgjList);
        map.put("dzx",dzxList);
        return map;
    }
}
