liu 1 год назад
Родитель
Сommit
140d6133ef

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

@@ -48,7 +48,7 @@ public interface WelcomeBedControllerAPI {
 
 
     @GetMapping(value = "welcomeBedExport")
     @GetMapping(value = "welcomeBedExport")
     @ApiOperation(value = "导出床位信息数据", notes = "导出床位信息数据", httpMethod = "GET")
     @ApiOperation(value = "导出床位信息数据", notes = "导出床位信息数据", httpMethod = "GET")
-    void welcomeBedExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,String sex, Integer isCheck,Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState);
+    void welcomeBedExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,String sex, Integer isCheck,Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,Integer accountId);
 
 
     @PostMapping(value = "/submit")
     @PostMapping(value = "/submit")
     @ApiOperation(value = "提交床位信息", notes = "提交床位信息", httpMethod = "POST")
     @ApiOperation(value = "提交床位信息", notes = "提交床位信息", httpMethod = "POST")
@@ -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")

+ 1 - 1
src/main/java/com/template/api/WelcomeDormitoryControllerAPI.java

@@ -56,7 +56,7 @@ public interface WelcomeDormitoryControllerAPI {
 
 
     @GetMapping(value = "welcomeDormitoryExport")
     @GetMapping(value = "welcomeDormitoryExport")
     @ApiOperation(value = "导出寝室信息数据", notes = "导出寝室信息数据", httpMethod = "GET")
     @ApiOperation(value = "导出寝室信息数据", notes = "导出寝室信息数据", httpMethod = "GET")
-    void welcomeDormitoryExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,String sex,Integer collegeId,Integer status,Integer retentionState);
+    void welcomeDormitoryExport(HttpServletResponse response, Integer schoolId,Integer buildId,Integer dormitoryId,String sex,Integer collegeId,Integer status,Integer retentionState,Integer accountId);
 
 
     @PostMapping(value = "/batchOperation")
     @PostMapping(value = "/batchOperation")
     @ApiOperation(value = "批量操作", notes = "批量操作", httpMethod = "POST")
     @ApiOperation(value = "批量操作", notes = "批量操作", httpMethod = "POST")

+ 46 - 7
src/main/java/com/template/controller/WelcomeBedController.java

@@ -218,7 +218,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
             String collegeIds = "";
             String collegeIds = "";
             WelcomeAccount account = welcomeAccountService.getById(accountId);
             WelcomeAccount account = welcomeAccountService.getById(accountId);
             if (ObjectUtils.isEmpty(account)) {
             if (ObjectUtils.isEmpty(account)) {
-                return CommonResult.fail("当前账号已被删除,请重新登入");
+                return CommonResult.fail("当前账号不存在,请重新登入");
             }
             }
             collegeIds = account.getCollegeId();
             collegeIds = account.getCollegeId();
             result = welcomeBedService.queryPageWelcomeBedsC(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
             result = welcomeBedService.queryPageWelcomeBedsC(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
@@ -661,8 +661,22 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
     }
     }
 
 
     @Override
     @Override
-    public void welcomeBedExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState) {
-        List<WelcomeBed> result = welcomeBedService.queryPageWelcomeBeds(schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
+    public void welcomeBedExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,Integer accountId) {
+        //        当学院为空
+        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.queryPageWelcomeBedsS(schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
+        }else {
+            result = welcomeBedService.queryPageWelcomeBeds(schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
+        }
+
+
 
 
         //导出
         //导出
         Workbook workbook = new XSSFWorkbook();
         Workbook workbook = new XSSFWorkbook();
@@ -1055,14 +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) {
-        PageUtils<WelcomeBed> result = welcomeBedService.studentAccommodationPage(currentPage, pageCount, schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,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=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) {
-        List<WelcomeBed> result=welcomeBedService.studentAccommodationList( schoolId, buildId, dormitoryId,collegeId, majorId, classstrId,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=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();

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

@@ -13,6 +13,7 @@ import com.template.model.pojo.*;
 import com.template.model.result.CommonResult;
 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.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;
@@ -646,8 +647,21 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
     }
     }
 
 
     @Override
     @Override
-    public void welcomeDormitoryExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer collegeId, Integer status, Integer retentionState) {
-        List<WelcomeDormitoryVo> result = welcomeDormitoryService.listDormitory(schoolId, buildId, dormitoryId, sex, collegeId, status, retentionState);
+    public void welcomeDormitoryExport(HttpServletResponse response, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer collegeId, Integer status, Integer retentionState,Integer accountId) {
+        //        当学院为空
+        List<WelcomeDormitoryVo> result=null;
+        if (ObjectUtils.isEmpty(collegeId)) {
+            String collegeIds="";
+            WelcomeAccount account = welcomeAccountService.getById(accountId);
+            if (ObjectUtils.isEmpty(account)) {
+                throw new RuntimeException("当前账号已被删除,请重新登入");
+            }
+            collegeIds=account.getCollegeId();
+            result = welcomeDormitoryService.listDormitoryS(schoolId, buildId, dormitoryId, sex, collegeIds, status, retentionState);
+        }else {
+            result = welcomeDormitoryService.listDormitory(schoolId, buildId, dormitoryId, sex, collegeId, status, retentionState);
+        }
+
         //导出
         //导出
         Workbook workbook = new XSSFWorkbook();
         Workbook workbook = new XSSFWorkbook();
         Sheet sheet = workbook.createSheet("宿舍信息");
         Sheet sheet = workbook.createSheet("宿舍信息");
@@ -730,8 +744,14 @@ 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);
-
-        return CommonResult.ok(dormitories);
+        ArrayList<ChangeBuildGroupVo> vos = new ArrayList<>();
+        for (WelcomeDormitory welcomeDormitory : dormitories) {
+            ChangeBuildGroupVo vo = new ChangeBuildGroupVo();
+            vo.setBuild(welcomeDormitory.getBuild());
+            vo.setBuildId(welcomeDormitory.getBuildId());
+            vos.add(vo);
+        }
+        return CommonResult.ok(vos);
     }
     }
 }
 }
 
 

+ 4 - 0
src/main/java/com/template/mapper/WelcomeDormitoryMapper.java

@@ -38,4 +38,8 @@ public interface WelcomeDormitoryMapper extends BaseMapper<WelcomeDormitory> {
                                                 @Param("dormitoryId") Integer dormitoryId, @Param("sex") String sex, @Param("collegeIds") String collegeIds,
                                                 @Param("dormitoryId") Integer dormitoryId, @Param("sex") String sex, @Param("collegeIds") String collegeIds,
                                                 @Param("status") Integer status,@Param("retentionState") Integer retentionState);
                                                 @Param("status") Integer status,@Param("retentionState") Integer retentionState);
 
 
+    List<WelcomeDormitoryVo> listDormitoryS(@Param("schoolId") Integer schoolId, @Param("buildId") Integer buildId,
+                                            @Param("dormitoryId") Integer dormitoryId, @Param("sex") String sex, @Param("collegeIds") String collegeIds,
+                                            @Param("status") Integer status,@Param("retentionState") Integer retentionState);
+
 }
 }

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

@@ -83,4 +83,9 @@ 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);
+
+    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);
 }
 }

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

@@ -44,4 +44,7 @@ public interface WelcomeDormitoryService extends IService<WelcomeDormitory> {
     PageUtils<WelcomeDormitoryVo> listDormitoryCPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, String collegeIds, Integer status, Integer retentionState);
     PageUtils<WelcomeDormitoryVo> listDormitoryCPage(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, String collegeIds, Integer status, Integer retentionState);
 
 
     List<WelcomeDormitory> saveBedDormitoryGroup(Integer schoolId, String collegeIds);
     List<WelcomeDormitory> saveBedDormitoryGroup(Integer schoolId, String collegeIds);
+
+    List<WelcomeDormitoryVo> listDormitoryS(Integer schoolId, Integer buildId, Integer dormitoryId, String sex, String collegeIds, Integer status, Integer retentionState);
+
 }
 }

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

@@ -382,6 +382,55 @@ public class WelcomeBedServiceImpl extends ServiceImpl<WelcomeBedMapper, Welcome
         return new PageUtils<>(result);
         return new PageUtils<>(result);
     }
     }
 
 
+    @Override
+    public List<WelcomeBed> queryPageWelcomeBedsS(Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, String collegeIds, Integer majorId, Integer classstrId, Integer retentionState) {
+        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.eq(StringUtils.hasText(sex), "sex", sex);
+        queryWrapper.eq(isCheck != null, "is_check", isCheck);
+        queryWrapper.in( "college_id", collegeIds);
+        queryWrapper.eq(majorId != null, "major_id", majorId);
+        queryWrapper.eq(classstrId != null, "classstr_id", classstrId);
+        queryWrapper.eq(retentionState != null, "retention_state", retentionState);
+        List<WelcomeBed> result = welcomeBedMapper.selectList(queryWrapper);
+        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
     public List<WelcomeBed> collegeBedGroup(Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId) {
     public List<WelcomeBed> collegeBedGroup(Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId) {

+ 6 - 0
src/main/java/com/template/services/impl/WelcomeDormitoryServiceImpl.java

@@ -135,4 +135,10 @@ public class WelcomeDormitoryServiceImpl extends ServiceImpl<WelcomeDormitoryMap
         List<WelcomeDormitory> result = welcomeDormitoryMapper.selectList(queryWrapper);
         List<WelcomeDormitory> result = welcomeDormitoryMapper.selectList(queryWrapper);
         return result;
         return result;
     }
     }
+
+    @Override
+    public List<WelcomeDormitoryVo> listDormitoryS(Integer schoolId, Integer buildId, Integer dormitoryId, String sex, String collegeIds, Integer status, Integer retentionState) {
+        List<WelcomeDormitoryVo> result = welcomeDormitoryMapper.listDormitoryS(schoolId,buildId,dormitoryId,sex,collegeIds,status,retentionState);
+        return result;
+    }
 }
 }

+ 45 - 0
src/main/resources/mapper/template/WelcomeDormitoryMapper.xml

@@ -155,4 +155,49 @@
         AND FIND_IN_SET(wd.college_id,#{collegeIds})
         AND FIND_IN_SET(wd.college_id,#{collegeIds})
         order by wd.create_time desc
         order by wd.create_time desc
     </select>
     </select>
+    <select id="listDormitoryS" resultType="com.template.model.vo.WelcomeDormitoryVo">
+        SELECT
+        wd.id,
+        wd.school_id as schoolId,
+        ws.school,
+        wd.build_id as buildId,
+        wb.build,
+        wd.dormitory,
+        wd.sex,
+        wd.college_id as collegeId,
+        wo.name as college,
+        wd.grade as grade,
+        wd.bed_number as bedNumber,
+        wd.remark,
+        wd.status,
+        wd.free_bed_number as freeBedNumber,
+        wd.retention_state as retentionState
+        FROM
+        `welcome_dormitory` wd
+        LEFT JOIN welcome_school ws ON wd.school_id = ws.id and ws.deleted = 0
+        LEFT JOIN welcome_build wb ON wd.build_id = wb.id and wb.deleted = 0
+        LEFT JOIN welcome_org wo ON wd.college_id = wo.id and wo.deleted = 0
+        WHERE
+        wd.deleted =0
+        <if test="schoolId != null and schoolId != ''">
+            and wd.school_id = #{schoolId}
+        </if>
+        <if test="buildId != null and buildId != ''">
+            and wd.build_id = #{buildId}
+        </if>
+        <if test="dormitoryId != null and dormitoryId != ''">
+            and wd.id = #{dormitoryId}
+        </if>
+        <if test="sex != null and sex != ''">
+            and wd.sex = #{sex}
+        </if>
+        <if test="status != null and status != ''">
+            and wd.status = #{status}
+        </if>
+        <if test="retentionState != null and retentionState != ''">
+            and wd.retention_state = #{retentionState}
+        </if>
+        and FIND_IN_SET(wd.college_id ,#{collegeIds})
+        order by wd.create_time desc
+    </select>
 </mapper>
 </mapper>