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.GyeeContactsMapper;
import com.gyee.frame.model.auto.GyeeContacts;
import com.gyee.frame.model.auto.GyeeContactsExample;
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;

/**
 *  GyeeContactsService
 * @Title: GyeeContactsService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2020-04-17 14:18:03  
 **/
@Service
public class GyeeContactsService implements BaseService<GyeeContacts, GyeeContactsExample>{
	@Resource
	private GyeeContactsMapper gyeecontactsMapper;

      	   	      	      	      	      	
	/**
	 * 分页查询
	 * @return
	 */
	 public PageInfo<GyeeContacts> list(Tablepar tablepar,String name){
	        GyeeContactsExample testExample=new GyeeContactsExample();
	        testExample.setOrderByClause("id ASC");

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

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

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

	
	@Override
	public int updateByExample(GyeeContacts record, GyeeContactsExample example) {
		
		return gyeecontactsMapper.updateByExample(record, example);
	}

	@Override
	public List<GyeeContacts> selectByExample(GyeeContactsExample example) {
		
		return gyeecontactsMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(GyeeContactsExample example) {
		
		return gyeecontactsMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(GyeeContactsExample example) {
		
		return gyeecontactsMapper.deleteByExample(example);
	}



	public List<GyeeContacts> queryGyeeContactsByUserId(String userid){

		return gyeecontactsMapper.queryGyeeContactsByUserId(userid);
	}




}
