liu 1 year ago
parent
commit
0b226ce34b

+ 2 - 2
src/main/java/com/template/api/WelcomeBedControllerAPI.java

@@ -96,11 +96,11 @@ public interface WelcomeBedControllerAPI {
 
 
     @GetMapping(value = "/studentAccommodationPage")
     @GetMapping(value = "/studentAccommodationPage")
     @ApiOperation(value = "学生住宿分页展示", notes = "学生住宿分页展示", httpMethod = "GET")
     @ApiOperation(value = "学生住宿分页展示", notes = "学生住宿分页展示", httpMethod = "GET")
-    CommonResult studentAccommodationPage(@RequestParam int currentPage, @RequestParam int pageCount,Integer schoolId,Integer buildId,Integer dormitoryId,Integer collegeId,Integer majorId, Integer classstrId,String name);
+    CommonResult studentAccommodationPage(@RequestParam int currentPage, @RequestParam int pageCount,Integer schoolId,Integer buildId,Integer dormitoryId,Integer collegeId,Integer majorId, Integer classstrId,String name,Integer accountId);
 
 
     @GetMapping(value = "/studentAccommodationListExport")
     @GetMapping(value = "/studentAccommodationListExport")
     @ApiOperation(value = "导出学生住宿信息", notes = "导出学生住宿信息", httpMethod = "GET")
     @ApiOperation(value = "导出学生住宿信息", notes = "导出学生住宿信息", httpMethod = "GET")
-    void studentAccommodationListExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,Integer collegeId,Integer majorId, Integer classstrId,String name);
+    void studentAccommodationListExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,Integer collegeId,Integer majorId, Integer classstrId,String name,Integer accountId);
 
 
     @GetMapping(value = "/changeBuildGroup")
     @GetMapping(value = "/changeBuildGroup")
     @ApiOperation(value = "换床楼栋分组", notes = "学院寝室分组", httpMethod = "GET")
     @ApiOperation(value = "换床楼栋分组", notes = "学院寝室分组", httpMethod = "GET")

+ 27 - 4
src/main/java/com/template/controller/WelcomeBedController.java

@@ -1069,16 +1069,39 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
     }
     }
 
 
     @Override
     @Override
-    public CommonResult studentAccommodationPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name) {
+    public CommonResult studentAccommodationPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name,Integer accountId) {
         //        当学院为空
         //        当学院为空
-        PageUtils<WelcomeBed> result = welcomeBedService.studentAccommodationPage(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
+        PageUtils<WelcomeBed> result=null;
+        if (ObjectUtils.isEmpty(collegeId)) {
+            String collegeIds = "";
+            WelcomeAccount account = welcomeAccountService.getById(accountId);
+            if (ObjectUtils.isEmpty(account)) {
+                return CommonResult.fail("当前账号不存在,请重新登入");
+            }
+            collegeIds = account.getCollegeId();
+            result = welcomeBedService.studentAccommodationPageS(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeIds, majorId, classstrId,name);
+        }else {
+            result = welcomeBedService.studentAccommodationPage(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
+        }
         return CommonResult.ok(result);
         return CommonResult.ok(result);
     }
     }
 
 
     @Override
     @Override
-    public void studentAccommodationListExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name) {
+    public void studentAccommodationListExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrId, String name,Integer accountId) {
         //        当学院为空
         //        当学院为空
-        List<WelcomeBed> result = welcomeBedService.studentAccommodationList( schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
+        List<WelcomeBed> result=null;
+        if (ObjectUtils.isEmpty(collegeId)) {
+            String collegeIds = "";
+            WelcomeAccount account = welcomeAccountService.getById(accountId);
+            if (ObjectUtils.isEmpty(account)) {
+                throw new RuntimeException("当前账号不存在,请重新登入");
+            }
+            collegeIds = account.getCollegeId();
+            result =welcomeBedService.studentAccommodationListS( schoolId, buildId, dormitoryId,collegeIds, majorId, classstrId,name);
+        }else {
+            result = welcomeBedService.studentAccommodationList( schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,name);
+        }
+
 
 
         //导出
         //导出
         Workbook workbook = new XSSFWorkbook();
         Workbook workbook = new XSSFWorkbook();

+ 4 - 3
src/main/java/com/template/controller/WelcomeDormitoryController.java

@@ -14,6 +14,7 @@ import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.BatchOperationVo;
 import com.template.model.vo.BatchOperationVo;
 import com.template.model.vo.ChangeBuildGroupVo;
 import com.template.model.vo.ChangeBuildGroupVo;
+import com.template.model.vo.SaveBedDormitoryGroupVo;
 import com.template.model.vo.WelcomeDormitoryVo;
 import com.template.model.vo.WelcomeDormitoryVo;
 import com.template.services.*;
 import com.template.services.*;
 import org.apache.poi.hssf.record.chart.FontIndexRecord;
 import org.apache.poi.hssf.record.chart.FontIndexRecord;
@@ -744,11 +745,11 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
         }
         }
         String collegeIds = account.getCollegeId();
         String collegeIds = account.getCollegeId();
         List<WelcomeDormitory> dormitories = welcomeDormitoryService.saveBedDormitoryGroup(schoolId,collegeIds);
         List<WelcomeDormitory> dormitories = welcomeDormitoryService.saveBedDormitoryGroup(schoolId,collegeIds);
-        ArrayList<ChangeBuildGroupVo> vos = new ArrayList<>();
+        ArrayList<SaveBedDormitoryGroupVo> vos = new ArrayList<>();
         for (WelcomeDormitory welcomeDormitory : dormitories) {
         for (WelcomeDormitory welcomeDormitory : dormitories) {
-            ChangeBuildGroupVo vo = new ChangeBuildGroupVo();
+            SaveBedDormitoryGroupVo vo = new SaveBedDormitoryGroupVo();
             vo.setBuild(welcomeDormitory.getBuild());
             vo.setBuild(welcomeDormitory.getBuild());
-            vo.setBuildId(welcomeDormitory.getBuildId());
+            vo.setId(welcomeDormitory.getBuildId());
             vos.add(vo);
             vos.add(vo);
         }
         }
         return CommonResult.ok(vos);
         return CommonResult.ok(vos);

+ 9 - 0
src/main/java/com/template/model/vo/SaveBedDormitoryGroupVo.java

@@ -0,0 +1,9 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+@Data
+public class SaveBedDormitoryGroupVo {
+    private Integer id;
+    private String build;
+}

+ 3 - 0
src/main/java/com/template/services/WelcomeBedService.java

@@ -82,7 +82,10 @@ public interface WelcomeBedService extends IService<WelcomeBed> {
 
 
     PageUtils<WelcomeBed> queryPageWelcomeBedsC(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, String collegeIds, Integer majorId, Integer classstrId, Integer retentionState);
     PageUtils<WelcomeBed> queryPageWelcomeBedsC(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, String collegeIds, Integer majorId, Integer classstrId, Integer retentionState);
 
 
+
     List<WelcomeBed> queryPageWelcomeBedsS(Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, String collegeIds, Integer majorId, Integer classstrId, Integer retentionState);
     List<WelcomeBed> queryPageWelcomeBedsS(Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, String collegeIds, Integer majorId, Integer classstrId, Integer retentionState);
 
 
+    PageUtils<WelcomeBed> studentAccommodationPageS(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String collegeIds, Integer majorId, Integer classstrId, String name);
 
 
+    List<WelcomeBed> studentAccommodationListS(Integer schoolId, Integer buildId, Integer dormitoryId, String collegeIds, Integer majorId, Integer classstrId, String name);
 }
 }

+ 32 - 0
src/main/java/com/template/services/impl/WelcomeBedServiceImpl.java

@@ -398,6 +398,38 @@ public class WelcomeBedServiceImpl extends ServiceImpl<WelcomeBedMapper, Welcome
         return result;
         return result;
     }
     }
 
 
+    @Override
+    public PageUtils<WelcomeBed> studentAccommodationPageS(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String collegeIds, Integer majorId, Integer classstrId, String name) {
+        Page<WelcomeBed> page = new Page<>(currentPage, pageCount);
+        QueryWrapper<WelcomeBed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(schoolId != null, "school_id", schoolId);
+        queryWrapper.eq(buildId != null, "build_id", buildId);
+        queryWrapper.eq(dormitoryId != null, "dormitory_id", dormitoryId);
+        queryWrapper.in("college_id", collegeIds);
+        queryWrapper.eq(majorId != null, "major_id", majorId);
+        queryWrapper.eq(classstrId != null, "classstr_id", classstrId);
+        queryWrapper.like(name != null, "name", name);
+        queryWrapper.eq( "is_check", 1);
+        queryWrapper.orderByDesc("create_time");
+        IPage<WelcomeBed> result = welcomeBedMapper.selectPage(page, queryWrapper);
+        return new PageUtils<>(result);
+    }
+
+    @Override
+    public List<WelcomeBed> studentAccommodationListS(Integer schoolId, Integer buildId, Integer dormitoryId, String collegeIds, Integer majorId, Integer classstrId, String name) {
+        QueryWrapper<WelcomeBed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(schoolId != null, "school_id", schoolId);
+        queryWrapper.eq(buildId != null, "build_id", buildId);
+        queryWrapper.eq(dormitoryId != null, "dormitory_id", dormitoryId);
+        queryWrapper.in( "college_id", collegeIds);
+        queryWrapper.eq(majorId != null, "major_id", majorId);
+        queryWrapper.eq(classstrId != null, "classstr_id", classstrId);
+        queryWrapper.like(name != null, "name", name);
+        queryWrapper.eq( "is_check", 1);
+        queryWrapper.orderByDesc("create_time");
+        List<WelcomeBed> result = welcomeBedMapper.selectList(queryWrapper);
+        return result;
+    }
 
 
 
 
     @Override
     @Override