package com.gyee.frame.service;

import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.common.dataSources.DataSource;
import com.gyee.frame.common.dataSources.DataSourceType;
import com.gyee.frame.common.support.Convert;
import com.gyee.frame.mapper.auto.EquipmentSqlMapper;
import com.gyee.frame.model.auto.EquipmentSql;
import com.gyee.frame.model.auto.EquipmentSqlExample;
import com.gyee.frame.util.StringUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

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

/**
 * 线路 EquipmentSqlService
 * @Title: EquipmentSqlService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class EquipmentSqlService implements BaseService<EquipmentSql, EquipmentSqlExample> {
	@Resource
	private EquipmentSqlMapper equipmentSqlMapper;


	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<Double> lista=Convert.toDoubleArrayList(ids);
			EquipmentSqlExample example=new EquipmentSqlExample();
			example.createCriteria().andIdIn(lista);
			return equipmentSqlMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public EquipmentSql selectByPrimaryKey(String id) {
				
			return equipmentSqlMapper.selectByPrimaryKey(Double.valueOf(id));
				
	}

	
	@Override
	public int updateByPrimaryKeySelective(EquipmentSql record) {
		return equipmentSqlMapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(EquipmentSql record) {
				

			
				
		return equipmentSqlMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(EquipmentSql record, EquipmentSqlExample example) {
		
		return equipmentSqlMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(EquipmentSql record, EquipmentSqlExample example) {
		
		return equipmentSqlMapper.updateByExample(record, example);
	}

	@Override
	public List<EquipmentSql> selectByExample(EquipmentSqlExample example) {
		
		return equipmentSqlMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(EquipmentSqlExample example) {
		
		return equipmentSqlMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(EquipmentSqlExample example) {
		
		return equipmentSqlMapper.deleteByExample(example);
	}

	@DataSource(value = DataSourceType.TICKET)
	public List<EquipmentSql>  getEquipmentListByLocation(String location) {

		List<EquipmentSql> vos=new ArrayList<>();

		if(StringUtils.notEmp(location) )
		{
			vos= equipmentSqlMapper.getEquipmentListByLocation(location);
		}

		return vos;

	}

}
