yangdamao 2 years ago
parent
commit
f12ee9b1aa

+ 10 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -63,6 +63,16 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询班级
+     */
+    @ApiOperation("查询班级")
+    @GetMapping("/class/{gradeId}")
+    public AjaxResult<ClassGradeVo> getClassGradeVo(@PathVariable("gradeId")Long gradeId) {
+        ClassGradeVo vo = iClassGradeService.getClassGradeVo(gradeId);
+        return AjaxResult.success(vo);
+    }
+
     /**
      * 获取班级详细信息
      */

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeService.java

@@ -91,4 +91,6 @@ public interface IClassGradeService extends IService<ClassGrade> {
 	List<ClassGradeVo> queryGradeList(ClassGradeQueryBo bo);
 
 	boolean gradeChangeEjjjPeople(Long businessId,Long gradeId);
+
+	ClassGradeVo getClassGradeVo(Long gradeId);
 }

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -31,6 +31,7 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
 import com.zhongzheng.modules.grade.domain.ClassGradeSys;
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
 import com.zhongzheng.modules.grade.service.IClassGradeSysService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
@@ -891,6 +892,23 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         return true;
     }
 
+    @Override
+    public ClassGradeVo getClassGradeVo(Long gradeId) {
+        ClassGrade gradeVo = getById(gradeId);
+        if (ObjectUtils.isNull(gradeVo)){
+            return null;
+        }
+        ClassGradeVo vo = BeanUtil.toBean(gradeVo, ClassGradeVo.class);
+        //班级人数
+        Integer count = iClassGradeUserService.count(new LambdaQueryWrapper<ClassGradeUser>()
+                .eq(ClassGradeUser::getGradeId, gradeId)
+                .eq(ClassGradeUser::getStatus, 1));
+        vo.setStudentNum(count);
+        //获取班级总人数
+        vo.setStudentNumAll(getClassUserNumAll(gradeId));
+        return vo;
+    }
+
 
     /**
      * 实体类转化成视图对象