|
|
@@ -0,0 +1,47 @@
|
|
|
+package org.dromara.main.controller;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
+import org.dromara.system.domain.bo.SysNoticeBo;
|
|
|
+import org.dromara.system.domain.vo.SysNoticeVo;
|
|
|
+import org.dromara.system.service.ISysNoticeService;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 门户公告接口
|
|
|
+ */
|
|
|
+@SaIgnore
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/portal/notice")
|
|
|
+public class PortalNoticeController extends BaseController {
|
|
|
+
|
|
|
+ private final ISysNoticeService noticeService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据标题获取公告内容
|
|
|
+ *
|
|
|
+ * @param noticeTitle 公告标题
|
|
|
+ */
|
|
|
+ @GetMapping("/getNoticeByTitle")
|
|
|
+ public R<SysNoticeVo> getNoticeByTitle(String noticeTitle) {
|
|
|
+ SysNoticeBo bo = new SysNoticeBo();
|
|
|
+ bo.setNoticeTitle(noticeTitle);
|
|
|
+ List<SysNoticeVo> list = noticeService.selectNoticeList(bo);
|
|
|
+ // 精准匹配标题,如果有多条取第一条
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ for (SysNoticeVo notice : list) {
|
|
|
+ if (noticeTitle.equals(notice.getNoticeTitle())) {
|
|
|
+ return R.ok(notice);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+}
|