From 5789aa8f895c7e08879f7c961dc6fdfc77120a25 Mon Sep 17 00:00:00 2001
From: xuan <255124139@qq.com>
Date: Tue, 26 Oct 2021 11:16:53 +0800
Subject: [PATCH 1/2] =?UTF-8?q?chenXuan2021.10.26,11:15=201,=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E5=89=8D=E5=8F=B0=E6=88=91=E7=9A=84=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E6=95=99=E5=B8=88=E9=83=A8=E5=88=86=202,=E5=AE=8C=E6=88=90?=
=?UTF-8?q?=E5=89=8D=E5=8F=B0=E7=8F=AD=E7=BA=A7=E6=A8=A1=E5=9D=97=E7=9A=84?=
=?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=95=99=E5=B8=88=E9=80=89=E6=8B=A9=EF=BC=8C?=
=?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7=E9=83=A8?=
=?UTF-8?q?=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/GlobalExceptionHandler.java | 154 +++++++++---------
.../TeacherClassApplyController.java | 129 ++++++++++++++-
.../controller/TeacherController.java | 49 +++++-
.../controller/TeacherDetailController.java | 59 ++++++-
.../mapper/TeacherClassApplyMapper.java | 9 +
.../pojo/dto/TeacherClassApplyDto.java | 35 ++++
.../pojo/dto/TeacherClassApplyDtoList.java | 26 +++
.../pojo/dto/TeacherDetailDto.java | 82 ++++++++++
.../pojo/dto/TeacherDto.java | 63 +++++++
.../pojo/vo/TeacherClassApplyVo.java | 61 +++++++
.../service/ClassService.java | 10 ++
.../service/TeacherClassApplyService.java | 37 +++++
.../service/TeacherClassSubjectService.java | 10 ++
.../service/TeacherDetailService.java | 21 +++
.../service/TeacherService.java | 19 +++
.../service/impl/ClassServiceImpl.java | 18 ++
.../impl/TeacherClassApplyServiceImpl.java | 83 ++++++++++
.../impl/TeacherClassSubjectServiceImpl.java | 13 ++
.../impl/TeacherDetailServiceImpl.java | 43 +++++
.../service/impl/TeacherServiceImpl.java | 35 ++++
.../mapper/TeacherClassApplyMapper.xml | 12 ++
21 files changed, 882 insertions(+), 86 deletions(-)
create mode 100644 src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDto.java
create mode 100644 src/main/java/com/mobile_education_platform/pojo/dto/TeacherClassApplyDtoList.java
create mode 100644 src/main/java/com/mobile_education_platform/pojo/dto/TeacherDetailDto.java
create mode 100644 src/main/java/com/mobile_education_platform/pojo/dto/TeacherDto.java
create mode 100644 src/main/java/com/mobile_education_platform/pojo/vo/TeacherClassApplyVo.java
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 2f9cb77..8d724e8 100644
--- a/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
+++ b/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
@@ -1,77 +1,77 @@
-package com.mobile_education_platform.common;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpStatus;
-import org.springframework.validation.BindingResult;
-import org.springframework.validation.ObjectError;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-/**
- * @function: 统一异常返回类
- * @author:
- * @time: 2021-9-7 23:03:30
- */
-
-@Slf4j
-@RestControllerAdvice
-public class GlobalExceptionHandler {
-
- // 实体校验异常捕获
- @ResponseStatus(HttpStatus.BAD_REQUEST)
- @ExceptionHandler(value = MethodArgumentNotValidException.class)
- public R handler(MethodArgumentNotValidException e) {
-
- BindingResult result = e.getBindingResult();
- ObjectError objectError = result.getAllErrors().stream().findFirst().get();
-
- log.error("实体校验异常:----------------{}", objectError.getDefaultMessage());
- return R.error(objectError.getDefaultMessage());
- }
-
- @ResponseStatus(HttpStatus.BAD_REQUEST)
- @ExceptionHandler(value = IllegalArgumentException.class)
- public R handler(IllegalArgumentException e) {
- log.error("Assert异常:----------------{}", e.getMessage());
- return R.error(e.getMessage());
- }
-
- @ResponseStatus(HttpStatus.BAD_REQUEST)
- @ExceptionHandler(value = RuntimeException.class)
- public R handler(RuntimeException e) {
- log.error("运行时异常:----------------{}", e.getMessage());
- return R.error(e.getMessage());
- }
-
- @ResponseStatus(HttpStatus.BAD_REQUEST)
- @ExceptionHandler(value = ParamException.class)
-
- /**
- * @description: 解决参数为空的异常
- * @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());
- }
-
- @ResponseStatus(HttpStatus.BAD_REQUEST)
- @ExceptionHandler(value = DeleteFailure.class)
-
- /**
- * @description: 解决sql事务的异常
- * @param: e
- * @return: com.education_platform.common.R
- * @author feng
- * @date: 2021/10/8 20:17
- */
- public R transactionFailureExecprion(RuntimeException e) {
- log.error("操作数据库删除异常:----------------{}", e.getMessage());
- return R.error("删除失败");
- }
-}
+//package com.mobile_education_platform.common;
+//
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.http.HttpStatus;
+//import org.springframework.validation.BindingResult;
+//import org.springframework.validation.ObjectError;
+//import org.springframework.web.bind.MethodArgumentNotValidException;
+//import org.springframework.web.bind.annotation.ExceptionHandler;
+//import org.springframework.web.bind.annotation.ResponseStatus;
+//import org.springframework.web.bind.annotation.RestControllerAdvice;
+//
+///**
+// * @function: 统一异常返回类
+// * @author:
+// * @time: 2021-9-7 23:03:30
+// */
+//
+//@Slf4j
+//@RestControllerAdvice
+//public class GlobalExceptionHandler {
+//
+// // 实体校验异常捕获
+// @ResponseStatus(HttpStatus.BAD_REQUEST)
+// @ExceptionHandler(value = MethodArgumentNotValidException.class)
+// public R handler(MethodArgumentNotValidException e) {
+//
+// BindingResult result = e.getBindingResult();
+// ObjectError objectError = result.getAllErrors().stream().findFirst().get();
+//
+// log.error("实体校验异常:----------------{}", objectError.getDefaultMessage());
+// return R.error(objectError.getDefaultMessage());
+// }
+//
+// @ResponseStatus(HttpStatus.BAD_REQUEST)
+// @ExceptionHandler(value = IllegalArgumentException.class)
+// public R handler(IllegalArgumentException e) {
+// log.error("Assert异常:----------------{}", e.getMessage());
+// return R.error(e.getMessage());
+// }
+//
+// @ResponseStatus(HttpStatus.BAD_REQUEST)
+// @ExceptionHandler(value = RuntimeException.class)
+// public R handler(RuntimeException e) {
+// log.error("运行时异常:----------------{}", e.getMessage());
+// return R.error(e.getMessage());
+// }
+//
+// @ResponseStatus(HttpStatus.BAD_REQUEST)
+// @ExceptionHandler(value = ParamException.class)
+//
+// /**
+// * @description: 解决参数为空的异常
+// * @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());
+// }
+//
+// @ResponseStatus(HttpStatus.BAD_REQUEST)
+// @ExceptionHandler(value = DeleteFailure.class)
+//
+// /**
+// * @description: 解决sql事务的异常
+// * @param: e
+// * @return: com.education_platform.common.R
+// * @author feng
+// * @date: 2021/10/8 20:17
+// */
+// public R transactionFailureExecprion(RuntimeException e) {
+// log.error("操作数据库删除异常:----------------{}", e.getMessage());
+// return R.error("删除失败");
+// }
+//}
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 859beaa..54ea6c2 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 e576632..3fab295 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 f4d1ad6..79efcf1 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 c60cdb1..560b390 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 0000000..49f74a4
--- /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 0000000..421dbc9
--- /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 0000000..cc5c7a6
--- /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 0000000..67f3fa0
--- /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 0000000..7211464
--- /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 ae38c97..282c65a 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 1b214fc..945689e 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 2ed489d..50faed7 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 c947572..fef6ed5 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 4fb988a..b3701ad 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 413babc..88b3896 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 d683ef9..8f4c194 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 8d7f683..4c33a32 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 2463ed4..82f4557 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 30625f5..b69d984 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 6043afa..f6a1ab9 100644
--- a/src/main/resources/mapper/TeacherClassApplyMapper.xml
+++ b/src/main/resources/mapper/TeacherClassApplyMapper.xml
@@ -2,4 +2,16 @@
+
+
--
Gitee
From f72a7ff7505027d1d72e8d227023d41b36fb9838 Mon Sep 17 00:00:00 2001
From: xuan <255124139@qq.com>
Date: Tue, 26 Oct 2021 11:24:12 +0800
Subject: [PATCH 2/2] =?UTF-8?q?chenXuanSheng2021.10.26,11:23=201,=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E5=89=8D=E5=8F=B0=E6=88=91=E7=9A=84=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E6=95=99=E5=B8=88=E9=83=A8=E5=88=86=202=EF=BC=8C=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E7=8F=AD=E7=BA=A7=E6=A8=A1=E5=9D=97=E6=95=99=E5=B8=88?=
=?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7=E7=94=B3=E8=AF=B7=E9=83=A8?=
=?UTF-8?q?=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/GlobalExceptionHandler.java | 154 +++++++++---------
1 file changed, 77 insertions(+), 77 deletions(-)
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 8d724e8..daf50f8 100644
--- a/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
+++ b/src/main/java/com/mobile_education_platform/common/GlobalExceptionHandler.java
@@ -1,77 +1,77 @@
-//package com.mobile_education_platform.common;
-//
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.http.HttpStatus;
-//import org.springframework.validation.BindingResult;
-//import org.springframework.validation.ObjectError;
-//import org.springframework.web.bind.MethodArgumentNotValidException;
-//import org.springframework.web.bind.annotation.ExceptionHandler;
-//import org.springframework.web.bind.annotation.ResponseStatus;
-//import org.springframework.web.bind.annotation.RestControllerAdvice;
-//
-///**
-// * @function: 统一异常返回类
-// * @author:
-// * @time: 2021-9-7 23:03:30
-// */
-//
-//@Slf4j
-//@RestControllerAdvice
-//public class GlobalExceptionHandler {
-//
-// // 实体校验异常捕获
-// @ResponseStatus(HttpStatus.BAD_REQUEST)
-// @ExceptionHandler(value = MethodArgumentNotValidException.class)
-// public R handler(MethodArgumentNotValidException e) {
-//
-// BindingResult result = e.getBindingResult();
-// ObjectError objectError = result.getAllErrors().stream().findFirst().get();
-//
-// log.error("实体校验异常:----------------{}", objectError.getDefaultMessage());
-// return R.error(objectError.getDefaultMessage());
-// }
-//
-// @ResponseStatus(HttpStatus.BAD_REQUEST)
-// @ExceptionHandler(value = IllegalArgumentException.class)
-// public R handler(IllegalArgumentException e) {
-// log.error("Assert异常:----------------{}", e.getMessage());
-// return R.error(e.getMessage());
-// }
-//
-// @ResponseStatus(HttpStatus.BAD_REQUEST)
-// @ExceptionHandler(value = RuntimeException.class)
-// public R handler(RuntimeException e) {
-// log.error("运行时异常:----------------{}", e.getMessage());
-// return R.error(e.getMessage());
-// }
-//
-// @ResponseStatus(HttpStatus.BAD_REQUEST)
-// @ExceptionHandler(value = ParamException.class)
-//
-// /**
-// * @description: 解决参数为空的异常
-// * @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());
-// }
-//
-// @ResponseStatus(HttpStatus.BAD_REQUEST)
-// @ExceptionHandler(value = DeleteFailure.class)
-//
-// /**
-// * @description: 解决sql事务的异常
-// * @param: e
-// * @return: com.education_platform.common.R
-// * @author feng
-// * @date: 2021/10/8 20:17
-// */
-// public R transactionFailureExecprion(RuntimeException e) {
-// log.error("操作数据库删除异常:----------------{}", e.getMessage());
-// return R.error("删除失败");
-// }
-//}
+package com.mobile_education_platform.common;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.ObjectError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+/**
+ * @function: 统一异常返回类
+ * @author:
+ * @time: 2021-9-7 23:03:30
+ */
+
+@Slf4j
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+
+ // 实体校验异常捕获
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(value = MethodArgumentNotValidException.class)
+ public R handler(MethodArgumentNotValidException e) {
+
+ BindingResult result = e.getBindingResult();
+ ObjectError objectError = result.getAllErrors().stream().findFirst().get();
+
+ log.error("实体校验异常:----------------{}", objectError.getDefaultMessage());
+ return R.error(objectError.getDefaultMessage());
+ }
+
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(value = IllegalArgumentException.class)
+ public R handler(IllegalArgumentException e) {
+ log.error("Assert异常:----------------{}", e.getMessage());
+ return R.error(e.getMessage());
+ }
+
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(value = RuntimeException.class)
+ public R handler(RuntimeException e) {
+ log.error("运行时异常:----------------{}", e.getMessage());
+ return R.error(e.getMessage());
+ }
+
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(value = ParamException.class)
+
+ /**
+ * @description: 解决参数为空的异常
+ * @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());
+ }
+
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ @ExceptionHandler(value = DeleteFailure.class)
+
+ /**
+ * @description: 解决sql事务的异常
+ * @param: e
+ * @return: com.education_platform.common.R
+ * @author feng
+ * @date: 2021/10/8 20:17
+ */
+ public R transactionFailureExecprion(RuntimeException e) {
+ log.error("操作数据库删除异常:----------------{}", e.getMessage());
+ return R.error("删除失败");
+ }
+}
--
Gitee