浏览代码

我的消息

change 3 年之前
父节点
当前提交
ebd4060cb4

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -2,6 +2,7 @@ package com.zhongzheng.modules.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordAddBo;

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordMapper;

+ 45 - 49
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -440,61 +440,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectStudyRecord" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultType="Long">
         SELECT
-            COUNT( 1 )
+        COUNT( 1 )
         FROM
-            user_study_record usr
+        user_period up
+        LEFT JOIN user_period_status ups on up.id = ups.period_id
         WHERE
-            1 =1
-          AND usr.record_id != #{recordId}
+        1 =1
         <choose>
             <when test="chapterId != null and chapterId !=''">
-                AND usr.chapter_id = #{chapterId}
+                AND up.chapter_id = #{chapterId}
             </when>
             <otherwise>
-                AND usr.chapter_id = 0
+                AND up.chapter_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="sectionId != null and sectionId !=''">
-                AND usr.section_id = #{sectionId}
+                AND up.section_id = #{sectionId}
             </when>
             <otherwise>
-                AND usr.section_id = 0
+                AND up.section_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="moduleId != null and moduleId !=''">
-                AND usr.module_id = #{moduleId}
+                AND up.module_id = #{moduleId}
             </when>
             <otherwise>
-                AND usr.module_id = 0
+                AND up.module_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="courseId != null and courseId !=''">
-                AND usr.course_id = #{courseId}
+                AND up.course_id = #{courseId}
             </when>
             <otherwise>
-                AND usr.course_id = 0
+                AND up.course_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="gradeId != null and gradeId !=''">
-                AND usr.grade_id = #{gradeId}
+                AND up.grade_id = #{gradeId}
             </when>
             <otherwise>
-                AND usr.grade_id = 0
+                AND up.grade_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="goodsId != null and goodsId !=''">
-                AND usr.goods_id = #{gradeId}
+                AND up.goods_id = #{goodsId}
             </when>
             <otherwise>
-                AND usr.goods_id = 0
+                AND up.goods_id = 0
             </otherwise>
         </choose>
-          AND usr.user_id = #{userId}
+          AND up.user_id = #{userId}
     </select>
 
     <select id="selectPeriod" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultType="Long">
@@ -507,72 +507,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     1 =1
     <choose>
         <when test="chapterId != null and chapterId !=''">
-            AND usr.chapter_id = #{chapterId}
+            AND up.chapter_id = #{chapterId}
         </when>
         <otherwise>
-            AND usr.chapter_id = 0
+            AND up.chapter_id = 0
         </otherwise>
     </choose>
     <choose>
         <when test="sectionId != null and sectionId !=''">
-            AND usr.section_id = #{sectionId}
+            AND up.section_id = #{sectionId}
         </when>
         <otherwise>
-            AND usr.section_id = 0
+            AND up.section_id = 0
         </otherwise>
     </choose>
     <choose>
         <when test="moduleId != null and moduleId !=''">
-            AND usr.module_id = #{moduleId}
+            AND up.module_id = #{moduleId}
         </when>
         <otherwise>
-            AND usr.module_id = 0
+            AND up.module_id = 0
         </otherwise>
     </choose>
     <choose>
         <when test="courseId != null and courseId !=''">
-            AND usr.course_id = #{courseId}
+            AND up.course_id = #{courseId}
         </when>
         <otherwise>
-            AND usr.course_id = 0
+            AND up.course_id = 0
         </otherwise>
     </choose>
     <choose>
         <when test="gradeId != null and gradeId !=''">
-            AND usr.grade_id = #{gradeId}
+            AND up.grade_id = #{gradeId}
         </when>
         <otherwise>
-            AND usr.grade_id = 0
+            AND up.grade_id = 0
         </otherwise>
     </choose>
     <choose>
         <when test="goodsId != null and goodsId !=''">
-            AND usr.goods_id = #{gradeId}
+            AND up.goods_id = #{goodsId}
         </when>
         <otherwise>
-            AND usr.goods_id = 0
+            AND up.goods_id = 0
         </otherwise>
     </choose>
-    AND usr.user_id = #{userId}
+    AND up.user_id = #{userId}
     AND ups.period_status = 1
     AND ups.`status` =2
     AND ups.record_end_time is NOT NULL
     </select>
 
-    <resultMap type="com.zhongzheng.modules.grade.vo.UserPeriodStatusVo" id="UserPeriodStatusVo">
+    <resultMap type="com.zhongzheng.modules.grade.domain.UserPeriodStatus" id="UserPeriodStatus">
         <result property="status" column="status"/>
         <result property="recordStartTime" column="record_start_time"/>
         <result property="recordEndTime" column="record_end_time"/>
         <result property="id" column="id"/>
         <result property="periodId" column="period_id"/>
         <result property="periodStatus" column="period_status"/>
-        <result property="auditTime" column="audit_time"/>
-        <result property="type" column="type"/>
-        <result property="typeName" column="type_name"/>
-        <result property="realName" column="realname"/>
     </resultMap>
 
-    <select id="selectPeriodCount" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultMap="UserPeriodStatusVo">
+    <select id="selectPeriodCount" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultMap="UserPeriodStatus">
         SELECT
         ups.*
         FROM
@@ -582,53 +578,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         1 =1
         <choose>
             <when test="chapterId != null and chapterId !=''">
-                AND usr.chapter_id = #{chapterId}
+                AND up.chapter_id = #{chapterId}
             </when>
             <otherwise>
-                AND usr.chapter_id = 0
+                AND up.chapter_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="sectionId != null and sectionId !=''">
-                AND usr.section_id = #{sectionId}
+                AND up.section_id = #{sectionId}
             </when>
             <otherwise>
-                AND usr.section_id = 0
+                AND up.section_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="moduleId != null and moduleId !=''">
-                AND usr.module_id = #{moduleId}
+                AND up.module_id = #{moduleId}
             </when>
             <otherwise>
-                AND usr.module_id = 0
+                AND up.module_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="courseId != null and courseId !=''">
-                AND usr.course_id = #{courseId}
+                AND up.course_id = #{courseId}
             </when>
             <otherwise>
-                AND usr.course_id = 0
+                AND up.course_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="gradeId != null and gradeId !=''">
-                AND usr.grade_id = #{gradeId}
+                AND up.grade_id = #{gradeId}
             </when>
             <otherwise>
-                AND usr.grade_id = 0
+                AND up.grade_id = 0
             </otherwise>
         </choose>
         <choose>
             <when test="goodsId != null and goodsId !=''">
-                AND usr.goods_id = #{gradeId}
+                AND up.goods_id = #{goodsId}
             </when>
             <otherwise>
-                AND usr.goods_id = 0
+                AND up.goods_id = 0
             </otherwise>
         </choose>
-        AND usr.user_id = #{userId}
+        AND up.user_id = #{userId}
         AND ups.period_status = 1
     </select>
 </mapper>