package cn.com.victorysoft.business.cyyzs.service;

import cn.com.victorysoft.business.cyyzs.dao.TubularStructureDao;
import cn.com.victorysoft.business.cyyzs.entity.TubularStructure;
import cn.com.victorysoft.business.cyyzs.entity.TubularStructureHome;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @Author TY
 * @Date: 2022/10/8 9:48
 */
@Slf4j
@Service
public class TubularStructureService {

    @Autowired
    private TubularStructureDao tubularStructureDao;


    public List<TubularStructureHome> selectList(String yclx, String cslb, String dwdm, String dydm) {
        return tubularStructureDao.selectList(yclx, cslb, dwdm, dydm);
    }

    public List<TubularStructure> selectDetails(String yclx, String dwdm, String dydm, String jh, String gylx, String fgq, String cdPsq, String xjf) {
        return tubularStructureDao.selectDetails(yclx, dwdm, dydm, jh, gylx, fgq, cdPsq, xjf);
    }

    public Map<String, Object> getBarData(String yclx, String cslb, String dwdm, String dydm) {
        Map<String, Object> result = new HashMap<>();

        List<Object> gylx = new LinkedList<>();
        List<Object> zjsjxyyn = new LinkedList<>();
        List<Object> zjsjyen  = new LinkedList<>();
        List<Object> zjsjesn  = new LinkedList<>();
        List<Object> zjsjssn  = new LinkedList<>();
        List<Object> zjsjswn  = new LinkedList<>();
        List<Object> zjsjwnys = new LinkedList<>();

        List<TubularStructureHome> barDataList = tubularStructureDao.selectList(yclx, cslb, dwdm, dydm);

        for (TubularStructureHome tubularStructureHome : barDataList) {
            gylx.add(tubularStructureHome.getGylx());
            zjsjxyyn.add(tubularStructureHome.getZjsjxyyn());
            zjsjyen.add(tubularStructureHome.getZjsjyen());
            zjsjesn.add(tubularStructureHome.getZjsjesn());
            zjsjssn.add(tubularStructureHome.getZjsjssn());
            zjsjswn.add(tubularStructureHome.getZjsjswn());
            zjsjwnys.add(tubularStructureHome.getZjsjwnys());
        }

        result.put("gylx", gylx);
        result.put("zjsjxyyn", zjsjxyyn);
        result.put("zjsjyen", zjsjyen);
        result.put("zjsjesn", zjsjesn);
        result.put("zjsjssn", zjsjssn);
        result.put("zjsjswn", zjsjswn);
        result.put("zjsjwnys", zjsjwnys);

        return result;
    }
}
