diff --git a/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java b/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
index 2f9cb7718579429dd4165b8f5e870fd4e8c61937..daf50f8793062688a4fd34782ba2380f32e33a2c 100644
--- a/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
+++ b/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
@@ -48,13 +48,13 @@ public class GlobalExceptionHandler {
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(value = ParamException.class)
- /**
+ /**
* @description: 解决参数为空的异常
- * @param: e
- * @return: com.education_platform.common.R
+ * @param: e
+ * @return: com.education_platform.common.R
* @author feng
* @date: 2021/10/8 20:17
- */
+ */
public R paramExecprion(RuntimeException e) {
log.error("参数异常:----------------{}", e.getMessage());
return R.error(e.getMessage());
diff --git a/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java b/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java
index 859beaaa2a3379427e48857cc70281e13605e1f0..54ea6c2378ac56d786f1249684f930fe41526032 100644
--- a/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java
+++ b/src/main/java/com/mobile_education_platform/controller/TeacherClassApplyController.java
@@ -1,10 +1,24 @@
package com.mobile_education_platform.controller;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mobile_education_platform.common.R;
+import com.mobile_education_platform.pojo.dto.TeacherClassApplyDto;
+import com.mobile_education_platform.pojo.dto.TeacherClassApplyDtoList;
+import com.mobile_education_platform.service.ClassService;
+import com.mobile_education_platform.service.TeacherClassApplyService;
+import com.mobile_education_platform.service.TeacherService;
import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RestController;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
*
@@ -16,8 +30,117 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/teacher-class-apply")
-@Api(tags = "")
+@Api(tags = "前台教师班级申请")
public class TeacherClassApplyController {
+ @Autowired
+ TeacherClassApplyService teacherClassApplyService;
+
+ @Autowired
+ TeacherService teacherService;
+
+ @Autowired
+ ClassService classService;
+
+ @PostMapping("/{tNumber}/{cIds}")
+ @ApiOperation("新增接口:根据教师编号和班级id列表添加教师申请加入班级记录")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "tNumber",value = "教师编号",required = true),
+ @ApiImplicitParam(name = "cIds",value = "班级id列表",required = true,allowMultiple = true)
+ })
+ public R addApplyFor(@PathVariable String tNumber,@PathVariable List cIds){
+ Map map = new HashMap<>();
+
+ //判断编号,并获取教师基本信息id
+ if (teacherService.byNumberSelectTeacher(tNumber) == null){
+ return R.error(500, "该编号所有者不是教师");
+ }
+ String tId = teacherService.byNumberSelectTeacher(tNumber).getId();
+
+ //判断班级id的个数
+ if ( cIds.size() == 0){
+ return R.error(500,"没有接收到班级id列表");
+ }
+
+ int resultNumber = teacherClassApplyService.addApplyFor(tId,cIds);
+
+ map.put("targetNumber",cIds.size());
+ map.put("resultNumber", resultNumber);
+
+ return R.ok(200, "添加教师申请加入班级", map);
+ }
+
+
+ @GetMapping("/{tNumber}/{current}/{size}")
+ @ApiOperation("查询接口:“为班主任查询所有result字段为-1的字段”")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "tNumber",value = "当前使用教师的教师编号"),
+ @ApiImplicitParam(name = "current", value = "跳转页", required = true),
+ @ApiImplicitParam(name = "size", value = "每页数据量", required = true)
+ })
+ public R selectApply(@PathVariable String tNumber, @PathVariable Integer current,
+ @PathVariable Integer size){
+
+ Map map = new HashMap<>();
+
+
+ //判断跳转的页码是否小于等于0
+ if (current <= 0){
+ return R.error("查询失败,请选择大于零的页码。");
+ }
+
+ //判断编号,并获取教师基本信息id
+ if (teacherService.byNumberSelectTeacher(tNumber) == null){
+ return R.error(500, "该编号所有者不是教师");
+ }
+ String tId = teacherService.byNumberSelectTeacher(tNumber).getId();
+
+ Page page = teacherClassApplyService.selectApply(tId, current, size);
+ if (page.getTotal() <= 0){
+ return R.error(500, "查无数据,可能原因:1,该教师不属于班主任。2,该教师担任班主任的班级并没有新的教师申请加入");
+ }
+
+ map.put("result", page);
+
+ return R.ok(200, "查询教师申请加入班级记录", map);
+ }
+
+ @PutMapping()
+ @ApiOperation("修改接口:“班主任审核教师班级加入申请表”,如果result为1,则在该班级的“班级教师授课表中添加数据(直接由班主任为教师添加课程)”")
+ @ApiImplicitParam(name = "teacherClassApplyDtoList",dataType = "TeacherClassApplyDtoList对象")
+ public R updateResult(@RequestBody TeacherClassApplyDtoList teacherClassApplyDtoList){
+ Map map = new HashMap<>();
+
+ Integer count = 0;
+
+ for (TeacherClassApplyDto teacherClassApplyDto : teacherClassApplyDtoList.getTeacherClassApplyDtoList()){
+
+ //判断编号,并获取教师基本信息id
+ if (teacherService.byNumberSelectTeacher(teacherClassApplyDto.getTeacherNumber()) == null){
+ return R.error(500, "该编号所有者不是教师");
+ }
+ String tId = teacherService.byNumberSelectTeacher(teacherClassApplyDto.getTeacherNumber()).getId();
+
+ if (classService.whetherTheHeadTeacher(tId, teacherClassApplyDto.getClassId()) != 1){
+ return R.error(500, "该编号所有者不是该班级的班主任");
+ }
+
+ count = count + teacherClassApplyService.updateResult(teacherClassApplyDto.getApplyId(),
+ teacherClassApplyDto.getResult(), teacherClassApplyDto.getSubjectId());
+
+
+ }
+
+
+ map.put("targetNumber",teacherClassApplyDtoList.getTeacherClassApplyDtoList().size());
+ map.put("resultNumber", count);
+
+
+ return R.ok(200, "班主任审核教师申请", map);
+ }
+
+
+
+
}
diff --git a/src/main/java/com/mobile_education_platform/controller/TeacherController.java b/src/main/java/com/mobile_education_platform/controller/TeacherController.java
index e5766325a470761c2a16ab5cccc44bcb669fe81a..3fab295b0e4382542f07f0e6d886f4dec0deaeec 100644
--- a/src/main/java/com/mobile_education_platform/controller/TeacherController.java
+++ b/src/main/java/com/mobile_education_platform/controller/TeacherController.java
@@ -1,10 +1,17 @@
package com.mobile_education_platform.controller;
+import com.mobile_education_platform.common.R;
+import com.mobile_education_platform.pojo.dto.TeacherDto;
+import com.mobile_education_platform.service.TeacherService;
import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RestController;
+import java.util.HashMap;
+import java.util.Map;
/**
*
@@ -16,8 +23,44 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/teacher")
-@Api(tags = "")
+@Api(tags = "前台教师基本信息")
public class TeacherController {
+ @Autowired
+ TeacherService teacherService;
+
+ @GetMapping("/{tNumber}")
+ @ApiImplicitParam(name = "tNumber",value = "教师个人编号",required = true)
+ @ApiOperation("根据教师个人编号查询教师个人基本信息")
+ public R byNumberSelectTeacher(@PathVariable String tNumber){
+ Map map = new HashMap<>();
+
+ if (teacherService.byNumberSelectTeacher(tNumber) == null){
+ return R.error(500,"查询教师个人基本信息失败");
+ }
+
+ map.put("result", teacherService.byNumberSelectTeacher(tNumber));
+
+ return R.ok(200,"查询教师个人基本信息成功",map);
+ }
+
+
+ @PutMapping()
+ @ApiImplicitParam(name = "teacherDto",dataType = "TeacherDto对象")
+ @ApiOperation("根据教师基本信息id修改教师个人基本信息")
+ public R updateTeacher(@RequestBody TeacherDto teacherDto){
+ Map map = new HashMap<>();
+
+ if (teacherService.updateTeacher(teacherDto) != 1){
+ return R.error(500,"修改教师个人基本信息失败");
+ }
+
+ return R.ok(200, "修改教师个人基本信息成功",map);
+ }
+
+
+
+
+
}
diff --git a/src/main/java/com/mobile_education_platform/controller/TeacherDetailController.java b/src/main/java/com/mobile_education_platform/controller/TeacherDetailController.java
index f4d1ad660ccdc34f36d907ed96abc1a9f0e6ffe4..79efcf1ad88ad4684cf71099dc5803557100c54b 100644
--- a/src/main/java/com/mobile_education_platform/controller/TeacherDetailController.java
+++ b/src/main/java/com/mobile_education_platform/controller/TeacherDetailController.java
@@ -1,10 +1,19 @@
package com.mobile_education_platform.controller;
+import com.mobile_education_platform.common.R;
+import com.mobile_education_platform.pojo.TeacherDetail;
+import com.mobile_education_platform.pojo.dto.TeacherDetailDto;
+import com.mobile_education_platform.service.TeacherDetailService;
+import com.mobile_education_platform.service.TeacherService;
import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RestController;
+import java.util.HashMap;
+import java.util.Map;
/**
*
@@ -16,8 +25,52 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/teacher-detail")
-@Api(tags = "")
+@Api(tags = "前台教师详细信息")
public class TeacherDetailController {
+ @Autowired
+ TeacherService teacherService;
+
+ @Autowired
+ TeacherDetailService teacherDetailService;
+
+ @GetMapping("/{tNumber}")
+ @ApiOperation("根据教师编号获取对应的教师详细资料信息")
+ @ApiImplicitParam(value = "教师编号",name = "tNumber",required = true)
+ public R selectByIdOne(@PathVariable String tNumber){
+ Map map = new HashMap<>();
+
+ if (teacherService.byNumberSelectTeacher(tNumber) == null){
+ return R.error(500,"该教师编号不存在!");
+ }
+
+ //获取教师基本信息id
+ String tId = teacherService.byNumberSelectTeacher(tNumber).getId();
+
+ if (teacherDetailService.selectByTIdOne(tId) == null){
+ return R.error(500,"查询该教师详细信息失败");
+ }
+
+ map.put("result", teacherDetailService.selectByTIdOne(tId));
+
+ return R.ok(200, "查询教师详细信息成功", map);
+ }
+
+
+ @PutMapping()
+ @ApiImplicitParam(name = "teacherDetailDto",dataType = "TeacherDetailDto对象")
+ @ApiOperation("根据教师详细信息id修改教师个人详细信息")
+ public R updateTeacherDetail(@RequestBody TeacherDetailDto teacherDetailDto){
+ Map map = new HashMap<>();
+
+ if (teacherDetailService.updateTeacherDetail(teacherDetailDto) != 1){
+ return R.error(500,"修改教师个人详细信息失败");
+ }
+
+ return R.ok(200, "修改教师详细信息成功", map);
+ }
+
+
+
}
diff --git a/src/main/java/com/mobile_education_platform/mapper/TeacherClassApplyMapper.java b/src/main/java/com/mobile_education_platform/mapper/TeacherClassApplyMapper.java
index c60cdb1a1e4d06b70ec0c55b45db92c16af4adb6..560b39027210e99a9ab9f7c9fdeacbd9c71a7e82 100644
--- a/src/main/java/com/mobile_education_platform/mapper/TeacherClassApplyMapper.java
+++ b/src/main/java/com/mobile_education_platform/mapper/TeacherClassApplyMapper.java
@@ -1,7 +1,13 @@
package com.mobile_education_platform.mapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mobile_education_platform.pojo.TeacherClassApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mobile_education_platform.pojo.TeacherClassSubject;
+import com.mobile_education_platform.pojo.vo.TeacherClassApplyVo;
+import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
@@ -15,4 +21,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface TeacherClassApplyMapper extends BaseMapper {
+
+ Page selectApply(Page page, @Param(Constants.WRAPPER) QueryWrapper teacherClassApplyQueryWrapper);
+
}
diff --git a/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDto.java b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..49f74a48858cd7d3c41f71086e16cdd14ac99712
--- /dev/null
+++ b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDto.java
@@ -0,0 +1,35 @@
+package com.mobile_education_platform.pojo.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+/**
+ * @author : C_xuan
+ * @date : 10:31 2021/10/26
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ApiModel(value="TeacherClassApplyDto对象", description="")
+public class TeacherClassApplyDto {
+
+ @ApiModelProperty(value = "当前登录教师编号")
+ private String teacherNumber;
+
+ @ApiModelProperty(value = "班级id")
+ private String classId;
+
+ @ApiModelProperty(value = "教师加入班级申请表主键id")
+ private String applyId;
+
+ @ApiModelProperty(value = "结果(-1待审核,0未通过,1通过)")
+ private Integer result;
+
+ @ApiModelProperty(value = "教师加入班级后,所授课程的id,当result=0时为null")
+ private String subjectId;
+}
diff --git a/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDtoList.java b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDtoList.java
new file mode 100644
index 0000000000000000000000000000000000000000..421dbc99100fcd16a5b999d823adcc22a3fc8701
--- /dev/null
+++ b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDtoList.java
@@ -0,0 +1,26 @@
+package com.mobile_education_platform.pojo.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author : C_xuan
+ * @date : 10:29 2021/10/26
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ApiModel(value="TeacherClassApplyDtoList对象", description="")
+public class TeacherClassApplyDtoList {
+
+ @ApiModelProperty(value = "TeacherClassApplyDto对象的list集合")
+ private List teacherClassApplyDtoList;
+
+}
diff --git a/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDetailDto.java b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDetailDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc5c7a6f262105f2850222e27418e35f450db825
--- /dev/null
+++ b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDetailDto.java
@@ -0,0 +1,82 @@
+package com.mobile_education_platform.pojo.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author : C_xuan
+ * @date : 19:20 2021/10/25
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ApiModel(value="TeacherDetailDto对象", description="")
+public class TeacherDetailDto implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "教师详细信息表主键")
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ private String id;
+
+// @ApiModelProperty(value = "教师基本资料表的主键id")
+// private String teacherId;
+
+ @ApiModelProperty(value = "个人照片")
+ private String photo;
+
+ @ApiModelProperty(value = "性别(0女生,1男生)")
+ private Integer gender;
+
+ @ApiModelProperty(value = "出生日期")
+ private String birthday;
+
+ @ApiModelProperty(value = "出生地")
+ private String birthplace;
+
+ @ApiModelProperty(value = "证件类型")
+ private String certificateType;
+
+ @ApiModelProperty(value = "证件编号")
+ private String certificateNumber;
+
+ @ApiModelProperty(value = "籍贯")
+ private String nativePlace;
+
+ @ApiModelProperty(value = "国籍")
+ private String nationality;
+
+ @ApiModelProperty(value = "居住地")
+ private String residentialAddress;
+
+ @ApiModelProperty(value = "最高学历")
+ private String degree;
+
+ @ApiModelProperty(value = "联系电话")
+ private String phone;
+
+ @ApiModelProperty(value = "邮箱")
+ private String email;
+
+// @TableField(fill = FieldFill.INSERT)
+// @ApiModelProperty(value = "创建时间")
+// private Date createTime;
+
+// @TableField(fill = FieldFill.INSERT_UPDATE)
+// @ApiModelProperty(value = "最后一次更新时间")
+// private Date updateTime;
+
+
+}
diff --git a/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDto.java b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..67f3fa01fdd210b0c154cec58dc105d5e82a1dda
--- /dev/null
+++ b/src/main/java/com/mobile_education_platform/pojo/dto/TeacherDto.java
@@ -0,0 +1,63 @@
+package com.mobile_education_platform.pojo.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author : C_xuan
+ * @date : 19:16 2021/10/25
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ApiModel(value="TeacherDto对象", description="")
+public class TeacherDto implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "教师基本资料表主键ID")
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ private String id;
+
+// @ApiModelProperty(value = "教师编号")
+// private String number;
+
+ @ApiModelProperty(value = "教师中文名")
+ @TableField("name_CN")
+ private String nameCn;
+
+ @ApiModelProperty(value = "教师外文名")
+ @TableField("name_PT")
+ private String namePt;
+
+ @ApiModelProperty(value = "职称(1中教三级,2中教二级,3中教一级,4中教高级,5中教特级)")
+ private Integer positionalTitle;
+
+// @ApiModelProperty(value = "状态(0离职,1在职)")
+// private Integer status;
+
+// @ApiModelProperty(value = "教师详细信息id")
+// private String teacherDetailId;
+
+// @TableField(fill = FieldFill.INSERT)
+// @ApiModelProperty(value = "创建时间")
+// private Date createTime;
+
+// @TableField(fill = FieldFill.INSERT_UPDATE)
+// @ApiModelProperty(value = "最后一次更新时间")
+// private Date updateTime;
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/mobile_education_platform/pojo/vo/TeacherClassApplyVo.java b/src/main/java/com/mobile_education_platform/pojo/vo/TeacherClassApplyVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..7211464540d09d34d01f0d378f6afa6a0b9c84fc
--- /dev/null
+++ b/src/main/java/com/mobile_education_platform/pojo/vo/TeacherClassApplyVo.java
@@ -0,0 +1,61 @@
+package com.mobile_education_platform.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author : C_xuan
+ * @date : 8:03 2021/10/26
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ApiModel(value="TeacherClassApply对象", description="")
+public class TeacherClassApplyVo implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "主键id")
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ private String id;
+
+ @ApiModelProperty(value = "教师编号")
+ private String teacherNumber;
+
+ @ApiModelProperty(value = "教师中文名")
+ private String teacherNameCn;
+
+ @ApiModelProperty(value = "教师外文名")
+ private String teacherNamePt;
+
+ @ApiModelProperty(value = "班级id")
+ private String classId;
+
+ @ApiModelProperty(value = "班级名称")
+ private String className;
+
+ @ApiModelProperty(value = "结果(-1待审核,0未通过,1通过)")
+ private Integer result;
+
+// @TableField(fill = FieldFill.INSERT)
+// @ApiModelProperty(value = "创建时间")
+// private Date createTime;
+//
+// @TableField(fill = FieldFill.INSERT_UPDATE)
+// @ApiModelProperty(value = "最后一次更新时间")
+// private Date updateTime;
+
+
+}
diff --git a/src/main/java/com/mobile_education_platform/service/ClassService.java b/src/main/java/com/mobile_education_platform/service/ClassService.java
index ae38c9717d6c034c7e16adb30a912a4685322ca2..282c65a859cfaf21ba85a2fd1567baeabd9c7483 100644
--- a/src/main/java/com/mobile_education_platform/service/ClassService.java
+++ b/src/main/java/com/mobile_education_platform/service/ClassService.java
@@ -13,4 +13,14 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ClassService extends IService {
+ /**
+ * @Description: 验证当前教师是否为班主任
+ * @param tId: 当前登录教师基本信息id,
+ * @param cId: 班级id
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 9:19
+ */
+ int whetherTheHeadTeacher(String tId,String cId);
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java b/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java
index 1b214fc75c64a2fdec14d1e8cafc6f61d126dff1..945689e225e403e4a5d89b4a008c30ceb90c75c5 100644
--- a/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java
+++ b/src/main/java/com/mobile_education_platform/service/TeacherClassApplyService.java
@@ -1,8 +1,11 @@
package com.mobile_education_platform.service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mobile_education_platform.pojo.TeacherClassApply;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
/**
*
* 服务类
@@ -13,4 +16,38 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TeacherClassApplyService extends IService {
+
+ /**
+ * @Description: 新增接口:“教师端用户选择班级,选择申请加入(可同时选择多个班级)”
+ * @param tId: 教师基本信息id
+ * @param cIds: 班级id列表
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:59
+ */
+ int addApplyFor(String tId, List cIds);
+
+
+ /**
+ * @Description: 查询接口:“为班主任查询所有result字段为-1的字段”
+ * @param tId: 班级基本信息id
+ * @param current: 跳转页
+ * @param size: 每页数据量
+ * @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 7:50
+ */
+ Page selectApply(String tId, Integer current, Integer size);
+
+
+ /**
+ * @Description: 修改接口:“班主任审核教师班级加入申请表”,如果result为1,则在该班级的“班级教师授课表中添加数据(直接由班主任为教师添加课程)”
+ * @param applyId: 主键id
+ * @param result: 审核结果
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 9:46
+ */
+ int updateResult(String applyId, Integer result,String subjectId);
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/TeacherClassSubjectService.java b/src/main/java/com/mobile_education_platform/service/TeacherClassSubjectService.java
index 2ed489dec3ab48ca6581858531fc6362f2835b5c..50faed738d9779c35749479f98b582ecbb0eeb78 100644
--- a/src/main/java/com/mobile_education_platform/service/TeacherClassSubjectService.java
+++ b/src/main/java/com/mobile_education_platform/service/TeacherClassSubjectService.java
@@ -13,4 +13,14 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TeacherClassSubjectService extends IService {
+
+ /**
+ * @Description: 若通过,则修改记录“result”字段为1,并在该班级的“班级教师授课表中添加数据(直接由班主任为教师添加课程)”
+ * @param teacherClassSubject:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 10:17
+ */
+ int insertTeacherClassSubject(TeacherClassSubject teacherClassSubject);
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/TeacherDetailService.java b/src/main/java/com/mobile_education_platform/service/TeacherDetailService.java
index c9475722e12f485d3f641809bfa6ca6aab7a6b93..fef6ed55e6cc7d9bf568470d15475687ce077914 100644
--- a/src/main/java/com/mobile_education_platform/service/TeacherDetailService.java
+++ b/src/main/java/com/mobile_education_platform/service/TeacherDetailService.java
@@ -2,6 +2,7 @@ package com.mobile_education_platform.service;
import com.mobile_education_platform.pojo.TeacherDetail;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.mobile_education_platform.pojo.dto.TeacherDetailDto;
/**
*
@@ -13,4 +14,24 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TeacherDetailService extends IService {
+
+ /**
+ * @Description: 用于我的模块,查询接口:“查询教师详细信息”
+ * @param teacherId: 教师基本信息id
+ * @return: com.mobile_education_platform.pojo.TeacherDetail
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:12
+ */
+ TeacherDetail selectByTIdOne(String teacherId);
+
+
+ /**
+ * @Description: 用于我的模块,修改接口:“修改教师详细信息”
+ * @param teacherDetailDto:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:34
+ */
+ int updateTeacherDetail(TeacherDetailDto teacherDetailDto);
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/TeacherService.java b/src/main/java/com/mobile_education_platform/service/TeacherService.java
index 4fb988ad605d5efb0cceaadb62c26364d02a9aa4..b3701ad0f0896c898cdaaa75246066641656affd 100644
--- a/src/main/java/com/mobile_education_platform/service/TeacherService.java
+++ b/src/main/java/com/mobile_education_platform/service/TeacherService.java
@@ -2,6 +2,7 @@ package com.mobile_education_platform.service;
import com.mobile_education_platform.pojo.Teacher;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.mobile_education_platform.pojo.dto.TeacherDto;
/**
*
@@ -13,4 +14,22 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TeacherService extends IService {
+ /**
+ * @Description: 用于我的模块,查询接口:“查询教师基本信息”
+ * @param number: 需要查询的教师编号
+ * @return: com.mobile_education_platform.pojo.Teacher
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 19:26
+ */
+ Teacher byNumberSelectTeacher(String number);
+
+ /**
+ * @Description: 用于我的模块,修改接口:“修改教师基本信息”
+ * @param teacherDto:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 19:54
+ */
+ int updateTeacher(TeacherDto teacherDto);
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/impl/ClassServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/ClassServiceImpl.java
index 413babc697dabc9afe8a8d3d36dfc5b165006685..88b389682553631c2048253658e95d10fba00edb 100644
--- a/src/main/java/com/mobile_education_platform/service/impl/ClassServiceImpl.java
+++ b/src/main/java/com/mobile_education_platform/service/impl/ClassServiceImpl.java
@@ -1,5 +1,6 @@
package com.mobile_education_platform.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mobile_education_platform.pojo.Class;
import com.mobile_education_platform.mapper.ClassMapper;
import com.mobile_education_platform.service.ClassService;
@@ -17,4 +18,21 @@ import org.springframework.stereotype.Service;
@Service
public class ClassServiceImpl extends ServiceImpl implements ClassService {
+
+ @Override
+ /**
+ * @Description: 验证当前教师是否为班主任
+ * @param tId: 当前登录教师基本信息id,
+ * @param cId: 班级id
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 9:19
+ */
+ public int whetherTheHeadTeacher(String tId,String cId){
+ QueryWrapper classQueryWrapper = new QueryWrapper<>();
+ classQueryWrapper.eq("head_teacher_id", tId).eq("id", cId);
+ return baseMapper.selectList(classQueryWrapper).size();
+
+ }
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java
index d683ef963a148380483176cb5573c36d52dc816e..8f4c19449d97842770ddbe3f592f74bb4ab74f99 100644
--- a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java
+++ b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassApplyServiceImpl.java
@@ -1,11 +1,20 @@
package com.mobile_education_platform.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mobile_education_platform.pojo.Class;
import com.mobile_education_platform.pojo.TeacherClassApply;
import com.mobile_education_platform.mapper.TeacherClassApplyMapper;
+import com.mobile_education_platform.pojo.TeacherClassSubject;
+import com.mobile_education_platform.service.ClassService;
import com.mobile_education_platform.service.TeacherClassApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mobile_education_platform.service.TeacherClassSubjectService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* 服务实现类
@@ -17,4 +26,78 @@ import org.springframework.stereotype.Service;
@Service
public class TeacherClassApplyServiceImpl extends ServiceImpl implements TeacherClassApplyService {
+
+ @Autowired
+ TeacherClassSubjectService teacherClassSubjectService;
+
+ @Override
+ /**
+ * @Description: 新增接口:“教师端用户选择班级,选择申请加入(可同时选择多个班级)”
+ * @param tId: 教师基本信息id
+ * @param cIds: 班级id列表
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:59
+ */
+ public int addApplyFor(String tId, List cIds){
+ int count = 0;
+
+ for (String cId:cIds){
+ TeacherClassApply teacherClassApply = new TeacherClassApply()
+ .setTeacherId(tId).setClassId(cId).setResult(-1);
+
+ count = count + baseMapper.insert(teacherClassApply);
+ }
+
+ return count;
+ }
+
+
+
+ @Override
+ /**
+ * @Description: 查询接口:“为班主任查询所有result字段为-1的字段”
+ * @param tId: 班主任基本信息id
+ * @param current: 跳转页
+ * @param size: 每页数据量
+ * @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 7:50
+ */
+ public Page selectApply(String tId, Integer current, Integer size){
+ Page teacherClassApplyPage = new Page<>(current, size);
+
+ QueryWrapper teacherClassApplyQueryWrapper = new QueryWrapper<>();
+ teacherClassApplyQueryWrapper.eq("teacher.id", tId);
+ teacherClassApplyQueryWrapper.eq("teacher_class_apply.result", -1);
+
+ return baseMapper.selectApply(teacherClassApplyPage, teacherClassApplyQueryWrapper);
+ }
+
+
+ @Override
+ /**
+ * @Description: 修改接口:“班主任审核教师班级加入申请表”,如果result为1,则在该班级的“班级教师授课表中添加数据(直接由班主任为教师添加课程)”
+ * @param applyId: 主键id
+ * @param result: 审核结果
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 9:46
+ */
+ public int updateResult(String applyId, Integer result,String subjectId){
+ TeacherClassApply teacherClassApply = new TeacherClassApply().setId(applyId).setResult(result);
+
+ //为教师添加班级授课
+ if (result == 1){
+ TeacherClassSubject teacherClassSubject = new TeacherClassSubject()
+ .setClassId(baseMapper.selectById(applyId).getClassId())
+ .setSubjectId(subjectId)
+ .setTeacherId(baseMapper.selectById(applyId).getTeacherId());
+
+ teacherClassSubjectService.insertTeacherClassSubject(teacherClassSubject);
+ }
+
+ return baseMapper.updateById(teacherClassApply);
+ }
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassSubjectServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassSubjectServiceImpl.java
index 8d7f6831a798414670b89ee4f69f62a445b69efb..4c33a32e3c2e91dc5084303845cf27dae58212cf 100644
--- a/src/main/java/com/mobile_education_platform/service/impl/TeacherClassSubjectServiceImpl.java
+++ b/src/main/java/com/mobile_education_platform/service/impl/TeacherClassSubjectServiceImpl.java
@@ -17,4 +17,17 @@ import org.springframework.stereotype.Service;
@Service
public class TeacherClassSubjectServiceImpl extends ServiceImpl implements TeacherClassSubjectService {
+
+ @Override
+ /**
+ * @Description: 若通过,则修改记录“result”字段为1,并在该班级的“班级教师授课表中添加数据(直接由班主任为教师添加课程)”
+ * @param teacherClassSubject:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/26 10:17
+ */
+ public int insertTeacherClassSubject(TeacherClassSubject teacherClassSubject){
+ return baseMapper.insert(teacherClassSubject);
+ }
+
}
diff --git a/src/main/java/com/mobile_education_platform/service/impl/TeacherDetailServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/TeacherDetailServiceImpl.java
index 2463ed4e5527e9cfd9c4af87ef8b0f04e5295bb6..82f4557721499b5c013d3e48a6864c781823e957 100644
--- a/src/main/java/com/mobile_education_platform/service/impl/TeacherDetailServiceImpl.java
+++ b/src/main/java/com/mobile_education_platform/service/impl/TeacherDetailServiceImpl.java
@@ -1,7 +1,9 @@
package com.mobile_education_platform.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mobile_education_platform.pojo.TeacherDetail;
import com.mobile_education_platform.mapper.TeacherDetailMapper;
+import com.mobile_education_platform.pojo.dto.TeacherDetailDto;
import com.mobile_education_platform.service.TeacherDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -17,4 +19,45 @@ import org.springframework.stereotype.Service;
@Service
public class TeacherDetailServiceImpl extends ServiceImpl implements TeacherDetailService {
+
+ @Override
+ /**
+ * @Description: 用于我的模块,查询接口:“查询教师详细信息”
+ * @param teacherId: 教师基本信息id
+ * @return: com.mobile_education_platform.pojo.TeacherDetail
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:12
+ */
+ public TeacherDetail selectByTIdOne(String teacherId){
+
+ QueryWrapper teacherDetailQueryWrapper = new QueryWrapper<>();
+ teacherDetailQueryWrapper.eq("teacher_id", teacherId);
+
+ return baseMapper.selectOne(teacherDetailQueryWrapper);
+ }
+
+
+ @Override
+ /**
+ * @Description: 用于我的模块,修改接口:“修改教师详细信息”
+ * @param teacherDetailDto:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 20:34
+ */
+ public int updateTeacherDetail(TeacherDetailDto teacherDetailDto){
+
+ TeacherDetail teacherDetail = new TeacherDetail().setId(teacherDetailDto.getId())
+ .setPhoto(teacherDetailDto.getPhoto()).setGender(teacherDetailDto.getGender())
+ .setBirthday(teacherDetailDto.getBirthday()).setBirthplace(teacherDetailDto.getBirthplace())
+ .setCertificateType(teacherDetailDto.getCertificateType())
+ .setCertificateNumber(teacherDetailDto.getCertificateNumber())
+ .setNativePlace(teacherDetailDto.getNativePlace())
+ .setNationality(teacherDetailDto.getNationality())
+ .setResidentialAddress(teacherDetailDto.getResidentialAddress())
+ .setDegree(teacherDetailDto.getDegree()).setPhone(teacherDetailDto.getPhone())
+ .setEmail(teacherDetailDto.getEmail());
+
+ return baseMapper.updateById(teacherDetail);
+ }
}
diff --git a/src/main/java/com/mobile_education_platform/service/impl/TeacherServiceImpl.java b/src/main/java/com/mobile_education_platform/service/impl/TeacherServiceImpl.java
index 30625f5412d09b5faffb7ed986f8fe37a43d319f..b69d98404cf009b2e1dcd5a9a45b77b166248dfa 100644
--- a/src/main/java/com/mobile_education_platform/service/impl/TeacherServiceImpl.java
+++ b/src/main/java/com/mobile_education_platform/service/impl/TeacherServiceImpl.java
@@ -1,7 +1,9 @@
package com.mobile_education_platform.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mobile_education_platform.pojo.Teacher;
import com.mobile_education_platform.mapper.TeacherMapper;
+import com.mobile_education_platform.pojo.dto.TeacherDto;
import com.mobile_education_platform.service.TeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -17,4 +19,37 @@ import org.springframework.stereotype.Service;
@Service
public class TeacherServiceImpl extends ServiceImpl implements TeacherService {
+ @Override
+ /**
+ * @Description: 用于我的模块,查询接口:“查询教师基本信息”
+ * @param number: 需要查询的教师编号
+ * @return: com.mobile_education_platform.pojo.Teacher
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 19:26
+ */
+ public Teacher byNumberSelectTeacher(String number){
+
+ QueryWrapper teacherQueryWrapper = new QueryWrapper<>();
+ teacherQueryWrapper.eq("number", number);
+
+ return baseMapper.selectOne(teacherQueryWrapper);
+ }
+
+
+ @Override
+ /**
+ * @Description: 用于我的模块,修改接口:“修改教师基本信息”
+ * @param teacherDto:
+ * @return: int
+ * @Author: chenXuanSheng
+ * @Date: 2021/10/25 19:54
+ */
+ public int updateTeacher(TeacherDto teacherDto){
+
+ Teacher teacher = new Teacher().setId(teacherDto.getId()).setNameCn(teacherDto.getNameCn())
+ .setNamePt(teacherDto.getNamePt()).setPositionalTitle(teacherDto.getPositionalTitle());
+
+ return baseMapper.updateById(teacher);
+ }
+
}
diff --git a/src/main/resources/mapper/TeacherClassApplyMapper.xml b/src/main/resources/mapper/TeacherClassApplyMapper.xml
index 6043afa01d52ddbf82d8172eda419e13eba1b20c..f6a1ab942bef78f15c725cea641e3f8738e167b9 100644
--- a/src/main/resources/mapper/TeacherClassApplyMapper.xml
+++ b/src/main/resources/mapper/TeacherClassApplyMapper.xml
@@ -2,4 +2,16 @@
+
+