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.WindturbinepartsMapper;
import com.gyee.frame.model.auto.Windturbineparts;
import com.gyee.frame.model.auto.WindturbinepartsExample;
import com.gyee.frame.util.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 风机信息表 WindturbinepartsService
 * @Title: WindturbinepartsService.java 
 * @Package com.gyee.frame.service 
 **/
@Service
public class WindturbinepartsService implements BaseService<Windturbineparts, WindturbinepartsExample> {
	@Resource
	private WindturbinepartsMapper windturbinepartsMapper;




	@Override
	public int deleteByPrimaryKey(String ids) {

			List<String> lista=Convert.toListStrArray(ids);
			WindturbinepartsExample example=new WindturbinepartsExample();
			example.createCriteria().andIdIn(lista);
			return windturbinepartsMapper.deleteByExample(example);


	}


	@Override
	public Windturbineparts selectByPrimaryKey(String id) {

	 	if(StringUtils.isNotEmpty(id))
		{
			return windturbinepartsMapper.selectByPrimaryKey(id);

		}
	 	return new Windturbineparts();

	}


	@Override
	public int updateByPrimaryKeySelective(Windturbineparts record) {
		return windturbinepartsMapper.updateByPrimaryKeySelective(record);
	}


	/**
	 * 添加
	 */
	@Override
	public int insertSelective(Windturbineparts record) {

//		//添加雪花主键id
//		record.setId(SnowflakeIdWorker.getUUID());


		return windturbinepartsMapper.insertSelective(record);
	}


	@Override
	public int updateByExampleSelective(Windturbineparts record, WindturbinepartsExample example) {

		return windturbinepartsMapper.updateByExampleSelective(record, example);
	}


	@Override
	public int updateByExample(Windturbineparts record, WindturbinepartsExample example) {

		return windturbinepartsMapper.updateByExample(record, example);
	}

	@Override
	public List<Windturbineparts> selectByExample(WindturbinepartsExample example) {

		return windturbinepartsMapper.selectByExample(example);
	}


	@Override
	public long countByExample(WindturbinepartsExample example) {

		return windturbinepartsMapper.countByExample(example);
	}


	@Override
	public int deleteByExample(WindturbinepartsExample example) {

		return windturbinepartsMapper.deleteByExample(example);
	}

	public List<Windturbineparts> findAll() {


		List<Windturbineparts> list=null;

		WindturbinepartsExample example=new WindturbinepartsExample();
		list= windturbinepartsMapper.selectByExample(example);
		return list;

	}


}
