Procházet zdrojové kódy

添加住校男女生,走读男女生

DESKTOP-USV654P\pc před 1 rokem
rodič
revize
e7627ddde2

+ 25 - 8
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -76,7 +76,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
                 new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getTeacherId, teacherId)
         );
 
-        if(classList != null && !classList.isEmpty()){
+        if (classList != null && !classList.isEmpty()) {
             dto.setTeacherId(teacherId);
         }
 
@@ -86,22 +86,39 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         BaseStudentInfoPageDataVo result = new BaseStudentInfoPageDataVo();
         for (BaseStudentInfoCategoryVo categoryVo : genderCount) {
             totalCount = totalCount + categoryVo.getNumber();
-            if("男".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))){
+            if ("男".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
                 result.setMaleCount(categoryVo.getNumber());
-            }else if("女".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))){
+            } else if ("女".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
                 result.setFemaleCount(categoryVo.getNumber());
             }
         }
         result.setTotalCount(totalCount);
         List<BaseStudentInfoCategoryVo> studyStatusCount = baseStudentSchoolRollMapper.getStudyStatusCount(dto);
+        int stayCount = 0;
+        int notStayCount = 0;
         for (BaseStudentInfoCategoryVo categoryVo : studyStatusCount) {
-            if(StudyStatusEnum.InResidence.getCode().equals(categoryVo.getCategory())){
-                result.setStayCount(categoryVo.getNumber());
-            }else if(StudyStatusEnum.AttendDaySchool.getCode().equals(categoryVo.getCategory())){
-                result.setNotStayCount(categoryVo.getNumber());
+            if (StudyStatusEnum.InResidence.getCode().equals(categoryVo.getCategory())) {
+                stayCount = stayCount + categoryVo.getNumber();
+
+                if ("男".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
+                    result.setMaleStayCount(categoryVo.getNumber());
+                } else if ("女".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
+                    result.setFemaleStayCount(categoryVo.getNumber());
+                }
+
+            } else if (StudyStatusEnum.AttendDaySchool.getCode().equals(categoryVo.getCategory())) {
+                notStayCount = notStayCount + categoryVo.getNumber();
+
+                if ("男".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
+                    result.setMaleNotStayCount(categoryVo.getNumber());
+                } else if ("女".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))) {
+                    result.setFemaleNotStayCount(categoryVo.getNumber());
+                }
             }
         }
-        
+        result.setStayCount(stayCount);
+        result.setNotStayCount(notStayCount);
+
         return result;
     }
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentInfoCategoryVo.java

@@ -21,4 +21,7 @@ public class BaseStudentInfoCategoryVo {
     @ApiModelProperty("数量")
     private Integer number;
 
+    @ApiModelProperty("性别")
+    private String gender;
+
 }

+ 16 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentInfoPageDataVo.java

@@ -29,8 +29,24 @@ public class BaseStudentInfoPageDataVo {
     @ApiModelProperty("住校数量")
     private Integer stayCount;
 
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("住校男生人数")
+    private Integer maleStayCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("住校女生人数")
+    private Integer femaleStayCount;
+
     @ContentStyle(dataFormat = 49)
     @ApiModelProperty("走读数量")
     private Integer notStayCount;
 
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("走读男生人数")
+    private Integer maleNotStayCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("走读女生人数")
+    private Integer femaleNotStayCount;
+
 }

+ 2 - 2
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -120,7 +120,7 @@
         group by t2.gender
     </select>
     <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
-        SELECT t3.stduy_status as category,COUNT(*) as number FROM base_student t1
+        SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender FROM base_student t1
         INNER JOIN xjr_user t2 ON t1.user_id = t2.id
         INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
         LEFT JOIN base_class t4 ON t3.class_id = t4.id
@@ -150,6 +150,6 @@
             or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
             )
         </if>
-        group by t3.stduy_status
+        group by t3.stduy_status,t2.gender
     </select>
 </mapper>