package com.dgtis.dorm.manager.db.service;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.dgtis.dorm.manager.db.dao.ZhllCollectMapper;
import com.dgtis.dorm.manager.db.domain.QuestionsAnswers;
import com.dgtis.dorm.manager.db.domain.ZhllCollect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 收藏 服务层实现
 * 
 * @author ruoyi
 * @date 2019-07-10
 */
@Service
public class ZhllCollectService
{
	@Resource
	private ZhllCollectMapper zhllCollectMapper;

	/**
     * 查询收藏信息
     * 
     * @param id 收藏ID
     * @return 收藏信息
     */
	public ZhllCollect selectZhllCollectById(String id)
	{
	    return zhllCollectMapper.selectZhllCollectById(id);
	}
	
	/**
     * 查询收藏列表
     * 
     * @param zhllCollect 收藏信息
     * @return 收藏集合
     */
	public List<ZhllCollect> selectZhllCollectList(ZhllCollect zhllCollect)
	{
	    return zhllCollectMapper.selectZhllCollectList(zhllCollect);
	}
	
    /**
     * 新增收藏
     * 
     * @param zhllCollect 收藏信息
     * @return 结果
     */
	public int insertZhllCollect(ZhllCollect zhllCollect)
	{
	    return zhllCollectMapper.insertZhllCollect(zhllCollect);
	}
	
	/**
     * 修改收藏
     * 
     * @param zhllCollect 收藏信息
     * @return 结果
     */
	public int updateZhllCollect(ZhllCollect zhllCollect)
	{
	    return zhllCollectMapper.updateZhllCollect(zhllCollect);
	}


	/**
	 * @descption: 根据条件分页查询收藏的列表
	 * @param: [zhllCollect, page, limit]
	 * @return: com.github.pagehelper.PageInfo<com.dgtis.dorm.manager.db.domain.ZhllCollect>
	 * @auther: qxp
	 * @date:19-7-10 16:28
	 */
	public PageInfo<ZhllCollect> findPage(ZhllCollect zhllCollect,Integer page,Integer limit){
		List<ZhllCollect> zhllCollectList = null;
		if(page==null){
			page = 1;
		}
		if(limit==null){
			limit = 10;
		}
		PageHelper.startPage(page, limit);
		zhllCollectList = zhllCollectMapper.selectZhllCollectList(zhllCollect);
		PageInfo<ZhllCollect> pageInfo= new PageInfo<ZhllCollect>(zhllCollectList);
		return pageInfo;
	}


	/**
	 * @descption: 根据收藏id删除收藏
	 * @param:
	 * @return:
	 * @auther: qxp
	 * @date:19-7-10 16:50
	 */
	public Integer deleteByid(String id) {
		return zhllCollectMapper.deleteById(id);
	}
}
