package top.lejings.demo.controller;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.lejings.demo.pojo.Announcements;
import top.lejings.demo.pojo.Result;
import top.lejings.demo.service.AnnouncementsService;

import java.util.List;

/*
* 公告响应
* 对前端对于公告的所有请求接收
* */

@Slf4j
@RestController
public class AnnouncementsController {

    @Autowired
    private AnnouncementsService announcementsService;

    @GetMapping("/announcements")
    public Result AnnouncementsAll(){
        log.info("查询所有公告数据");
        List<Announcements> announcementsList = announcementsService.announcementsAll();
        return Result.success(announcementsList);
    }

}
