package com.ym.mec.cms.service.impl;

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

import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
import com.ym.mec.cms.dal.entity.NewsStatusEnum;
import com.ym.mec.common.page.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
import com.ym.mec.cms.dal.entity.SysNewsInformation;
import com.ym.mec.cms.service.SysNewsInformationService;
import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.common.service.impl.BaseServiceImpl;

@Service
public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNewsInformation> implements SysNewsInformationService {

	@Autowired
	private SysNewsInformationDao sysNewsInformationDao;

	@Override
	public BaseDAO<Long, SysNewsInformation> getDAO() {
		return sysNewsInformationDao;
	}

	@Override
	public List<SysNewsInformation> queryByType(Integer type) {
		return sysNewsInformationDao.queryByType(type);
	}

	@Override
	public boolean deleteWithLogical(Long id) {
		sysNewsInformationDao.deleteWithLogical(id);
		return true;
	}

	@Override
	public Map<String,PageInfo<SysNewsInformation>> getHomeList(NewsInformationQueryInfo queryInfo) {
		//1精彩活动，2热门资讯,3banner类型
		Map<String,PageInfo<SysNewsInformation>> homeList = new HashMap<>();
		queryInfo.setType(1);
		homeList.put("active",queryPage(queryInfo));
		queryInfo.setType(2);
		homeList.put("hot",queryPage(queryInfo));
		queryInfo.setType(3);
		homeList.put("banner",queryPage(queryInfo));
		return homeList;
	}

}