Bladeren bron

学生信息修改,详情接口增加

dzx 1 jaar geleden
bovenliggende
commit
343d389609

+ 8 - 0
src/main/java/com/xjrsoft/module/room/mapper/RoomBedMapper.java

@@ -18,6 +18,7 @@ import com.xjrsoft.module.room.vo.DistributeResultListVo;
 import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
 import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
 import com.xjrsoft.module.room.vo.RoomBedExcelVo;
+import com.xjrsoft.module.room.vo.RoomBedInfoVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomBedVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -121,4 +122,11 @@ public interface RoomBedMapper extends MPJBaseMapper<RoomBed> {
 
     /* 查询分配床位班级列表的各个人数 - 结束 */
 
+    /**
+     * 根据用户id查询床位信息
+     * @param id
+     * @return
+     */
+    RoomBedInfoVo getBedInfoByUserId(Long id);
+
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/room/service/IRoomBedService.java

@@ -96,4 +96,6 @@ public interface IRoomBedService extends MPJBaseService<RoomBed> {
 
     Boolean adjustBed(AdjustStudentBedDto dto);
 
+
+
 }

+ 28 - 0
src/main/java/com/xjrsoft/module/room/vo/RoomBedInfoVo.java

@@ -0,0 +1,28 @@
+package com.xjrsoft.module.room.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 寝室床位表单出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class RoomBedInfoVo {
+
+    @ApiModelProperty("主键编号")
+    private Long id;
+
+    @ApiModelProperty("楼栋名称")
+    private String buildName;
+
+    @ApiModelProperty("寝室名称")
+    private String roomName;
+
+    @ApiModelProperty("床位号")
+    private Integer bedNumber;
+
+
+}

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

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -8,6 +9,7 @@ import com.xjrsoft.common.page.PageOutput;
 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.BaseStudentInfoPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
@@ -52,5 +55,16 @@ public class BaseStudentInfoController {
         return RT.ok(baseStudentSchoolRollService.updateInfo(dto));
     }
 
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询详情信息")
+    @SaCheckPermission("room:detail")
+    public RT<BaseStudentInfoDetailVo> info(@RequestParam Long id){
+        BaseStudentInfoDetailVo detailVo = baseStudentSchoolRollService.getInfoById(id);
+        if (detailVo == null) {
+            return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(detailVo, BaseStudentInfoDetailVo.class));
+    }
+
 
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentInfoPageDto.java

@@ -32,4 +32,10 @@ public class BaseStudentInfoPageDto extends PageInput {
      */
     @ApiModelProperty("班级id")
     private Long classId;
+
+    /**
+     * 关键字
+     */
+    @ApiModelProperty("关键字")
+    private String keyWord;
 }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -18,5 +19,7 @@ public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSc
 
     Page<BaseStudentInfoPageVo> getMobilePage(Page<BaseStudentInfoPageVo> page, BaseStudentInfoPageDto dto);
 
+    BaseStudentInfoDetailVo getInfoById(Long id);
+
 }
 

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

@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.module.room.entity.RoomBed;
+import com.xjrsoft.module.room.mapper.RoomBedMapper;
+import com.xjrsoft.module.room.vo.RoomBedInfoVo;
 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.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -23,6 +26,7 @@ import org.springframework.stereotype.Service;
 public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStudentSchoolRollMapper, BaseStudentSchoolRoll> implements IBaseStudentSchoolRollService {
 
     private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
+    private final RoomBedMapper roomBedMapper;
 
     @Override
     public Page<BaseStudentInfoPageVo> getMobilePage(Page<BaseStudentInfoPageVo> page, BaseStudentInfoPageDto dto) {
@@ -42,4 +46,16 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         }
         return true;
     }
+
+    @Override
+    public BaseStudentInfoDetailVo getInfoById(Long id) {
+        BaseStudentInfoDetailVo info = baseStudentSchoolRollMapper.getInfoById(id);
+        if("FB3002".equals(info.getStduyStatus())){
+            RoomBedInfoVo bedInfoByUserId = roomBedMapper.getBedInfoByUserId(info.getId());
+            if(bedInfoByUserId != null){
+                info.setBedInfo(bedInfoByUserId.getBuildName() + " " + bedInfoByUserId.getRoomName() + " " + bedInfoByUserId.getBedNumber());
+            }
+        }
+        return info;
+    }
 }

+ 13 - 1
src/main/java/com/xjrsoft/module/student/service/impl/IBaseStudentSchoolRollService.java

@@ -6,6 +6,7 @@ import com.xjrsoft.module.room.dto.RoomPageDto;
 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.BaseStudentInfoPageVo;
 
 /**
@@ -19,6 +20,17 @@ public interface IBaseStudentSchoolRollService extends MPJBaseService<BaseStuden
 
     Page<BaseStudentInfoPageVo> getMobilePage(Page<BaseStudentInfoPageVo> page, BaseStudentInfoPageDto dto);
 
-
+    /**
+     * 移动端查询学生信息列表
+     * @param dto
+     * @return
+     */
     Boolean updateInfo(UpdateBaseStudentInfoDto dto);
+
+    /**
+     * 移动端查询学生详情信息
+     * @param id
+     * @return
+     */
+    BaseStudentInfoDetailVo getInfoById(Long id);
 }

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

@@ -0,0 +1,66 @@
+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 BaseStudentInfoDetailVo {
+
+
+    @ApiModelProperty("主键编号")
+    private Long id;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学生姓名")
+    private String studentName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("学号")
+    private String studentId;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("本人电话")
+    private String phone;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("监护人电话")
+    private String guardianPhone;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班主任名称")
+    private String teacherName;
+
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    /**
+     * 学习形式
+     */
+    @ApiModelProperty("学习形式")
+    private String rollModality;
+    /**
+     * 学籍状态(xjr_dictionary_item[archives_status])
+     */
+    @ApiModelProperty("学籍状态(xjr_dictionary_item[archives_status])")
+    private String archivesStatus;
+    /**
+     * 就读方式(xjr_dictionary_item[stduy_status])
+     */
+    @ApiModelProperty("就读方式(xjr_dictionary_item[stduy_status])")
+    private String stduyStatus;
+
+    @ApiModelProperty("床位信息")
+    private String bedInfo;
+}

+ 7 - 0
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -381,5 +381,12 @@
             SELECT student_user_id FROM room_bed WHERE delete_mark = 0 AND student_user_id IS NOT NULL
         )
     </select>
+    <select id="getBedInfoByUserId" resultType="com.xjrsoft.module.room.vo.RoomBedInfoVo">
+        SELECT t3.name,t2.room_name,t1.bed_number,t1.id FROM room_bed t1
+        LEFT JOIN room t2 ON t1.room_id = t2.id
+        LEFT JOIN base_office_build t3 ON t2.office_build_id = t4.id
+        WHERE t4.build_type = 'FB3604'
+        AND t1.student_user_id = #{id}
+    </select>
 
 </mapper>

+ 28 - 3
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -4,15 +4,40 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper">
     <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
-        SELECT t2.id,t2.name AS student_name,t1.student_id,t2.mobile AS phone,t5.name AS teacher_name,t4.name AS class_name,
+        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 mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t2.id AND is_guardian = 1) AS guardian_phone 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
         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.keyWord != null and dto.keyWord != ''">
+            and (t4.name like concat('%', #{keyWord}, '%')
+            or t2.name like concat('%', #{keyWord}, '%')
+            or t5.teacher_name like concat('%', #{keyWord}, '%')
+            or t2.student_id like concat('%', #{keyWord}, '%')
+            or t2.mobile like concat('%', #{keyWord}, '%')
+            or (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t2.id AND is_guardian = 1 and mobile like concat('%', #{keyWord}, '%'))
+            )
+        </if>
     </select>
-    <!--姓名和性别,测试阶段采用姓名第一个字拼接user_id的方式脱敏-->
-    <select id="getJianyueStudentList" resultType="com.xjrsoft.module.schedule.vo.StudentJianyuekbVo">
+    <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 mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t2.id AND is_guardian = 1) AS guardian_phone,
+        t3.archives_status,t3.stduy_status,t3.roll_modality 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
+        WHERE t2.id = #{id}
     </select>
 </mapper>