package com.bonus.sgzb.app.controller;

import com.bonus.sgzb.app.domain.SysNotice;
import com.bonus.sgzb.app.service.SysNoticeService;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author c liu
 * @date 2023/12/11
 */
@RestController
@RequestMapping("/base/sysNotice")
public class SysNoticeController {
    @Autowired
    private SysNoticeService service;

    @ApiOperation(value = "查询通知公告列表")
    @GetMapping("/getList")
    public AjaxResult getList(@RequestParam(required = false, defaultValue = "", value = "keyword") String keyword) {
        List<SysNotice> list = service.getList(keyword);
        return AjaxResult.success("操作成功",list);
    }

    @ApiOperation(value = "查询通知公告详细")
    @GetMapping("/getById")
    public AjaxResult getById(@RequestParam(required = false, defaultValue = "", value = "noticeId") Long noticeId) {
        SysNotice bean = service.getById(noticeId);
        return AjaxResult.success("操作成功",bean);
    }
}
