From d8481071b5da01672203585f9d39188b50c7c3f9 Mon Sep 17 00:00:00 2001 From: Y1-zd Date: Wed, 24 Nov 2021 12:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BC=A0=E5=80=BC=E6=96=B9=E5=BC=8F=EF=BC=9B=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=AF=B9=E5=A4=9A=E4=B8=AA=E7=9B=B8=E5=90=8C=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=89=94=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/NoticeController.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/mobile_education_platform/controller/NoticeController.java b/src/main/java/com/mobile_education_platform/controller/NoticeController.java index 5b20168..38c74aa 100644 --- a/src/main/java/com/mobile_education_platform/controller/NoticeController.java +++ b/src/main/java/com/mobile_education_platform/controller/NoticeController.java @@ -75,7 +75,9 @@ public class NoticeController { @ApiImplicitParam(name = "number",value = "用户编号",dataType = "string") @RequestMapping(value = "/notices/{number}", method = RequestMethod.GET) public R inNotice(@PathVariable("number") String number) { - Map data = new HashMap<>(); + Map data = new HashMap<>(); + Map notices=new HashMap<>(); + List> noticeList=new ArrayList<>(); //根据学年学期来确定grade String schoolYear = DateUtil.getSchoolYear(); Integer schoolSemester = DateUtil.getSchoolSemester(); @@ -107,12 +109,17 @@ public class NoticeController { continue; } Map noticeInfo = new LinkedHashMap<>(); + noticeInfo.put("id",notice.getId()); noticeInfo.put("title", notice.getTitle()); noticeInfo.put("content", notice.getContent()); noticeInfo.put("create_time", notice.getCreateTime()); - data.put(notice.getTitle(), noticeInfo); + notices.put(notice.getTitle(),noticeInfo); } } + for(Map.Entry entry:notices.entrySet()){ + noticeList.add((Map) entry.getValue()); + } + data.put("noticeList",noticeList); if (data.size()==0){ return R.error("查无数据!"); } @@ -143,8 +150,10 @@ public class NoticeController { noticeInfo.put("title", notice.getTitle()); noticeInfo.put("content", notice.getContent()); noticeInfo.put("create_time", notice.getCreateTime()); - data.put(notice.getTitle(), noticeInfo); + notices.put(notice.getId(),noticeInfo); } + noticeList.add(notices); + data.put("noticeList",noticeList); if (data.size()==0){ return R.error("查无数据!"); } -- Gitee