package com.gyee.frame.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.common.support.Convert;
import com.gyee.frame.mapper.auto.WindturbinepowercurvefittingMapper;
import com.gyee.frame.model.auto.Windturbinepowercurvefitting;
import com.gyee.frame.model.auto.WindturbinepowercurvefittingExample;
import com.gyee.frame.model.custom.Tablepar;
import com.gyee.frame.util.SnowflakeIdWorker;
import org.springframework.stereotype.Service;

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


@Service
public class WindturbinepowercurvefittingService implements BaseService<Windturbinepowercurvefitting, WindturbinepowercurvefittingExample> {
	@Resource
	private WindturbinepowercurvefittingMapper windturbinepowercurvefittingMapper;
	
      	   	      	      	      	      	      	      	      	      	      	      	      	      	      	
	/**
	 * 分页查询
	 * @param tablepar
	 * @param name
	 * @return
	 */
	 public PageInfo<Windturbinepowercurvefitting> list(Tablepar tablepar, String name){
	        WindturbinepowercurvefittingExample testExample=new WindturbinepowercurvefittingExample();
	        testExample.setOrderByClause("id ASC");

	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
	        List<Windturbinepowercurvefitting> list= windturbinepowercurvefittingMapper.selectByExample(testExample);
	        PageInfo<Windturbinepowercurvefitting> pageInfo = new PageInfo<Windturbinepowercurvefitting>(list);
	        return  pageInfo;
	 }

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<String> lista= Convert.toListStrArray(ids);
			WindturbinepowercurvefittingExample example=new WindturbinepowercurvefittingExample();
			example.createCriteria().andIdIn(lista);
			return windturbinepowercurvefittingMapper.deleteByExample(example);
			
				
	}


	@Override
	public Windturbinepowercurvefitting selectByPrimaryKey(String id) {
				
			return windturbinepowercurvefittingMapper.selectByPrimaryKey(id);
				
	}


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

	
	@Override
	public int updateByExample(Windturbinepowercurvefitting record, WindturbinepowercurvefittingExample example) {
		
		return windturbinepowercurvefittingMapper.updateByExample(record, example);
	}

	@Override
	public List<Windturbinepowercurvefitting> selectByExample(WindturbinepowercurvefittingExample example) {
		
		return windturbinepowercurvefittingMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(WindturbinepowercurvefittingExample example) {
		
		return windturbinepowercurvefittingMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(WindturbinepowercurvefittingExample example) {
		
		return windturbinepowercurvefittingMapper.deleteByExample(example);
	}



}
