Sfoglia il codice sorgente

获取在校人数

夏文涛 2 anni fa
parent
commit
d767d5ca47

+ 10 - 0
src/main/java/com/template/controller/SmartSchoolController.java

@@ -9,6 +9,7 @@ import com.template.model.request.UpdateSmartSchoolRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartSchoolService;
+import com.template.services.SmartUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 
@@ -30,6 +31,9 @@ public class SmartSchoolController implements SmartSchoolControllerAPI {
     @Autowired
     private SmartSchoolService smartSchoolService;
 
+    @Autowired
+    private SmartUserService smartUserService;
+
     /**
      * 新增学校基本信息
      *
@@ -93,7 +97,13 @@ public class SmartSchoolController implements SmartSchoolControllerAPI {
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult querySmartSchool() {
+
+        int studentCount = smartUserService.queryStudentCount();
+
         SmartSchool result = smartSchoolService.getSmartSchool();
+        result.setStudentCount(studentCount);
+
+        smartSchoolService.updateSmartSchool(result);
 
         return CommonResult.ok(result);
     }

+ 0 - 2
src/main/java/com/template/controller/SmartSemesterController.java

@@ -542,7 +542,5 @@ public class SmartSemesterController implements SmartSemesterControllerAPI {
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
     }
 
-
-
 }
 

+ 5 - 0
src/main/java/com/template/model/pojo/SmartSchool.java

@@ -17,6 +17,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 
 /**
  * <p>
@@ -58,6 +59,10 @@ public class SmartSchool implements Serializable {
     @NotBlank(message = "公众号名称不能为空")
     private String officialName;
 
+    @ApiModelProperty(value = "在校人数")
+    @NotNull(message = "在校人数不能为空")
+    private Integer studentCount;
+
     @ApiModelProperty(value = "APPID")
     @NotBlank(message = "APPID不能为空")
     private String appid;

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

@@ -141,4 +141,6 @@ public interface SmartUserService extends IService<SmartUser> {
     List<StudentSelectVo> studentSelect(String keyWord);
 
     List<SmartUser> querySmartParentByIds(List<Integer> studentIds);
+
+    int queryStudentCount();
 }

+ 8 - 0
src/main/java/com/template/services/impl/SmartUserServiceImpl.java

@@ -368,5 +368,13 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
         return result;
     }
 
+    @Override
+    public int queryStudentCount() {
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("identity_id", eIdentityStatu.Student.getValue());
+        int result = smartUserMapper.selectCount(queryWrapper);
+        return result;
+    }
+
 
 }