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.ZhjcXmjcZtxmDdjgl;
import com.elephant.framework.galaxy.aroad.module.zhjc.entity.ZhjcXmjcZtxmDtl;
import com.elephant.framework.galaxy.aroad.module.zhjc.mapper.ZhjcXmjcZtxmDdjglMapper;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcXmjcZtxmDdjglService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

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

/**
 * 项目专题低等级公路
 *
 * @author zyw
 * @date 2019-04-28 11:03:58
 */
@Service
@AllArgsConstructor
public class ZhjcXmjcZtxmDdjglServiceImpl extends ServiceImpl<ZhjcXmjcZtxmDdjglMapper, ZhjcXmjcZtxmDdjgl> implements ZhjcXmjcZtxmDdjglService {

    private final ZhjcXmjcZtxmDdjglMapper zhjcXmjcZtxmDdjglMapper;

    @Override
    public Map<String,Object> getList(ZhjcXmjcZtxmDdjgl ddjgl) {

        List<ZhjcXmjcZtxmDdjgl> list = zhjcXmjcZtxmDdjglMapper.getList(ddjgl);
        Double total_lc = list.stream().mapToDouble(ZhjcXmjcZtxmDdjgl::getLc).sum();
        Map<String,Object> map = new HashMap<>();
        map.put("dataList",list);
        map.put("totalLc",total_lc);
        return map;
    }
}
