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

import java.time.LocalDate;
import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.dgtis.dorm.manager.db.dao.ZhllConsultingComplaintsMapper;
import com.dgtis.dorm.manager.db.domain.ZhllCollect;
import com.dgtis.dorm.manager.db.domain.ZhllConsultingComplaints;
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 ZhllConsultingComplaintsService
{
	@Resource
	private ZhllConsultingComplaintsMapper zhllConsultingComplaintsMapper;

	/**
     * 查询咨询投诉信息
     * 
     * @param id 咨询投诉ID
     * @return 咨询投诉信息
     */
	public ZhllConsultingComplaints selectZhllConsultingComplaintsById(String id)
	{
	    return zhllConsultingComplaintsMapper.selectZhllConsultingComplaintsById(id);
	}
	
	/**
     * 查询咨询投诉列表
     * 
     * @param zhllConsultingComplaints 咨询投诉信息
     * @return 咨询投诉集合
     */
	public List<ZhllConsultingComplaints> selectZhllConsultingComplaintsList(ZhllConsultingComplaints zhllConsultingComplaints)
	{
	    return zhllConsultingComplaintsMapper.selectZhllConsultingComplaintsList(zhllConsultingComplaints);
	}
	
    /**
     * 新增咨询投诉
     * 
     * @param zhllConsultingComplaints 咨询投诉信息
     * @return 结果
     */
	public int insertZhllConsultingComplaints(ZhllConsultingComplaints zhllConsultingComplaints)
	{
	    return zhllConsultingComplaintsMapper.insertZhllConsultingComplaints(zhllConsultingComplaints);
	}
	
	/**
     * 修改咨询投诉
     * 
     * @param zhllConsultingComplaints 咨询投诉信息
     * @return 结果
     */
	public int updateZhllConsultingComplaints(ZhllConsultingComplaints zhllConsultingComplaints)
	{
	    return zhllConsultingComplaintsMapper.updateZhllConsultingComplaints(zhllConsultingComplaints);
	}

	/**
	 * @descption: 分页查询咨询信息
	 * @param: [zhllConsultingComplaints]
	 * @return: java.lang.Integer
	 * @auther: qxp
	 * @date:19-7-10 17:35
	 */
    public PageInfo<ZhllConsultingComplaints> findListPage(ZhllConsultingComplaints zhllConsultingComplaints,
														   Integer page ,Integer limit) {
		List<ZhllConsultingComplaints> zhllConsultingComplaintsList = null;
		if(page==null){
			page = 1;
		}
		if(limit==null){
			limit = 10;
		}
		PageHelper.startPage(page, limit);
		zhllConsultingComplaintsList = zhllConsultingComplaintsMapper.
				selectZhllConsultingComplaintsList(zhllConsultingComplaints);
		PageInfo<ZhllConsultingComplaints> pageInfo= new PageInfo<ZhllConsultingComplaints>(zhllConsultingComplaintsList);
		return pageInfo;
    }

    /**
     * @descption: 分页按照条件查询list 名字和内容按照模糊查询的方式
     * @param: [zhllConsultingComplaints, page, limit]
     * @return: com.github.pagehelper.PageInfo<com.dgtis.dorm.manager.db.domain.ZhllConsultingComplaints>
     * @auther: qxp
     * @date:19-8-6 09:47
     */
    public PageInfo<ZhllConsultingComplaints> queryListPage(ZhllConsultingComplaints zhllConsultingComplaints, Integer page, Integer limit) {
		List<ZhllConsultingComplaints> zhllConsultingComplaintsList = null;
		if(page==null){
			page = 1;
		}
		if(limit==null){
			limit = 10;
		}
		PageHelper.startPage(page, limit);
		zhllConsultingComplaintsList = zhllConsultingComplaintsMapper.queryList(zhllConsultingComplaints);
		PageInfo<ZhllConsultingComplaints> pageInfo= new PageInfo<ZhllConsultingComplaints>(zhllConsultingComplaintsList);
		return pageInfo;
    }
	/**
	 * @descption: 分页按照条件查询list 名字和内容按照模糊查询的方式
	 * @param: [zhllConsultingComplaints, page, limit]
	 * @return: com.github.pagehelper.PageInfo<com.dgtis.dorm.manager.db.domain.ZhllConsultingComplaints>
	 * @auther: qxp
	 * @date:19-8-6 09:47
	 */
	public PageInfo<ZhllConsultingComplaints> queryByTimeListPage(ZhllConsultingComplaints zhllConsultingComplaints, String startDate,String endDate, Integer page, Integer limit) {
		List<ZhllConsultingComplaints> zhllConsultingComplaintsList = null;
		if(page==null){
			page = 1;
		}
		if(limit==null){
			limit = 10;
		}
		PageHelper.startPage(page, limit);
		zhllConsultingComplaintsList = zhllConsultingComplaintsMapper.queryByTimeListPage(zhllConsultingComplaints,startDate,endDate);
		PageInfo<ZhllConsultingComplaints> pageInfo= new PageInfo<ZhllConsultingComplaints>(zhllConsultingComplaintsList);
		return pageInfo;
	}


}
