package com.goafanti.common.service;


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

import org.springframework.stereotype.Service;

import com.goafanti.common.dao.JtCollectSearchMapper;
import com.goafanti.common.model.JtCollectSearch;
import com.goafanti.common.utils.StringUtils;
import com.goafanti.core.mybatis.BaseMybatisDao;
import com.goafanti.core.mybatis.page.Pagination;
@Service
public class GlobalSearchService  extends BaseMybatisDao<JtCollectSearchMapper> {

	@SuppressWarnings("unchecked")
	public Pagination<JtCollectSearch> globalSearchList(String name, Integer pageNo, Integer pageSize) {
		Map<String, Object> params = new HashMap<>();
		if(StringUtils.isNotBlank(name))params.put("name", name);
		if(pageNo==null||pageNo<1)pageNo=1;
		if(pageSize==null||pageSize<1)pageSize=10;
		return (Pagination<JtCollectSearch>) findPage("globalSearchList", "globalSearchCount", params, pageNo,
				pageSize);
		
		
	}

	@SuppressWarnings("unchecked")
	public Object AchievementsDemandSearchList(String name, Integer pageNo, Integer pageSize) {
		Map<String, Object> params = new HashMap<>();
		if(StringUtils.isNotBlank(name))params.put("name", name);
		params.put("AchievementDemand", 1);
		if(pageNo==null||pageNo<1)pageNo=1;
		if(pageSize==null||pageSize<1)pageSize=10;
		return (Pagination<JtCollectSearch>) findPage("globalSearchList", "globalSearchCount", params, pageNo,
				pageSize);
	}

}
