package com.jeeplus.modules.sg.overheadline.service;

import com.jeeplus.common.utils.excel.ImportExcel;
import com.jeeplus.common.utils.sg.ExcelUtil;
import com.jeeplus.modules.sg.overheadline.entity.Settlement;
import com.jeeplus.modules.sg.overheadline.mapper.SettlementMapper;
import com.jeeplus.modules.sg.overheadline.util.BashInfo;
import com.jeeplus.modules.sg.overheadline.util.SettementUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.util.*;

@Service
public class SettlementService {
    @Autowired
    private SettlementMapper settlementMapper;

    /*
      添加结算工程表
   */
    @Transactional
    public void save(List<Settlement> settlements,String id){
        for (Settlement settlement:settlements){
            settlement.setId(id);
            settlementMapper.sava(settlement);
        }
    }
    /*
       查找结算工程
    */
    public List<Settlement> selectSettlementService(String id,String type){
        if (type.equals("1")) {
            return SettementUtil.getSelectSettlement(settlementMapper.selectSettlement(id));
        } else {
          return SettementUtil.getSelectDlSettlement(settlementMapper.selectSettlement(id));
        }
    }

    public void delete(String id){
        settlementMapper.delete(id);
    }
}
