作者 王兆博

修改我的学校

... ... @@ -3,6 +3,7 @@ package com.example.client.controller;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CBasicInformationStudentBo;
import com.example.client.domain.bo.CPersonalInformationBo;
import com.example.client.domain.bo.MySchoolTypeBO;
import com.example.client.service.MineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
... ... @@ -69,12 +70,12 @@ public class MineController {
}
@ApiImplicitParam(name = "type",value = "学校类型",dataType = "Integer",required = true,paramType = "query")
@ApiOperation("我的学校")
@PostMapping("/openmyschool")
public AjaxResult openMySchool(){
public AjaxResult openMySchool(@RequestBody MySchoolTypeBO mySchoolTypeBO){
return mineService.openMySchool();
return mineService.openMySchool(mySchoolTypeBO);
}
// TODO: 2021/9/15
... ...
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.client.domain.vo.CTeacherVo;
import com.example.client.enumeration.SchoolTypeEnumer;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
... ... @@ -79,6 +80,6 @@ public class CRegisterSchool implements Serializable {
/**
* 学校类型 1-学校 2-培训 3-其他
*/
private Long schoolType;
private SchoolTypeEnumer schoolType;
}
... ...
... ... @@ -2,6 +2,7 @@ package com.example.client.domain.bo;
import cn.bronet.admin.common.annotation.Excel;
import cn.bronet.admin.common.core.domain.BaseEntity;
import com.example.client.enumeration.SchoolTypeEnumer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
... ... @@ -67,7 +68,7 @@ public class CRegisterSchoolBo extends BaseEntity {
* 学校类型 1-学校 2-培训 3-其他
*/
@ApiModelProperty("学校类型 1-学校 2-培训 3-其他")
private Long schoolType;
private SchoolTypeEnumer schoolType;
/**
... ...
package com.example.client.domain.bo;
import com.example.client.enumeration.SchoolTypeEnumer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* Created with IDEA
* author:WangZhaoBo
* Date:2021/9/17
* Time:10:13
*/
@Data
public class MySchoolTypeBO implements Serializable {
/**
* 学校类型 1-学校 2-培训 3-其他
*/
@ApiModelProperty("学校类型 1-(OTHER-学校) 2(TRAIN-培训) 3(SCHOOL-其他)")
private SchoolTypeEnumer schoolType;
}
... ...
package com.example.client.domain.vo;
import cn.bronet.admin.common.annotation.Excel;
import com.example.client.enumeration.SchoolTypeEnumer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
... ... @@ -73,7 +74,7 @@ public class CRegisterSchoolVo {
*/
@Excel(name = "学校类型 1-学校 2-培训 3-其他")
@ApiModelProperty("学校类型 1-学校 2-培训 3-其他")
private Long schoolType;
private SchoolTypeEnumer schoolType;
/**
* 学校的老师
... ...
package com.example.client.enumeration;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Created with IDEA
* author:WangZhaoBo
* Date:2021/9/17
* Time:9:57
*/
public enum SchoolTypeEnumer implements IEnum<Integer> {
/**
* 其他
*/
OTHER(3,"其他"),
/**
* 培训
*/
TRAIN(2,"培训"),
/**
* 学校
*/
SCHOOL(1,"学校") ;
private String descp;
@EnumValue
private int code;
SchoolTypeEnumer(int code, String descp) {
this.code = code;
this.descp = descp;
}
@JsonCreator
public static SchoolTypeEnumer getItem(int code) {
for (SchoolTypeEnumer item : values()) {
if (item.getCode() == code) {
return item;
}
}
return null;
}
@JsonValue
public Integer getCode() {
return code;
}
@Override
public Integer getValue() {
return code;
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.example.client.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CBasicInformationStudentBo;
import com.example.client.domain.bo.CPersonalInformationBo;
import com.example.client.domain.bo.MySchoolTypeBO;
/**
* Created with IDEA
... ... @@ -77,7 +78,7 @@ public interface MineService {
* @param
* @return
*/
AjaxResult openMySchool();
AjaxResult openMySchool(MySchoolTypeBO mySchoolTypeBO);
/**
* 我的班级
... ...
... ... @@ -8,6 +8,7 @@ import com.example.client.domain.bo.CActivityBo;
import com.example.client.domain.vo.*;
import com.example.client.domin.UserContext;
import com.example.client.enumeration.Identity;
import com.example.client.enumeration.SchoolTypeEnumer;
import com.example.client.mapper.*;
import com.example.client.service.ActivityService;
import io.swagger.annotations.ApiImplicitParam;
... ... @@ -104,7 +105,7 @@ public class ActivityServiceImpl extends ServicePlusImpl<CActivityMapper,CActivi
//从数据库中取出所有的学校
LambdaQueryWrapper<CRegisterSchool> rsWrapper = new LambdaQueryWrapper<>();
rsWrapper.eq(CRegisterSchool::getSchoolType,1);
rsWrapper.eq(CRegisterSchool::getSchoolType, SchoolTypeEnumer.SCHOOL);
List<CRegisterSchool> registerSchoolList = rsMapper.selectList(rsWrapper);
log.info("<<<<<<registerSchoolList::"+registerSchoolList);
... ...
... ... @@ -18,6 +18,7 @@ import com.example.client.domain.bo.MyAuthentication;
import com.example.client.domain.vo.CUserVo;
import com.example.client.domin.UserContext;
import com.example.client.enumeration.Identity;
import com.example.client.enumeration.SchoolTypeEnumer;
import com.example.client.mapper.*;
import com.example.client.service.FamilyService;
import com.example.client.service.UserService;
... ... @@ -183,7 +184,7 @@ public class CUserServiceImpl extends ServicePlusImpl<CUserMapper, CUser, CUserV
//判断是否是学校
CRegisterSchool cRegisterSchool = cRegisterSchoolMapper.selectById(myAuthentication.getSchoolId());
//学校类型 1-学校 2-培训 3-其他
if(cRegisterSchool.getSchoolType() ==1 ) {
if(cRegisterSchool.getSchoolType().equals(SchoolTypeEnumer.OTHER) ) {
cUser.setSchoolCurrent(myAuthentication.getSchoolId());
getBaseMapper().updateById(cUser);
}
... ...
... ... @@ -7,6 +7,7 @@ import com.example.client.domain.*;
import com.example.client.domain.bo.CBasicInformationStudentBo;
import com.example.client.domain.bo.CPersonalInformationBo;
import com.example.client.domain.bo.CRelationshipStudentSgcBo;
import com.example.client.domain.bo.MySchoolTypeBO;
import com.example.client.domain.vo.*;
import com.example.client.domin.UserContext;
import com.example.client.enumeration.Identity;
... ... @@ -657,7 +658,7 @@ public class MineServiceImpl implements MineService {
* @return
*/
@Override
public AjaxResult openMySchool() {
public AjaxResult openMySchool(MySchoolTypeBO mySchoolTypeBO) {
//根据登录人Id查询用户信息
Long uId = UserContext.currentUserId();
... ... @@ -669,13 +670,13 @@ public class MineServiceImpl implements MineService {
if(userId ==null){
return AjaxResult.error("你还没有绑定孩子");
}
return getMySchool(userId);
return getMySchool(userId ,mySchoolTypeBO );
}
//学生
if(cUser.getIdentityType().equals(Identity.STUDENT)){
return getMySchool(uId);
return getMySchool(uId,mySchoolTypeBO);
}
//老师的
if(cUser.getIdentityType().equals(Identity.TEACHWE)){
... ... @@ -716,12 +717,14 @@ public class MineServiceImpl implements MineService {
* @param userId
* @return
*/
private AjaxResult getMySchool(Long userId) {
private AjaxResult getMySchool(Long userId ,MySchoolTypeBO mySchoolTypeBO) {
CRelationshipStudentSgcBo cRelationshipStudentSgcBo = new CRelationshipStudentSgcBo();
System.out.println(userId);
cRelationshipStudentSgcBo.setGardeType(mySchoolTypeBO.getSchoolType().getCode());
cRelationshipStudentSgcBo.setUserId(userId);
List<MySchoolVo> school = cRegisterSchoolMapper.getSchool(cRelationshipStudentSgcBo);
return AjaxResult.success(school);
}
}
... ...
... ... @@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.user_id = #{userId}
<if test="gardeType != null">
and r.garde_type = #{gardeType}
and s.school_type = #{gardeType}
</if>
</where>
... ...