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.WindPowerStationTestingPointMapper;
import com.gyee.frame.model.auto.WindPowerStationTestingPoint;
import com.gyee.frame.model.auto.WindPowerStationTestingPointExample;
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;

/**
 * 风场测点 windPowerStationTestingPointService
 * @Title: windPowerStationTestingPointService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class WindPowerstationTestingPointService implements BaseService<WindPowerStationTestingPoint, WindPowerStationTestingPointExample> {
	@Resource
	private WindPowerStationTestingPointMapper windPowerStationTestingPointMapper;
	
      	   	      	      	      	      	      	      	      	      	      	
	/**
	 * 分页查询
	 * @param tablepar
	 * @param name
	 * @return
	 */
	 public PageInfo<WindPowerStationTestingPoint> list(Tablepar tablepar, String name){
	        WindPowerStationTestingPointExample testExample=new WindPowerStationTestingPointExample();
	        testExample.setOrderByClause("id ASC");
	        if(name!=null&&!"".equals(name)){
	        	testExample.createCriteria().andCodeLike("%"+name+"%");
	        }

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

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<String> lista=Convert.toListStrArray(ids);
			WindPowerStationTestingPointExample example=new WindPowerStationTestingPointExample();
			example.createCriteria().andCodeIn(lista);
			return windPowerStationTestingPointMapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public WindPowerStationTestingPoint selectByPrimaryKey(String id) {
				
			return windPowerStationTestingPointMapper.selectByPrimaryKey(id);
				
	}

	
	@Override
	public int updateByPrimaryKeySelective(WindPowerStationTestingPoint record) {
		return windPowerStationTestingPointMapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(WindPowerStationTestingPoint record) {
				
		//添加雪花主键id
		record.setCode(SnowflakeIdWorker.getUUID());
			
				
		return windPowerStationTestingPointMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(WindPowerStationTestingPoint record, WindPowerStationTestingPointExample example) {
		
		return windPowerStationTestingPointMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(WindPowerStationTestingPoint record, WindPowerStationTestingPointExample example) {
		
		return windPowerStationTestingPointMapper.updateByExample(record, example);
	}

	@Override
	public List<WindPowerStationTestingPoint> selectByExample(WindPowerStationTestingPointExample example) {
		
		return windPowerStationTestingPointMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(WindPowerStationTestingPointExample example) {
		
		return windPowerStationTestingPointMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(WindPowerStationTestingPointExample example) {
		
		return windPowerStationTestingPointMapper.deleteByExample(example);
	}


}
