瀏覽代碼

1、用户添加和修改,性别字段调整
2、移动端学生修改,增加统计接口
3、移动端学生修改,将班主任电话和班主任手机号拆分成2个字段

dzx 1 年之前
父節點
當前提交
e65d82a5ef

+ 1 - 2
src/main/java/com/xjrsoft/module/organization/dto/AddUserDto.java

@@ -50,8 +50,7 @@ public class AddUserDto implements Serializable {
 
     @ApiModelProperty("性别")
     @NotNull(message = "性别必须选择")
-    @Range(min = -1,max = 2,message = "性别参数不正确!")
-    private Integer gender = -1;
+    private String gender;
 
     @ApiModelProperty("手机号")
     @NotNull(message = "手机不能为空")

+ 1 - 2
src/main/java/com/xjrsoft/module/organization/dto/UpdateUserDto.java

@@ -48,8 +48,7 @@ public class UpdateUserDto implements Serializable {
 
     @ApiModelProperty("性别")
     @NotNull(message = "性别必须选择")
-    @Range(min = -1,max = 2,message = "性别参数不正确!")
-    private Integer gender = -1;
+    private String gender;
 
     @ApiModelProperty("手机号")
     @NotNull(message = "手机不能为空")

+ 9 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentInfoController.java

@@ -10,6 +10,7 @@ import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
 import com.xjrsoft.module.student.service.impl.IBaseStudentSchoolRollService;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
+import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -47,6 +48,14 @@ public class BaseStudentInfoController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/mobile-page-statistics")
+    @ApiOperation(value="学生列表人数统计")
+    @SaCheckPermission("basestudentpost:detail")
+    public RT<BaseStudentInfoPageDataVo> mobilePageStatistics(@Valid BaseStudentInfoPageDto dto){
+        BaseStudentInfoPageDataVo result = baseStudentSchoolRollService.getMobilePageStatistics(dto);
+        return RT.ok(result);
+    }
+
 
     @PutMapping
     @ApiOperation(value = "修改学生职务设置")

+ 18 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentSchoolRollMapper.java

@@ -5,12 +5,16 @@ import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
+import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+
 /**
  * @title: mapper
  * @Author 管理员
@@ -26,5 +30,19 @@ public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSc
 
     Boolean updateInfoByUserId(UpdateBaseStudentInfoDto dto, Long id);
 
+    /**
+     * 根据性别统计学生人数
+     * @param dto
+     * @return
+     */
+    List<BaseStudentInfoCategoryVo> getGenderCount(BaseStudentInfoPageDto dto);
+
+    /**
+     * 根据就读方式统计学生人数
+     * @param dto
+     * @return
+     */
+    List<BaseStudentInfoCategoryVo> getStudyStatusCount(BaseStudentInfoPageDto dto);
+
 }
 

+ 30 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -4,6 +4,8 @@ import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
+import com.xjrsoft.common.enums.StudyStatusEnum;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
 import com.xjrsoft.module.room.mapper.RoomBedMapper;
@@ -12,7 +14,9 @@ import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
+import com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
+import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -64,4 +68,30 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         }
         return info;
     }
+
+    @Override
+    public BaseStudentInfoPageDataVo getMobilePageStatistics(BaseStudentInfoPageDto dto) {
+        List<BaseStudentInfoCategoryVo> genderCount = baseStudentSchoolRollMapper.getGenderCount(dto);
+        int totalCount = 0;
+
+        BaseStudentInfoPageDataVo result = new BaseStudentInfoPageDataVo();
+        for (BaseStudentInfoCategoryVo categoryVo : genderCount) {
+            totalCount = totalCount + categoryVo.getNumber();
+            if("男".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))){
+                result.setMaleCount(categoryVo.getNumber());
+            }else if("女".equals(GenderDictionaryEnum.getValue(categoryVo.getCategory()))){
+                result.setFemaleCount(categoryVo.getNumber());
+            }
+        }
+        List<BaseStudentInfoCategoryVo> studyStatusCount = baseStudentSchoolRollMapper.getStudyStatusCount(dto);
+        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());
+            }
+        }
+        
+        return result;
+    }
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/student/service/impl/IBaseStudentSchoolRollService.java

@@ -7,6 +7,7 @@ import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
+import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 
 /**
@@ -33,4 +34,11 @@ public interface IBaseStudentSchoolRollService extends MPJBaseService<BaseStuden
      * @return
      */
     BaseStudentInfoDetailVo getInfoById(Long id);
+
+    /**
+     * 统计学生信息
+     * @param dto
+     * @return
+     */
+    BaseStudentInfoPageDataVo getMobilePageStatistics(BaseStudentInfoPageDto dto);
 }

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

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 移动端学生修改信息列表
+* @Author dzx
+* @Date: 2024年2月26日
+* @Version 1.0
+*/
+@Data
+public class BaseStudentInfoCategoryVo {
+
+
+    @ApiModelProperty("查询分类")
+    private String category;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("数量")
+    private Integer number;
+
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentInfoDetailVo.java

@@ -43,6 +43,10 @@ public class BaseStudentInfoDetailVo {
     @ApiModelProperty("班主任名称")
     private String teacherName;
 
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班主任电话")
+    private String teacherPhone;
+
     @ContentStyle(dataFormat = 49)
     @ApiModelProperty("班级名称")
     private String className;

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

@@ -0,0 +1,36 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 移动端学生修改信息列表
+* @Author dzx
+* @Date: 2024年2月26日
+* @Version 1.0
+*/
+@Data
+public class BaseStudentInfoPageDataVo {
+
+
+    @ApiModelProperty("总人数")
+    private Integer totalCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("男生人数")
+    private Integer maleCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("女生人数")
+    private Integer femaleCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("住校数量")
+    private Integer stayCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("走读数量")
+    private Integer notStayCount;
+
+}

+ 66 - 1
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -42,7 +42,7 @@
         </if>
     </select>
     <select id="getInfoById" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
-        SELECT t2.id,t2.name AS student_name,t1.student_id,t2.mobile AS phone,CONCAT(t5.name, ' ', t5.mobile) AS teacher_name,t4.name AS class_name,
+        SELECT t2.id,t2.name AS student_name,t1.student_id,t2.mobile AS phone,t5.name as teacher_name, t5.mobile AS teacher_phone,t4.name AS class_name,
         (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t2.id AND is_guardian = 1) AS guardian_phone,
         t8.name AS archives_status,t7.name AS stduy_status,t9.name AS roll_modality,t2.birth_date, t2.gender,t2.avatar,
         t6.name AS nation,t10.name AS major_set_name,t3.archives_status as archivesStatusCode,t3.stduy_status as stduyStatusCode,t3.roll_modality as rollModalityCode
@@ -65,4 +65,69 @@
         <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
         where user_id = #{id}
     </update>
+
+    <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
+        SELECT t2.gender as category,COUNT(*) as number 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
+        LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
+        LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
+        WHERE t2.delete_mark = 0
+        AND t1.delete_mark = 0
+        <if test="dto.gradeId != null">
+            and t4.grade_id = #{dto.gradeId}
+        </if>
+        <if test="dto.majorSetId != null">
+            and t3.major_set_id = #{dto.majorSetId}
+        </if>
+        <if test="dto.classId != null">
+            and t4.id = #{dto.classId}
+        </if>
+        <if test="dto.teacherId != null">
+            and t4.teacher_id = #{dto.teacherId}
+        </if>
+        <if test="dto.keyWord != null and dto.keyWord != ''">
+            and (t4.name like concat('%', #{dto.keyWord}, '%')
+            or t2.name like concat('%', #{dto.keyWord}, '%')
+            or t5.name like concat('%', #{dto.keyWord}, '%')
+            or t1.student_id like concat('%', #{dto.keyWord}, '%')
+            or t2.mobile like concat('%', #{dto.keyWord}, '%')
+            or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
+            )
+        </if>
+        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
+        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
+        LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
+        LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
+        WHERE t2.delete_mark = 0
+        AND t1.delete_mark = 0
+        <if test="dto.gradeId != null">
+            and t4.grade_id = #{dto.gradeId}
+        </if>
+        <if test="dto.majorSetId != null">
+            and t3.major_set_id = #{dto.majorSetId}
+        </if>
+        <if test="dto.classId != null">
+            and t4.id = #{dto.classId}
+        </if>
+        <if test="dto.teacherId != null">
+            and t4.teacher_id = #{dto.teacherId}
+        </if>
+        <if test="dto.keyWord != null and dto.keyWord != ''">
+            and (t4.name like concat('%', #{dto.keyWord}, '%')
+            or t2.name like concat('%', #{dto.keyWord}, '%')
+            or t5.name like concat('%', #{dto.keyWord}, '%')
+            or t1.student_id like concat('%', #{dto.keyWord}, '%')
+            or t2.mobile like concat('%', #{dto.keyWord}, '%')
+            or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
+            )
+        </if>
+        group by t3.stduy_status
+    </select>
 </mapper>