package org.jeecg.modules.apiService.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.NewsService;
import org.jeecg.modules.workorderNews.entity.WorkorderNews;
import org.jeecg.modules.workorderNews.service.IWorkorderNewsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class NewsServiceImpl implements NewsService {

    //公告信息
    @Resource
    private IWorkorderNewsService workorderNewsService;
    /*************************************************************************************/

    //公告信息-查询公告列表
    @Override
    public Result<?> queryNewsList(PageBean pageBean) {
        Page<WorkorderNews> page = new Page<WorkorderNews>(pageBean.getPageNo(), pageBean.getPageSize());
        Page<WorkorderNews> pageList = workorderNewsService
                .lambdaQuery()
                .page(page);

        return Result.OK("公告信息列表", pageList);
    }

    //公告信息-根据id查询公告信息
    @Override
    public Result<?> queryNewsById(String newsId) {
        //查询公告信息详情
        WorkorderNews one = workorderNewsService
                .lambdaQuery()
                .eq(WorkorderNews::getId, newsId)
                .one();

        return Result.OK("公告信息详情", one);
    }




}
