package com.gyee.frame.service;


import com.gyee.frame.common.base.BaseService;
import com.gyee.frame.mapper.auto.ChatDetailMapper;
import com.gyee.frame.model.auto.ChatDetail;
import com.gyee.frame.model.auto.ChatDetailExample;
import com.gyee.frame.util.Convert;
import com.gyee.frame.util.StringUtils;
import org.springframework.stereotype.Service;

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

/**
 *  ChatDetailService
 * @Title: ChatDetailService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2020-04-15 16:48:37  
 **/
@Service
public class ChatDetailService implements BaseService<ChatDetail, ChatDetailExample> {
	@Resource
	private ChatDetailMapper chatDetailMapper;

	@Override
	public int deleteByPrimaryKey(String ids) {

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

	}

	@Override
	public int updateByPrimaryKeySelective(ChatDetail record) {
		return chatDetailMapper.updateByPrimaryKeySelective(record);
	}


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



		return chatDetailMapper.insertSelective(record);
	}


	@Override
	public int updateByExampleSelective(ChatDetail record, ChatDetailExample example) {

		return chatDetailMapper.updateByExampleSelective(record, example);
	}


	@Override
	public int updateByExample(ChatDetail record, ChatDetailExample example) {

		return chatDetailMapper.updateByExample(record, example);
	}

	@Override
	public List<ChatDetail> selectByExample(ChatDetailExample example) {

		return chatDetailMapper.selectByExample(example);
	}


	@Override
	public long countByExample(ChatDetailExample example) {

		return chatDetailMapper.countByExample(example);
	}


	@Override
	public int deleteByExample(ChatDetailExample example) {

		return chatDetailMapper.deleteByExample(example);
	}

	@Override
	public ChatDetail selectByPrimaryKey(String id) {

		if(StringUtils.isNotNull(id))
		{
			return chatDetailMapper.selectByPrimaryKey(Integer.valueOf(id));
		}
		return new ChatDetail();

	}


	public List<ChatDetail> selectLastInfoByUserId(String sendingid,String pointtoid){


		List<ChatDetail> list= chatDetailMapper.selectLastInfoByUserId(sendingid,pointtoid);

		return  list;
	}

	public List<ChatDetail> selectByUserId(String sendingid,String pointtoid){

		List<ChatDetail> list= chatDetailMapper.selectByUserId(sendingid,pointtoid);

		return  list;
	}

	public List<ChatDetail> selectLimitByUserId(String sendingid,String pointtoid,int begin,int end){

		List<ChatDetail> list= chatDetailMapper.selectLimitByUserId(sendingid,pointtoid,begin,end);

		return  list;
	}

}
