package com.sqx.modules.errand.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.errand.entity.Notice;
import com.sqx.modules.errand.service.NoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/notice")
@Api(value = "管理端-公告", tags = {"管理端-公告"})
public class AdminNoticeController {

    @Autowired
    private NoticeService noticeService;

    @ApiOperation("查看公告列表")
    @GetMapping(value = "selectNoticeList")
    public Result selectNoticeList(Integer page, Integer limit){

        return noticeService.selectNoticeList(page, limit);
    }

    @ApiOperation("查看公告详情")
    @GetMapping(value = "selectNoticeById")
    public Result selectNoticeById(Long id){

        return noticeService.selectNoticeById(id);
    }

    @ApiOperation("添加")
    @PostMapping(value = "insertNotice")
    public Result insertNotice(@RequestBody Notice notice){

        return noticeService.insertNotice(notice);
    }

    @ApiOperation("修改")
    @PostMapping(value = "updateNotice")
    public Result updateNotice(@RequestBody Notice notice){

        return noticeService.updateNotice(notice);
    }

    @ApiOperation("删除")
    @PostMapping(value = "deleteNotice")
    public Result deleteNotice(Long id){

        return noticeService.deleteNotice(id);
    }


}
