package com.gyee.frame.service;

import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.common.support.Convert;
import com.gyee.frame.mapper.auto.ManufacturerMapper;
import com.gyee.frame.model.auto.Manufacturer;
import com.gyee.frame.model.auto.ManufacturerExample;
import com.gyee.frame.util.SnowflakeIdWorker;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ManufacturerService implements BaseService<Manufacturer, ManufacturerExample> {
	@Resource
	private ManufacturerMapper manufacturerMapper;
	

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<String> lista=Convert.toListStrArray(ids);
			ManufacturerExample example=new ManufacturerExample();
			example.createCriteria().andIdIn(lista);
			return manufacturerMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public Manufacturer selectByPrimaryKey(String id) {
				
			return manufacturerMapper.selectByPrimaryKey(id);
				
	}

	
	@Override
	public int updateByPrimaryKeySelective(Manufacturer record) {
		return manufacturerMapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(Manufacturer record) {
				
		//添加雪花主键id
		record.setId(SnowflakeIdWorker.getUUID());
			
				
		return manufacturerMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(Manufacturer record, ManufacturerExample example) {
		
		return manufacturerMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(Manufacturer record, ManufacturerExample example) {
		
		return manufacturerMapper.updateByExample(record, example);
	}

	@Override
	public List<Manufacturer> selectByExample(ManufacturerExample example) {
		
		return manufacturerMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(ManufacturerExample example) {
		
		return manufacturerMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(ManufacturerExample example) {
		
		return manufacturerMapper.deleteByExample(example);
	}
	

}
