Administrator 2 жил өмнө
parent
commit
c2cfe018a5

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

@@ -49,10 +49,10 @@ public class XiaoyuanNoticeController extends BaseController
     /**
      * 我的校园新闻列表
      */
-    @PreAuthorize("@ss.hasPermi('xiaoYuan:notice:myList')")
     @GetMapping("/myList")
     public TableDataInfo myList(XiaoyuanNotice xiaoyuanNotice)
     {
+        startPage();
         List<XiaoyuanNotice> list = xiaoyuanNoticeService.selectXiaoyuanNoticeMyList(xiaoyuanNotice);
         return getDataTable(list);
     }

+ 4 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XiaoyuanNoticeServiceImpl.java

@@ -59,7 +59,7 @@ public class XiaoyuanNoticeServiceImpl implements IXiaoyuanNoticeService {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         xiaoyuanNotice.setSenderId(user.getUserId().toString());
         List<SysRole> roles = user.getRoles();
-        String classId = "";
+        String classId = "0,";
         for (SysRole role : roles) {
             if ("teacher".equals(role.getRoleKey())) {
                 FormalTeacherClass formalTeacherClass = new FormalTeacherClass();
@@ -80,8 +80,10 @@ public class XiaoyuanNoticeServiceImpl implements IXiaoyuanNoticeService {
                 }
             }
         }
+        if (StringUtils.isNotBlank(classId)){
+            classId = classId.substring(0, classId.length() - 1);
+        }
         //查询出所有班级id
-        classId = classId.substring(0, classId.length() - 1);
         xiaoyuanNotice.setSenderDept(classId);
         return xiaoyuanNoticeMapper.selectXiaoyuanNoticeList(xiaoyuanNotice);
     }

+ 27 - 26
ruoyi-system/src/main/resources/mapper/system/XiaoyuanNoticeMapper.xml

@@ -1,27 +1,27 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.XiaoyuanNoticeMapper">
-    
+
     <resultMap type="XiaoyuanNotice" id="XiaoyuanNoticeResult">
-        <result property="noticeId"    column="notice_id"    />
-        <result property="image"    column="image"    />
-        <result property="noticeTitle"    column="notice_title"    />
-        <result property="noticeType"    column="notice_type"    />
-        <result property="noticeContent"    column="notice_content"    />
-        <result property="status"    column="status"    />
-        <result property="type"    column="type"    />
-        <result property="senderId"    column="sender_id"    />
-        <result property="senderName"    column="sender_name"    />
-        <result property="senderDept"    column="sender_dept"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="remark"    column="remark"    />
-        <result property="avatar"    column="avatar"    />
-        <result property="schoolName"    column="school_name"    />
+        <result property="noticeId" column="notice_id"/>
+        <result property="image" column="image"/>
+        <result property="noticeTitle" column="notice_title"/>
+        <result property="noticeType" column="notice_type"/>
+        <result property="noticeContent" column="notice_content"/>
+        <result property="status" column="status"/>
+        <result property="type" column="type"/>
+        <result property="senderId" column="sender_id"/>
+        <result property="senderName" column="sender_name"/>
+        <result property="senderDept" column="sender_dept"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+        <result property="avatar" column="avatar"/>
+        <result property="schoolName" column="school_name"/>
     </resultMap>
 
     <sql id="selectXiaoyuanNoticeVo">
@@ -74,7 +74,8 @@ FROM
 	xiaoyuan_notice
 WHERE
 	find_in_set( sender_dept, ${senderDept} )
-	AND type = '1' UNION
+	and type = '1'
+	 UNION
 SELECT
 	notice_id,
 	image,
@@ -99,12 +100,12 @@ WHERE
 	sender_id = ${senderId}
 	AND type = '2'
     </select>
-    
+
     <select id="selectXiaoyuanNoticeByNoticeId" parameterType="Integer" resultMap="XiaoyuanNoticeResult">
         <include refid="selectXiaoyuanNoticeVo"/>
         where notice_id = #{noticeId}
     </select>
-    <select id="selectXiaoyuanNoticeMyList" resultType="com.ruoyi.system.domain.XiaoyuanNotice">
+    <select id="selectXiaoyuanNoticeMyList" resultMap="XiaoyuanNoticeResult">
         <include refid="selectXiaoyuanNoticeVo"/>
         where sender_id = #{senderId}
     </select>
@@ -128,7 +129,7 @@ WHERE
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null">#{image},</if>
             <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
@@ -146,7 +147,7 @@ WHERE
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateXiaoyuanNotice" parameterType="XiaoyuanNotice">
@@ -177,7 +178,7 @@ WHERE
     </delete>
 
     <delete id="deleteXiaoyuanNoticeByNoticeIds" parameterType="String">
-        delete from xiaoyuan_notice where notice_id in 
+        delete from xiaoyuan_notice where notice_id in
         <foreach item="noticeId" collection="array" open="(" separator="," close=")">
             #{noticeId}
         </foreach>