package top.baogutang.admin.controller;

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 top.baogutang.admin.domain.res.NoticeLogRes;
import top.baogutang.admin.services.INoticeLogService;
import top.baogutang.common.constants.NoticeTypeEnum;
import top.baogutang.common.domain.PageUtil;
import top.baogutang.common.domain.Results;

import javax.annotation.Resource;

/**
 * @description:
 * @author: nikooh
 * @date: 2024/02/22 : 11:49
 */
@RequestMapping("/api/v1/admin/notice")
@RestController
public class NoticeController {

    @Resource
    private INoticeLogService noticeLogService;

    @GetMapping("/page")
    public Results<PageUtil<NoticeLogRes>> pageQuery(@RequestParam(name = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                     @RequestParam(name = "pageSize", required = false, defaultValue = "20") Integer pageSize,
                                                     @RequestParam(name = "noticeType", required = false) NoticeTypeEnum noticeType) {
        return Results.ok(noticeLogService.queryPage(pageNum, pageSize, noticeType));
    }
}
