/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.wechat.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.wechat.global.base.dao.Pagination;
import com.wechat.global.base.dao.PagingResult;
import com.wechat.global.base.dao.impl.BaseDao;
import com.wechat.global.base.interceptor.Page;
import com.wechat.model.dbEntity.MdeTrends;
import com.wechat.model.dto.TrendsDto;

/**
 * 单表生成DAO接口
 * @author tangwc
 * @version 2018-05-23
 */
@Repository
public class MdeTrendsDao extends BaseDao {
	
	public MdeTrends getInfoById(Long trendsId) {
        return super.selectOne("MdeTrendsMapper.get", trendsId);
    }

	/**
	 * 好友动态-分页查询
	 * @param userCode
	 * @param limi
	 * @return
	 */
	public Page<TrendsDto> getFriendTrends(Page<TrendsDto> page, String userCode) {
		TrendsDto dto = new TrendsDto();
		dto.setUserCode(userCode);
		return super.findPage(page, "MdeTrendsMapper.getFriendTrends", dto);
	}
	
	/**
	 * 好友动态
	 * @param userCode
	 * @param limi
	 * @return
	 */
	public PagingResult<TrendsDto> getFriendTrends(Pagination page) {
		return super.selectPagination("MdeTrendsMapper.getFriendTrends", "MdeTrendsMapper.getFriendTrendsCounts", page);
	}
	
	/**
	 * 获取固定条数的好友动态
	 * @param param
	 * @return
	 */
	public List<MdeTrends> getFriendTrendsWithLimit(Map<String, Object> param) {
		return super.select("MdeTrendsMapper.getFriendTrendsWithLimit",param);
	}
	public int insertSharedTrends(MdeTrends trends) {
		
		return sqlSession.insert("MdeTrendsMapper.insertSharedTrends", trends);
	}
	/**
	 * 我的互动 - 点赞列表
	 * @param strings
	 * @return
	 */
	public List<MdeTrends> myThumbUp(String[] likeList) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("likeList", likeList);
		return super.select("MdeTrendsMapper.myThumbUp", map);
	}
	/**
	 * 删除动态
	 * @param trends
	 * @return
	 */
	public int delete(MdeTrends trends) {
		
		return super.delete("MdeTrendsMapper.delete", trends);
	}
	
	/**
	 * 获取指定用户的动态
	 * @param page
	 * @return
	 */
	public PagingResult<TrendsDto> getMyTrends(Pagination page) {
		return super.selectPagination("MdeTrendsMapper.getMyTrends", "MdeTrendsMapper.getMyTrendsCounts", page);
	}
/*	public List<MdeTrends> getMyTrendsWithLimit(String userCode, int limitSize) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("userCode", userCode);
		map.put("limitSize", limitSize);
		return super.select("MdeTrendsMapper.getMyTrendsWithLimit",map);
	}*/
	public List<MdeTrends> getTrendsByIds(List<Long> trendIds) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("trendIds", trendIds);
		return super.select("MdeTrendsMapper.getTrendsByIds", map);
	}
	public int deleteTrendOrigin(MdeTrends trends) {
		return super.delete("MdeTrendsMapper.deleteTrendOrigin", trends);
	}

}