package com.uas.finance.service.Impl;

import com.uas.finance.dao.AccountApplyDao;
import com.uas.finance.dao.FsSaleDao;
import com.uas.finance.model.AccountApply;
import com.uas.finance.model.FsSale;
import com.uas.finance.service.AccountApplyService;
import com.uas.finance.service.FsSaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * 基础合同接口实现类
 * created by shicr on 2018/1/25
 **/
@Service
public class FsSaleServiceImpl implements FsSaleService {

    @Autowired
    private FsSaleDao dao;

    /**
     * 基础合同保存
     *
     * @param fsSales
     * @return
     */
    public List<FsSale> save(List<FsSale> fsSales) {

        ArrayList<FsSale> arrayList = new ArrayList<FsSale>();
        for (FsSale fsSale : fsSales) {
            FsSale fsSale1 = dao.save(fsSale);
            arrayList.add(fsSale1);
        }
        return arrayList;
    }

    /**
     * 删除某条合同
     * @param id
     * @return
     */
    public void delete(Long id) {
         dao.delete(id);
    }

    /**
     * 查找某出账单下的合同
     * @param id
     * @return
     */
    public Set<FsSale> findByAa_id(Long id){
        return dao.findByAa_id(id);
    }

    /**
     * 根据主键找到合同
     *
     * @param id
     * @return
     */
    @Override
    public FsSale findOne(Long id) {
        return dao.findOne(id);
    }
}
