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.mapper.auto.ForecastwindspeedamendedMapper;
import com.gyee.frame.model.auto.Forecastwindspeedamended;
import com.gyee.frame.model.auto.ForecastwindspeedamendedExample;
import com.gyee.frame.model.custom.Tablepar;
import org.springframework.stereotype.Service;

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

/**
 * 线路 LineService
 * @Title: LineService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class ForecastwindspeedamendedService implements BaseService<Forecastwindspeedamended, ForecastwindspeedamendedExample> {
	@Resource
	private ForecastwindspeedamendedMapper forecastwindspeedamendedMapper;
	
      	   	      	      	      	      	      	      	      	      	      	
	/**
	 * 分页查询
	 * @param tablepar
	 * @param name
	 * @return
	 */
	 public PageInfo<Forecastwindspeedamended> list(Tablepar tablepar, String name){
	        ForecastwindspeedamendedExample testExample=new ForecastwindspeedamendedExample();
	        testExample.setOrderByClause("id ASC");
	        if(name!=null&&!"".equals(name)){
	        	testExample.createCriteria().andWpnameLike("%"+name+"%");
	        }

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

	@Override
	public int deleteByPrimaryKey(String ids) {

			return -1;


	}

	
	@Override
	public Forecastwindspeedamended selectByPrimaryKey(String id) {
				
			return forecastwindspeedamendedMapper.selectByPrimaryKey(Integer.valueOf(id));
				
	}

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

				
		return forecastwindspeedamendedMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(Forecastwindspeedamended record, ForecastwindspeedamendedExample example) {
		
		return forecastwindspeedamendedMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(Forecastwindspeedamended record, ForecastwindspeedamendedExample example) {
		
		return forecastwindspeedamendedMapper.updateByExample(record, example);
	}

	@Override
	public List<Forecastwindspeedamended> selectByExample(ForecastwindspeedamendedExample example) {
		
		return forecastwindspeedamendedMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(ForecastwindspeedamendedExample example) {
		
		return forecastwindspeedamendedMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(ForecastwindspeedamendedExample example) {
		
		return forecastwindspeedamendedMapper.deleteByExample(example);
	}
	
	/**
	 * 检查name
	 * @param forecastwindspeedamended
	 * @return
	 */
	public int checkNameUnique(Forecastwindspeedamended forecastwindspeedamended){
		ForecastwindspeedamendedExample example=new ForecastwindspeedamendedExample();
		example.createCriteria().andIdEqualTo(forecastwindspeedamended.getId());
		List<Forecastwindspeedamended> list=forecastwindspeedamendedMapper.selectByExample(example);
		return list.size();
	}


}
