Parcourir la source

更新床位查询接口

liu il y a 1 an
Parent
commit
26b19fd478

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

@@ -32,7 +32,7 @@ public interface WelcomeBedControllerAPI {
 
     @GetMapping(value = "/queryPageBeds")
     @ApiOperation(value = "床位信息分页数据", notes = "床位信息分页数据", httpMethod = "GET")
-    CommonResult queryPageBeds(@RequestParam int currentPage, @RequestParam int pageCount, Integer schoolId,Integer buildId,Integer dormitoryId,String sex, Integer isCheck,Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState);
+    CommonResult queryPageBeds(@RequestParam int currentPage, @RequestParam int pageCount, Integer schoolId,Integer buildId,Integer dormitoryId,String sex, Integer isCheck,Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,Integer accountId);
 
     @GetMapping(value = "/deleteBedInfo")
     @ApiOperation(value = "删除床位信息", notes = "删除床位信息", httpMethod = "GET")

+ 18 - 2
src/main/java/com/template/controller/WelcomeBedController.java

@@ -69,6 +69,9 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
     @Autowired
     private WelcomeSchoolService welcomeSchoolService;
 
+    @Autowired
+    private WelcomeAccountService welcomeAccountService;
+
     @Override
     public CommonResult insertBedInfo(InsertWelcomeBedRequest iwbr, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
@@ -196,8 +199,21 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
     }
 
     @Override
-    public CommonResult queryPageBeds(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState) {
-        PageUtils<WelcomeBed> result = welcomeBedService.queryPageWelcomeBeds(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
+    public CommonResult queryPageBeds(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer isCheck, Integer collegeId, Integer majorId, Integer classstrId,Integer retentionState,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.queryPageWelcomeBedsC(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeIds, majorId, classstrId,retentionState);
+        }else {
+           result = welcomeBedService.queryPageWelcomeBeds(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, isCheck, collegeId, majorId, classstrId,retentionState);
+        }
+
         return CommonResult.ok(result);
     }
 

+ 1 - 1
src/main/java/com/template/controller/WelcomeDormitoryController.java

@@ -83,7 +83,7 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
         }
 
         WelcomeDormitory existCount = welcomeDormitoryService.queryExistDormotory(welcomeDormitory.getSchoolId(), welcomeDormitory.getBuildId(), welcomeDormitory.getDormitory());
-        if (existCount != null && existCount.getId().intValue() != welcomeDormitory.getId().intValue()) {
+        if (existCount != null) {
             return CommonResult.ok("当前寝室号已存在");
         }
 

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

@@ -79,4 +79,6 @@ public interface WelcomeBedService extends IService<WelcomeBed> {
     List<WelcomeBed> hDormitoryGroup(Integer schoolId, Integer buildId, Integer collegeId, Integer majorId, Integer classstrid, String sex);
 
     List<WelcomeBed> hBedGroup(Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId, Integer majorId, Integer classstrid, String sex);
+
+    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);
 }

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

@@ -365,6 +365,24 @@ public class WelcomeBedServiceImpl extends ServiceImpl<WelcomeBedMapper, Welcome
     }
 
     @Override
+    public 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) {
+        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.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);
+        queryWrapper.orderByDesc("create_time");
+        IPage<WelcomeBed> result = welcomeBedMapper.selectPage(page, queryWrapper);
+        return new PageUtils<>(result);
+    }
+
+    @Override
     public List<WelcomeBed> collegeBedGroup(Integer schoolId, Integer buildId, Integer dormitoryId, Integer collegeId) {
         LambdaQueryWrapper<WelcomeBed> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(WelcomeBed::getSchoolId, schoolId)