jinxia.mo пре 1 месец
родитељ
комит
14436f0d31

+ 0 - 1
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontNewsController.java

@@ -106,7 +106,6 @@ public class FrontNewsController extends BaseController {
     @Anonymous
     public TableDataInfo getSystemNotice(SysNotice notice) {
         startPage();
-        notice.setStatus("0");
         List<SysNotice> list = noticeService.selectNoticeList(notice);
         return getDataTable(list);
     }

+ 4 - 3
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontSyMajorRelationController.java

@@ -79,6 +79,7 @@ public class FrontSyMajorRelationController extends BaseController {
 
     @GetMapping("getMajorOverviewByCode")
     @ApiOperation("02 根据三级专业编码获取专业概况")
+    @Anonymous
     public AjaxResult getMajorOverviewByCode(@RequestParam(required = true) String code) {
         code = StringUtils.getNumeric(code);//过滤字母
         String examTypeData = ConstantUtil.getExamTypeData(VistorContextHolder.getExamType().title());
@@ -89,7 +90,7 @@ public class FrontSyMajorRelationController extends BaseController {
         //是否收藏
         SyMajor syMajor = syMajorService.selectSyMajorByCode(code);
         Boolean isCollect = false;
-        if(null!=syMajor){
+        if (null!=syMajor&&SecurityUtils.hasLoginUser()){
             syMajorOverview.setMarjorId(syMajor.getId());
             BCustomerMarjors query = new BCustomerMarjors().setStatus(1).setMarjorId(syMajor.getId()).setCustomerCode(SecurityUtils.getLoginUser().getUser().getCode());
             if(CollectionUtils.isNotEmpty(customerMarjorsService.selectBCustomerMarjorsList(query))){
@@ -263,10 +264,10 @@ public class FrontSyMajorRelationController extends BaseController {
      */
     @GetMapping("getMajorByName")
     @ApiOperation("00 获取专业及子结构 适用于二级与三级")
+    @Anonymous
     public AjaxResult getMajorByName(@ApiParam("专业名称") @RequestParam String name, @ApiParam("type") @RequestParam(required = false) String type, @ApiParam("层级") @RequestParam Integer level,
                                      Integer batch) {
         SyMajor query = new SyMajor().setName(name);
-        SysUser user = SecurityUtils.getLoginUser().getUser();
         if(StringUtils.isNotBlank(type)) {
             if("高职本科".equals(type)) {
                 query.setType("职教本科");
@@ -276,7 +277,7 @@ public class FrontSyMajorRelationController extends BaseController {
         } else if(null != batch) {
             query.setType(batch >= 4 ? "专科" : "本科");
         }
-        String examTypeData = ConstantUtil.getExamTypeData(user.getExamType().title());
+        String examTypeData = ConstantUtil.getExamTypeData(VistorContextHolder.getExamType().title());
         query.setExamType(examTypeData);
         List<SyMajor> majorList = syMajorService.selectSyMajorList(query).stream().filter(major->major.getLevel()>level).collect(Collectors.toList());
         List<TreeSelectVocational> resultList = new ArrayList<>();

+ 19 - 6
ie-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java

@@ -15,7 +15,7 @@ import com.ruoyi.common.exception.ServiceException;
 
 /**
  * 安全服务工具类
- * 
+ *
  * @author ruoyi
  */
 public class SecurityUtils
@@ -81,6 +81,19 @@ public class SecurityUtils
         }
     }
 
+    public static Boolean hasLoginUser()
+    {
+        try
+        {
+            LoginUser loginUser = (LoginUser) getAuthentication().getPrincipal();
+            return true;
+        }
+        catch (Exception e)
+        {
+            return false;
+        }
+    }
+
     /**
      * 获取Authentication
      */
@@ -126,7 +139,7 @@ public class SecurityUtils
 
     /**
      * 是否为管理员
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
@@ -137,7 +150,7 @@ public class SecurityUtils
 
     /**
      * 验证用户是否具备某权限
-     * 
+     *
      * @param permission 权限字符串
      * @return 用户是否具备某权限
      */
@@ -148,7 +161,7 @@ public class SecurityUtils
 
     /**
      * 判断是否包含权限
-     * 
+     *
      * @param authorities 权限列表
      * @param permission 权限字符串
      * @return 用户是否具备某权限
@@ -161,7 +174,7 @@ public class SecurityUtils
 
     /**
      * 验证用户是否拥有某个角色
-     * 
+     *
      * @param role 角色标识
      * @return 用户是否具备某角色
      */
@@ -174,7 +187,7 @@ public class SecurityUtils
 
     /**
      * 判断是否包含角色
-     * 
+     *
      * @param roles 角色列表
      * @param role 角色
      * @return 用户是否具备某角色权限

+ 16 - 13
ie-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper">
-    
+
     <resultMap type="SysNotice" id="SysNoticeResult">
         <result property="noticeId"       column="notice_id"       />
         <result property="noticeTitle"    column="notice_title"    />
@@ -16,17 +16,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"     column="update_time"     />
         <result property="remark"         column="remark"          />
     </resultMap>
-    
+
     <sql id="selectNoticeVo">
-        select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark 
+        select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
 		from sys_notice
     </sql>
-    
+
     <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
         <include refid="selectNoticeVo"/>
         where notice_id = #{noticeId}
     </select>
-    
+
     <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
         <include refid="selectNoticeVo"/>
         <where>
@@ -36,12 +36,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="noticeType != null and noticeType != ''">
 				AND notice_type = #{noticeType}
 			</if>
+			<if test="status != null and status != ''">
+				AND status = #{status}
+			</if>
 			<if test="createBy != null and createBy != ''">
 				AND create_by like concat('%', #{createBy}, '%')
 			</if>
 		</where>
     </select>
-    
+
     <insert id="insertNotice" parameterType="SysNotice">
         insert into sys_notice (
 			<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
@@ -61,9 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			sysdate()
 		)
     </insert>
-	 
+
     <update id="updateNotice" parameterType="SysNotice">
-        update sys_notice 
+        update sys_notice
         <set>
             <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
             <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
@@ -74,16 +77,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </set>
         where notice_id = #{noticeId}
     </update>
-	
+
     <delete id="deleteNoticeById" parameterType="Long">
         delete from sys_notice where notice_id = #{noticeId}
     </delete>
-    
+
     <delete id="deleteNoticeByIds" parameterType="Long">
-        delete from sys_notice where notice_id in 
+        delete from sys_notice where notice_id in
         <foreach item="noticeId" collection="array" open="(" separator="," close=")">
             #{noticeId}
         </foreach>
     </delete>
-    
-</mapper>
+
+</mapper>