package com.yc.education.service.impl;

import com.github.pagehelper.PageHelper;
import com.yc.education.mapper.NewsTypeMapper;
import com.yc.education.model.NewsType;
import com.yc.education.service.INewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Hickey
 * @create 2019-07-23 14:46
 */
@Service
public class NewsTypeServiceImpl extends BaseService<NewsType> implements INewsTypeService {
    @Autowired
    private NewsTypeMapper mapper;

    /**
     * 前台
     * 查询所有新闻类别信息
     * @return
     */
    @Override
    public List<NewsType> listAllType(){
        return mapper.listAllType();
    }
    /**
     * 前台
     * 查询类别中权重最大的类别id,传给新闻中心界面
     */
    @Override
    public  NewsType listIdByWeight(){
        return  mapper.listIdByWeight();
    }


    /**
     * 后台
     * 查询所有新闻类别并分页
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public  List<NewsType> listAllType(Integer pageNum,Integer pageSize){
        PageHelper.startPage(pageNum,pageSize);
        return mapper.listAllType();
    }
    /**
     * 后台管理
     * 批量删除
     * @param typeArray
     * @return
     */
    @Override
    public int deleteTypeArray(int [] typeArray){
        return mapper.deleteTypeArray(typeArray);
    }

}
