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.ZhjcXmjcZtxmDtl;
import com.elephant.framework.galaxy.aroad.module.zhjc.mapper.ZhjcXmjcZtxmDtlMapper;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcXmjcZtxmDtlService;
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:01:53
 */
@Service
@AllArgsConstructor
public class ZhjcXmjcZtxmDtlServiceImpl extends ServiceImpl<ZhjcXmjcZtxmDtlMapper, ZhjcXmjcZtxmDtl> implements ZhjcXmjcZtxmDtlService {

    private  final ZhjcXmjcZtxmDtlMapper zhjcXmjcZtxmDtlMapper;
    @Override
    public Map<String,Object> getList(ZhjcXmjcZtxmDtl dtl) {

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