Browse Source

新增校园新闻

Administrator 2 years ago
parent
commit
aa3abe1403

+ 8 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XiaoyuanNoticeController.java

@@ -37,7 +37,7 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 查询校园新闻列表
      * 查询校园新闻列表
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:list')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:list')")
     @GetMapping("/list")
     @GetMapping("/list")
     public TableDataInfo list(XiaoyuanNotice xiaoyuanNotice)
     public TableDataInfo list(XiaoyuanNotice xiaoyuanNotice)
     {
     {
@@ -49,7 +49,7 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 导出校园新闻列表
      * 导出校园新闻列表
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:export')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:export')")
     @Log(title = "校园新闻", businessType = BusinessType.EXPORT)
     @Log(title = "校园新闻", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @PostMapping("/export")
     public void export(HttpServletResponse response, XiaoyuanNotice xiaoyuanNotice)
     public void export(HttpServletResponse response, XiaoyuanNotice xiaoyuanNotice)
@@ -62,7 +62,7 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 获取校园新闻详细信息
      * 获取校园新闻详细信息
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:query')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:query')")
     @GetMapping(value = "/{noticeId}")
     @GetMapping(value = "/{noticeId}")
     public AjaxResult getInfo(@PathVariable("noticeId") Integer noticeId)
     public AjaxResult getInfo(@PathVariable("noticeId") Integer noticeId)
     {
     {
@@ -72,7 +72,7 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 新增校园新闻
      * 新增校园新闻
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:add')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:add')")
     @Log(title = "校园新闻", businessType = BusinessType.INSERT)
     @Log(title = "校园新闻", businessType = BusinessType.INSERT)
     @PostMapping
     @PostMapping
     public AjaxResult add(@RequestBody XiaoyuanNotice xiaoyuanNotice)
     public AjaxResult add(@RequestBody XiaoyuanNotice xiaoyuanNotice)
@@ -83,9 +83,9 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 修改校园新闻
      * 修改校园新闻
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:edit')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:edit')")
     @Log(title = "校园新闻", businessType = BusinessType.UPDATE)
     @Log(title = "校园新闻", businessType = BusinessType.UPDATE)
-    @PutMapping
+    @PostMapping("/put")
     public AjaxResult edit(@RequestBody XiaoyuanNotice xiaoyuanNotice)
     public AjaxResult edit(@RequestBody XiaoyuanNotice xiaoyuanNotice)
     {
     {
         return toAjax(xiaoyuanNoticeService.updateXiaoyuanNotice(xiaoyuanNotice));
         return toAjax(xiaoyuanNoticeService.updateXiaoyuanNotice(xiaoyuanNotice));
@@ -94,9 +94,9 @@ public class XiaoyuanNoticeController extends BaseController
     /**
     /**
      * 删除校园新闻
      * 删除校园新闻
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:remove')")
+    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:remove')")
     @Log(title = "校园新闻", businessType = BusinessType.DELETE)
     @Log(title = "校园新闻", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{noticeIds}")
+	@GetMapping("/delete/{noticeIds}")
     public AjaxResult remove(@PathVariable Integer[] noticeIds)
     public AjaxResult remove(@PathVariable Integer[] noticeIds)
     {
     {
         return toAjax(xiaoyuanNoticeService.deleteXiaoyuanNoticeByNoticeIds(noticeIds));
         return toAjax(xiaoyuanNoticeService.deleteXiaoyuanNoticeByNoticeIds(noticeIds));

+ 7 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XiaoyuanNoticeServiceImpl.java

@@ -5,7 +5,9 @@ import java.util.Set;
 
 
 import com.ruoyi.common.core.domain.entity.FormalParentsStudent;
 import com.ruoyi.common.core.domain.entity.FormalParentsStudent;
 import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
 import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.ServletUtils;
@@ -54,12 +56,12 @@ public class XiaoyuanNoticeServiceImpl implements IXiaoyuanNoticeService {
      */
      */
     @Override
     @Override
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice) {
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice) {
-        SysUser user = SecurityUtils.getLoginUser().getUser();
+        SysUser user = SecurityUtils.getLoginUser().getUser().;
         xiaoyuanNotice.setSenderId(user.getUserId().toString());
         xiaoyuanNotice.setSenderId(user.getUserId().toString());
-        Set<String> permissions = SecurityUtils.getLoginUser().getPermissions();
+        List<SysRole> roles = user.getRoles();
         String classId = "";
         String classId = "";
-        for (String permission : permissions) {
-            if ("teacher".equals(permission)) {
+        for (SysRole role : roles) {
+            if ("teacher".equals(role.getRoleKey())) {
                 FormalTeacherClass formalTeacherClass = new FormalTeacherClass();
                 FormalTeacherClass formalTeacherClass = new FormalTeacherClass();
                 formalTeacherClass.setTeacherId(user.getUserId());
                 formalTeacherClass.setTeacherId(user.getUserId());
                 List<FormalTeacherClass> formalTeacherClasses = formalTeacherClassMapper.selectFormalTeacherClassList(formalTeacherClass);
                 List<FormalTeacherClass> formalTeacherClasses = formalTeacherClassMapper.selectFormalTeacherClassList(formalTeacherClass);
@@ -69,7 +71,7 @@ public class XiaoyuanNoticeServiceImpl implements IXiaoyuanNoticeService {
                     }
                     }
                 }
                 }
             }
             }
-            if ("parents".equals(permission)){
+            if ("parents".equals(role.getRoleKey())){
                 FormalParentsStudent formalParentsStudent = new FormalParentsStudent();
                 FormalParentsStudent formalParentsStudent = new FormalParentsStudent();
                 formalParentsStudent.setParentsId(user.getUserId());
                 formalParentsStudent.setParentsId(user.getUserId());
                 List<FormalParentsStudent> formalParentsStudents = formalParentsStudentMapper.selectFormalParentsStudentList(formalParentsStudent);
                 List<FormalParentsStudent> formalParentsStudents = formalParentsStudentMapper.selectFormalParentsStudentList(formalParentsStudent);