Forráskód Böngészése

收藏限制到人,刷题限制到学生类型

mingfu 4 hete
szülő
commit
c67e8dd1d7

+ 9 - 0
ie-admin/src/main/java/com/ruoyi/web/service/ExamService.java

@@ -6,10 +6,12 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.enums.UserRegStatus;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.enums.ExamineeStatus;
 import com.ruoyi.enums.PaperStatus;
 import com.ruoyi.enums.PaperType;
+import com.ruoyi.enums.UserTypeEnum;
 import com.ruoyi.ie.domain.AMarjorPlan;
 import com.ruoyi.ie.service.IAMarjorPlanService;
 import com.ruoyi.learn.domain.*;
@@ -71,9 +73,16 @@ public class ExamService {
      */
     @Transactional(rollbackFor = Exception.class)
     public AnswerSheet openExaminee(boolean directed, PaperType paperType, Long relatedId) {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
         if(paperTypeSet.contains(paperType)) {
+            if(UserTypeEnum.isCard(user.getUserType()) && !UserRegStatus.Student.equals(user.getRegStatus())) {
+                throw new RuntimeException("VIP功能不可用");
+            }
             return openExaminee(paperType, relatedId, SecurityUtils.getUserId());
         } else if(PaperType.Practice.equals(paperType)) {
+            if(UserTypeEnum.isCard(user.getUserType()) && !UserRegStatus.Student.equals(user.getRegStatus())) {
+                throw new RuntimeException("VIP功能不可用");
+            }
             return openExaminee(relatedId, SecurityUtils.getUserId(), getDirectedKey(directed));
         } else if(PaperType.Simulated.equals(paperType)) {
             SysUser exist = sysUserService.selectUserById(SecurityUtils.getUserId());

+ 4 - 1
ie-system/src/main/resources/mapper/learn/LearnPaperMapper.xml

@@ -141,7 +141,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectPapersListFromFavorites" parameterType="LearnPaper" resultMap="LearnPaperResult">
         select p.*,0 readNum from b_customer_favorites f
         left join learn_paper p on f.refId = p.id
-        where f.type = 'paper' and f.customercode = #{examineeId} and f.course = #{subjectId} <if test="collect "> and f.status = 1</if>
+        <where> f.type = 'paper' and f.customercode = #{examineeId}
+            <if test="subjectId != null and subjectId > 0"> and f.course = #{subjectId} </if>
+             <if test="collect "> and f.status = 1</if>
+        </where>
     </select>
 
 

+ 5 - 1
ie-system/src/main/resources/mapper/learn/LearnQuestionsMapper.xml

@@ -326,7 +326,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select q.* from mxjb_question_collection c
         left join learn_questions q on c.question_id = q.id
         left join dz_subject s on q.subjectId = s.subject_id
-        <if test="subjectId != null "> and q.subjectId = #{subjectId}  = #{subjectId}</if>
+        <where>
+            <if test="userId != null "> and c.user_id = #{userId}</if>
+            <if test="subjectId != null and subjectId > 0 "> and q.subjectId = #{subjectId}</if>
+        </where>
+
     </select>
 
     <select id="selectCollectInfo"  parameterType="java.util.HashMap" resultMap="LearnQuestionsResult">