package com.yeejoin.amos.fas.business.service.impl;

import com.yeejoin.amos.fas.business.dao.repository.ITopographyLineDao;
import com.yeejoin.amos.fas.business.service.intfc.ITopographyLineService;
import com.yeejoin.amos.fas.dao.entity.TopographyLine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("topographyLineService")
public class ITopographyLineServiceImpl implements ITopographyLineService{

	@Autowired
	private ITopographyLineDao topographyLineDao;

	@Override
	public List<TopographyLine> getLinesByAppIdAndType(String appId,String type) {
		if(appId == null) {
			return topographyLineDao.findByType(type);
		}
		return topographyLineDao.findByAppIdAndType(appId,type);
	}

	@Override
	public void saveLines(List<TopographyLine> lineData) {
		topographyLineDao.saveAll(lineData);
	}

	@Override
	public void deleteLine(String id) {
		TopographyLine line = topographyLineDao.findById(id);
		if(line != null) {
			topographyLineDao.delete(line);
		}
	}

	@Override
	public List<TopographyLine> getLinesByType(String type) {
		return topographyLineDao.findByType(type);
	}
	
	
}
