Kaynağa Gözat

教材领取情况统计中领取状况检索

phoenix 1 yıl önce
ebeveyn
işleme
623b297eb8

+ 1 - 1
src/main/java/com/xjrsoft/module/textbook/dto/TeacherCheckByStuDto.java

@@ -26,7 +26,7 @@ public class TeacherCheckByStuDto extends PageInput {
     @ApiModelProperty(value = "班级编号")
     private List<Long> classIdList;
     /**
-     * 领取情况(1=全部数据,2=该教材全部领取,3=该教材部分未领取)
+     * 领取情况(1=全部数据,2=该学生教材全部领取,3=该学生教材部分未领取)
      */
     @ApiModelProperty("领取情况")
     private Integer claimStatus;

+ 0 - 1
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookStudentClaimServiceImpl.java

@@ -173,7 +173,6 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
             List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimMapper.getTextbookClaimVOList(t.getStudentUserId());
             t.setTextbookClaimVOList(textbookClaimVOList);
         }
-
         return teacherCheckByStuVoList;
     }
 

+ 10 - 5
src/main/resources/mapper/textbook/TextbookStudentClaimMapper.xml

@@ -61,7 +61,7 @@
                  LEFT JOIN base_student t2 ON (t2.user_id = t.student_user_id)
                  LEFT JOIN xjr_user t3 ON (t3.id = t.student_user_id)
         WHERE t.delete_mark = 0
-            and t.class_id = #{dto.classId} and  t.textbook_id = #{dto.textbookId}
+            and t.class_id = #{dto.classId} and  t.textbook_id = #{dto.textbookId} and
         ORDER BY t.is_claim
     </select>
 
@@ -73,17 +73,22 @@
         t1.student_id as studentId
         FROM xjr_user t
         LEFT JOIN base_student t1 ON (t1.user_id = t.id)
-        where t.id in (SELECT student_user_id
-        FROM textbook_student_claim
+        where t.id in (SELECT distinct student_user_id
+        FROM textbook_student_claim t
         WHERE delete_mark = 0
+        <if test="dto.claimStatus != null and dto.claimStatus == 3">
+            and (select count(*) from textbook_student_claim where is_claim = 1 and student_user_id = t.student_user_id) != (select count(*) from textbook_student_claim where student_user_id = t.student_user_id)
+        </if>
+        <if test="dto.claimStatus != null and dto.claimStatus == 2">
+            and (select count(*) from textbook_student_claim where is_claim = 1 and student_user_id = t.student_user_id) = (select count(*) from textbook_student_claim where student_user_id = t.student_user_id)
+        </if>
         <if test="dto.classIdList != null and dto.classIdList.size() > 0">
             and class_id in
             <foreach item="classId" index="index" collection="dto.classIdList" open="(" close=")"
                      separator=",">
                 #{classId}
             </foreach>
-        </if>
-        GROUP BY student_user_id)
+        </if>)
         <if test="dto.studentUserId != null and dto.studentUserId != 0 and dto.studentUserId != ''">
             and t.id = #{dto.studentUserId}
         </if>