Browse Source

分配床位-班级列表

dzx 1 year ago
parent
commit
531bd41fbb

+ 11 - 0
src/main/java/com/xjrsoft/module/room/controller/RoomBedController.java

@@ -9,10 +9,12 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.room.dto.AddRoomBedDto;
+import com.xjrsoft.module.room.dto.RoomBedClassPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
 import com.xjrsoft.module.room.dto.UpdateRoomBedDto;
 import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.room.service.IRoomBedService;
+import com.xjrsoft.module.room.vo.RoomBedClassPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomBedVo;
 import io.swagger.annotations.Api;
@@ -60,6 +62,15 @@ public class RoomBedController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/distribute-class-page")
+    @ApiOperation(value="分配床位班级列表(分页)")
+    @SaCheckPermission("roombedrecord:detail")
+    public RT<PageOutput<RoomBedClassPageVo>> distributeClassPage(@Valid RoomBedClassPageDto dto){
+        Page<RoomBedClassPageVo> page = roomBedService.getClassInfo(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<RoomBedClassPageVo> pageOutput = ConventPage.getPageOutput(page, RoomBedClassPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询寝室床位信息")
     @SaCheckPermission("roombed:detail")

+ 43 - 0
src/main/java/com/xjrsoft/module/room/dto/RoomBedClassPageDto.java

@@ -0,0 +1,43 @@
+package com.xjrsoft.module.room.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 寝室床位分页查询入参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class RoomBedClassPageDto extends PageInput {
+
+    @ApiModelProperty("楼栋id")
+    public Long officeBuildId;
+
+    @ApiModelProperty("楼层")
+    public Integer floorNumber;
+
+
+    @ApiModelProperty("寝室id")
+    public Long roomId;
+
+    @ApiModelProperty("入住性别")
+    public String gender;
+
+    @ApiModelProperty("寝室id")
+    public Long gradeId;
+
+    @ApiModelProperty("年级id")
+    public Long classId;
+
+    @ApiModelProperty("寝室id")
+    public String studentName;
+
+    @ApiModelProperty("学号")
+    public String studentId;
+}

+ 3 - 5
src/main/java/com/xjrsoft/module/room/mapper/RoomBedMapper.java

@@ -1,16 +1,14 @@
 package com.xjrsoft.module.room.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.room.dto.RoomBedClassPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
-import com.xjrsoft.module.room.dto.RoomPageDto;
 import com.xjrsoft.module.room.entity.RoomBed;
+import com.xjrsoft.module.room.vo.RoomBedClassPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import org.apache.ibatis.annotations.Mapper;
 
-import java.util.List;
-
 /**
 * @title: 寝室床位
 * @Author dzx
@@ -33,5 +31,5 @@ public interface RoomBedMapper extends MPJBaseMapper<RoomBed> {
      */
     Page<RoomBedPageVo> getPage(Page<RoomBedPageVo> page, RoomBedPageDto dto);
 
-
+    Page<RoomBedClassPageVo> getClassInfo(Page<RoomBedClassPageVo> page, RoomBedClassPageDto dto);
 }

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

@@ -2,8 +2,10 @@ package com.xjrsoft.module.room.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.room.dto.RoomBedClassPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
 import com.xjrsoft.module.room.entity.RoomBed;
+import com.xjrsoft.module.room.vo.RoomBedClassPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 
 import java.util.List;
@@ -27,4 +29,6 @@ public interface IRoomBedService extends MPJBaseService<RoomBed> {
 
 
     Boolean clearStudentInfo(List<Long> ids);
+
+    Page<RoomBedClassPageVo> getClassInfo(Page<RoomBedClassPageVo> page, RoomBedClassPageDto dto);
 }

+ 7 - 1
src/main/java/com/xjrsoft/module/room/service/impl/RoomBedServiceImpl.java

@@ -1,12 +1,13 @@
 package com.xjrsoft.module.room.service.impl;
 
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.room.dto.RoomBedClassPageDto;
 import com.xjrsoft.module.room.dto.RoomBedPageDto;
 import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.service.IRoomBedService;
+import com.xjrsoft.module.room.vo.RoomBedClassPageVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -38,4 +39,9 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         }
         return true;
     }
+
+    @Override
+    public Page<RoomBedClassPageVo> getClassInfo(Page<RoomBedClassPageVo> page, RoomBedClassPageDto dto) {
+        return roomBedMapper.getClassInfo(page, dto);
+    }
 }

+ 55 - 0
src/main/java/com/xjrsoft/module/room/vo/RoomBedClassPageVo.java

@@ -0,0 +1,55 @@
+package com.xjrsoft.module.room.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 寝室床位分页列表出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class RoomBedClassPageVo {
+
+    /**
+    * 主键编号
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键编号")
+    @ApiModelProperty("主键编号")
+    private String id;
+
+    /**
+     * 楼栋名称
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("年级")
+    @ApiModelProperty("年级")
+    private String gradeName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("专业部")
+    @ApiModelProperty("专业部")
+    private String orgName;
+
+    /**
+     * 班级名称
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("需要住宿人数")
+    @ApiModelProperty("需要住宿人数")
+    private Integer needCount;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("已分配床位数")
+    @ApiModelProperty("已分配床位数")
+    private Integer distributeCount;
+}

+ 6 - 0
src/main/java/com/xjrsoft/module/textbook/vo/TextbookIssueRecordPageVo.java

@@ -36,6 +36,12 @@ public class TextbookIssueRecordPageVo {
     @ApiModelProperty("序号")
     private Integer sortCode;
 
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书号")
+    @ApiModelProperty("书号")
+    private String issn;
+
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("书名")
     @ApiModelProperty("书名")

+ 2 - 2
src/main/java/com/xjrsoft/module/textbook/vo/TextbookWarehouseRecordPageVo.java

@@ -36,8 +36,8 @@ public class TextbookWarehouseRecordPageVo {
      * 来源
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("来源")
-    @ApiModelProperty("来源")
+    @ExcelProperty("书号")
+    @ApiModelProperty("书号")
     private String issn;
 
     /**

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

@@ -42,4 +42,21 @@
     <select id="getMaxSortCode" resultType="java.lang.Integer">
         SELECT IFNULL(MAX(sort_code),0) FROM room_bed WHERE delete_mark = 0
     </select>
+
+    <select id="getClassInfo" parameterType="com.xjrsoft.module.room.dto.RoomBedClassPageDto" resultType="com.xjrsoft.module.room.vo.RoomBedClassPageVo">
+        SELECT t1.id,t2.name AS grade_name,t3.name AS org_name,t1.name AS class_name,
+        (SELECT COUNT(*) FROM base_student c1
+        LEFT JOIN base_student_school_roll c2 ON c1.user_id = c2.user_id
+        LEFT JOIN xjr_dictionary_detail c3 ON c2.stduy_status = c3.code AND c3.item_id = 2023000000000000030
+        WHERE c1.delete_mark = 0 AND c2.delete_mark = 0
+        AND c3.code = 'FB3002' AND c2.class_id = t1.id) AS need_count,(
+        SELECT COUNT(*) FROM room_bed a1
+        LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
+        AND a2.class_id = t1.id
+        ) AS distribute_count FROM base_class t1
+        LEFT JOIN base_grade t2 ON t1.grade_id = t2.id
+        LEFT JOIN xjr_department t3 ON t1.org_id = t3.id
+        WHERE t1.delete_mark = 0
+    </select>
 </mapper>