|
|
@@ -1,64 +1,153 @@
|
|
|
+/*
|
|
|
+ * Copyright [2022] [https://www.xiaonuo.vip]
|
|
|
+ *
|
|
|
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
|
|
+ *
|
|
|
+ * 1.请不要删除和修改根目录下的LICENSE文件。
|
|
|
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
|
|
|
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
|
|
|
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
|
|
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
|
|
|
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
|
|
+ */
|
|
|
package vip.xiaonuo.disk.controller;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.qiwenshare.common.result.RestResult;
|
|
|
-import vip.xiaonuo.disk.service.INoticeService;
|
|
|
-import vip.xiaonuo.disk.domain.Notice;
|
|
|
-import vip.xiaonuo.disk.dto.notice.NoticeListDTO;
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import vip.xiaonuo.common.annotation.CommonLog;
|
|
|
+import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
+import vip.xiaonuo.common.pojo.CommonValidList;
|
|
|
+import vip.xiaonuo.disk.param.notice.NoticeAddParam;
|
|
|
+import vip.xiaonuo.disk.param.notice.NoticeEditParam;
|
|
|
+import vip.xiaonuo.disk.param.notice.NoticeIdParam;
|
|
|
+import vip.xiaonuo.disk.param.notice.NoticePageParam;
|
|
|
+import vip.xiaonuo.disk.service.NoticeService;
|
|
|
+import vip.xiaonuo.disk.vo.notice.NoticeVo;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
|
|
|
|
-@Tag(name = "公告管理")
|
|
|
+/**
|
|
|
+ * notice控制器
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+@Api(tags = "notice控制器")
|
|
|
+@ApiSupport(author = "SNOWY_TEAM", order = 1)
|
|
|
@RestController
|
|
|
-@RequestMapping("/notice")
|
|
|
+@Validated
|
|
|
public class NoticeController {
|
|
|
- public static final String CURRENT_MODULE = "公告管理";
|
|
|
+
|
|
|
@Resource
|
|
|
- INoticeService noticeService;
|
|
|
+ private NoticeService noticeService;
|
|
|
|
|
|
/**
|
|
|
- * 得到所有的公告
|
|
|
+ * 获取notice分页
|
|
|
*
|
|
|
- * @return
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
*/
|
|
|
- @Operation(summary = "得到所有的公告列表", tags = {"公告管理"})
|
|
|
- @RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public RestResult<NoticeListDTO> selectUserList(@Parameter(description = "当前页,从1开始") @RequestParam(defaultValue = "1") int page,
|
|
|
- @Parameter(description = "页大小") @RequestParam(defaultValue = "10") int pageSize,
|
|
|
- @Parameter(description = "标题") @RequestParam(required = false) String title,
|
|
|
- @Parameter(description = "发布者") @RequestParam(required = false) Long publisher,
|
|
|
- @Parameter(description = "开始发布时间") @RequestParam(required = false) String beginTime,
|
|
|
- @Parameter(description = "开始发布时间") @RequestParam(required = false) String endTime) {
|
|
|
- NoticeListDTO noticeListDTO = new NoticeListDTO();
|
|
|
- noticeListDTO.setPage(page);
|
|
|
- noticeListDTO.setPageSize(pageSize);
|
|
|
- noticeListDTO.setTitle(title);
|
|
|
- noticeListDTO.setPlatform(3);
|
|
|
- noticeListDTO.setPublisher(publisher);
|
|
|
- noticeListDTO.setBeginTime(beginTime);
|
|
|
- noticeListDTO.setEndTime(endTime);
|
|
|
- IPage<Notice> noticeIPage = noticeService.selectUserPage(noticeListDTO);
|
|
|
-
|
|
|
- return RestResult.success().dataList(noticeIPage.getRecords(), noticeIPage.getTotal());
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation("获取notice分页")
|
|
|
+ @GetMapping("/disk/notice/page")
|
|
|
+ public CommonResult<Page<NoticeVo>> page(NoticePageParam noticePageParam) {
|
|
|
+ return CommonResult.data(noticeService.page(noticePageParam));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "查询公告详情", tags = {"公告管理"})
|
|
|
- @RequestMapping(value = "/detail", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public RestResult<Notice> getNoticeDetail(@Parameter(description = "公告id", required = true) long noticeId) {
|
|
|
- RestResult<Notice> result = new RestResult<Notice>();
|
|
|
+ /**
|
|
|
+ * 添加notice
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation("添加notice")
|
|
|
+ @CommonLog("添加notice")
|
|
|
+ @PostMapping("/disk/notice/add")
|
|
|
+ public CommonResult<String> add(@RequestBody @Valid NoticeAddParam noticeAddParam) {
|
|
|
+ noticeService.add(noticeAddParam);
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
|
|
|
- Notice notice = noticeService.getById(noticeId);
|
|
|
+ /**
|
|
|
+ * 编辑notice
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation("编辑notice")
|
|
|
+ @CommonLog("编辑notice")
|
|
|
+ @PostMapping("/disk/notice/edit")
|
|
|
+ public CommonResult<String> edit(@RequestBody @Valid NoticeEditParam noticeEditParam) {
|
|
|
+ noticeService.edit(noticeEditParam);
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
|
|
|
- return RestResult.success().data(notice);
|
|
|
+ /**
|
|
|
+ * 删除notice
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation("删除notice")
|
|
|
+ @CommonLog("删除notice")
|
|
|
+ @PostMapping("/disk/notice/delete")
|
|
|
+ public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
|
|
|
+ CommonValidList<NoticeIdParam> noticeIdParamList) {
|
|
|
+ noticeService.delete(noticeIdParamList);
|
|
|
+ return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取notice详情
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation("获取notice详情")
|
|
|
+ @GetMapping("/disk/notice/detail")
|
|
|
+ public CommonResult<NoticeVo> detail(@Valid NoticeIdParam noticeIdParam) {
|
|
|
+ return CommonResult.data(noticeService.detail(noticeIdParam));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 发布
|
|
|
+ *
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation("获取notice详情")
|
|
|
+ @GetMapping("/disk/notice/publish")
|
|
|
+ public CommonResult<?> publish(@Valid NoticeIdParam noticeIdParam) {
|
|
|
+ noticeService.publish(noticeIdParam);
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 取消发布
|
|
|
+ * @author pans
|
|
|
+ * @date 2025/07/25 16:17
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation("获取notice详情")
|
|
|
+ @GetMapping("/disk/notice/cancel")
|
|
|
+ public CommonResult<?> cancel(@Valid NoticeIdParam noticeIdParam) {
|
|
|
+ noticeService.cancel(noticeIdParam);
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
}
|