From 88735634cc5acb360e62fae80adbe41027e46193 Mon Sep 17 00:00:00 2001
From: DELL <3189328559@qq.com>
Date: Sat, 27 Nov 2021 16:52:01 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=8A=E4=BC=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 8 +++
.idea/compiler.xml | 19 ++++++
.idea/encodings.xml | 6 ++
.idea/jarRepositories.xml | 25 ++++++++
.idea/misc.xml | 12 ++++
.idea/runConfigurations.xml | 10 +++
.idea/vcs.xml | 6 ++
.../controller/ClassmodelController.java | 64 +++++--------------
.../generator/service/ClassmodelService.java | 7 --
.../service/impl/ClassesServiceImpl.java | 4 +-
.../service/impl/ClassmodelServiceImpl.java | 17 -----
src/main/resources/application-dev.yml | 4 +-
12 files changed, 105 insertions(+), 77 deletions(-)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/jarRepositories.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/runConfigurations.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..fd4f4c8
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63e9001
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..dfaf1c0
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d5cd614
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java b/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
index 8656d86..e14a867 100644
--- a/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
+++ b/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
@@ -33,50 +33,6 @@ public class ClassmodelController {
@Autowired
private ClassmodelService classmodelService;
-
- //根据课程课程名简介图片链接
- //2021 11/20 接口类型:"写" 测试人:冯坤
- //根据课程的id修改课程的名称,简介,以及图片链接
- @RequestMapping("/alterPicture")
- public R alterPicture(@RequestParam Map map){
- Object c_id = map.get("c_id");
- Object p_name = map.get("c_name");
- Object p_introduce = map.get("c_introduce");
- Object p_link = map.get("c_link");
- if (c_id==null||p_name==null||p_introduce==null||p_link==null)
- return R.error("请求参数缺少");
- if (classmodelService.alterCoursePicture(c_id.toString(),p_link.toString())&&
- classmodelService.alterCourseName(c_id.toString(),p_name.toString())&&
- classmodelService.alterCourseIntroduce(c_id.toString(),p_introduce.toString()))
- return R.ok();
- return R.error("图片id不存在");
- }
- //课程id
- //2021 11/20 接口类型:"写" 测试人:冯坤
- //根据课程的id删除课程
- @RequestMapping("/deleteCourse")
- public R deleteCourse(@RequestParam Map map){
- Object c_id = map.get("c_id");
- if (c_id==null)
- return R.error("请求参数缺少");
- if (classmodelService.deleteCourse(c_id.toString()))
- return R.ok();
- return R.error("课程不存在");
- }
- //课程id
- //2021 11/20 接口类型:"读" 测试人:冯坤
- //根据课程查询所有参与此课程的班级对象集合
- @RequestMapping("/getClasses")
- public R getClasses(@RequestParam Map map){
- Object c_id = map.get("c_id");
- if (c_id==null)
- return R.error("请求参数缺少");
- List classes = classmodelService.getClasses(c_id.toString());
- if(classes==null){
- return R.error("课程不存在");
- }
- return R.ok().put("classes",classes);
- }
/**
* 列表
*/
@@ -84,7 +40,6 @@ public class ClassmodelController {
@RequiresPermissions("generator:classmodel:list")
public R list(@RequestParam Map params){
PageUtils page = classmodelService.queryPage(params);
-
return R.ok().put("page", page);
}
@@ -96,7 +51,6 @@ public class ClassmodelController {
@RequiresPermissions("generator:classmodel:info")
public R info(@PathVariable("classId") String classId){
ClassmodelEntity classmodel = classmodelService.getById(classId);
-
return R.ok().put("classmodel", classmodel);
}
@@ -129,10 +83,22 @@ public class ClassmodelController {
*/
@RequestMapping("/delete")
@RequiresPermissions("generator:classmodel:delete")
- public R delete(@RequestBody String[] classIds){
- classmodelService.removeByIds(Arrays.asList(classIds));
+ public R delete(@RequestParam Map map){
+ //classmodelService.removeByIds(Arrays.asList(classIds));
+ Object class_id=map.get("class_id");
+ boolean b = classmodelService.deleteCourse(class_id.toString());
+ if(b)
+ return R.ok();
+ return R.error("删除课程失败!");
- return R.ok();
+ }
+ @RequestMapping("/deleteClassModelById")
+ public R deleteClassModelById(@RequestParam Map map){
+ Object class_id=map.get("class_id");
+ boolean b = classmodelService.deleteCourse(class_id.toString());
+ if(b)
+ return R.ok();
+ return R.error("删除课程失败!");
}
}
diff --git a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
index b969c0a..d6832ec 100644
--- a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
+++ b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
@@ -28,12 +28,5 @@ public interface ClassmodelService extends IService {
//根据课程id 来删除课程
Boolean deleteCourse(String cid);
-
- /**
- * //根据课程id 来查询课程对应的班级组,将班级组(班号)用spilt方法分隔为班级id数组,对每个班级id查询其对象,返回给前端
- * @param cid
- * @return
- */
- List getClasses(String cid);
}
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
index 3ad8b86..c58e3fa 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
@@ -28,7 +28,7 @@ public class ClassesServiceImpl extends ServiceImpl i
@Autowired
private ClassesDao classesDao;
- ClassesDao classesDao;
+
@Autowired
ClassmodelDao classmodelDao;
@@ -129,7 +129,7 @@ public class ClassesServiceImpl extends ServiceImpl i
return delete>0?true:false;
}
-}
+
//根据班级id获取所有的课程对象 如果班级不存在返回null
@Override
public List getAllClassModel(String classId) {
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
index 3cf5107..2126744 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
@@ -86,22 +86,5 @@ public class ClassmodelServiceImpl extends ServiceImpl getClasses(String cid) {
-
- ClassmodelEntity classmodelEntity = classmodelDao.selectById(cid);
- String classCnumber = classmodelEntity.getClassCnumber();
- String[] arr = classCnumber.split(",,");
- List strings = Arrays.asList(arr);
- List classesEntities = classesDao.selectBatchIds(strings);
- return classesEntities;
- }
-
}
\ No newline at end of file
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index c8a6571..1e2e2fa 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -3,7 +3,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/ckedu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://localhost:3306/ckedu-2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
initial-size: 10
@@ -46,4 +46,4 @@ spring:
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/renren_security
# username: renren
-# password: 123456
+# password: 123456
\ No newline at end of file
--
Gitee
From f9b15d8e775e1c0f94ae925f7ecefbe6438a30ee Mon Sep 17 00:00:00 2001
From: DELL <3189328559@qq.com>
Date: Sat, 27 Nov 2021 16:52:01 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E7=9A=84=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 8 ++
.idea/compiler.xml | 19 +++
.idea/encodings.xml | 6 +
.idea/jarRepositories.xml | 25 ++++
.idea/misc.xml | 12 ++
.idea/runConfigurations.xml | 10 ++
.idea/vcs.xml | 6 +
.../controller/ClassmodelController.java | 130 +++++++-----------
.../controller/TeacherController.java | 35 +++--
.../generator/service/ClassmodelService.java | 32 ++---
.../generator/service/TeacherService.java | 5 +-
.../service/impl/ClassesServiceImpl.java | 4 +-
.../service/impl/ClassmodelServiceImpl.java | 113 +++++++--------
.../service/impl/TeacherServiceImpl.java | 36 +++--
.../generator/util/OssUploadService.java | 31 +++--
.../generator/utils/OssUploadService.java | 30 ++--
src/main/resources/application-dev.yml | 4 +-
17 files changed, 307 insertions(+), 199 deletions(-)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/jarRepositories.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/runConfigurations.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..fd4f4c8
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63e9001
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..dfaf1c0
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d5cd614
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java b/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
index 8656d86..e1e24be 100644
--- a/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
+++ b/src/main/java/io/renren/modules/generator/controller/ClassmodelController.java
@@ -5,19 +5,16 @@ import java.util.List;
import java.util.Map;
import io.renren.modules.generator.entity.ClassesEntity;
+import io.renren.modules.generator.utils.OssUploadService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import io.renren.modules.generator.entity.ClassmodelEntity;
import io.renren.modules.generator.service.ClassmodelService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
-
+import org.springframework.web.multipart.MultipartFile;
/**
@@ -33,50 +30,59 @@ public class ClassmodelController {
@Autowired
private ClassmodelService classmodelService;
-
- //根据课程课程名简介图片链接
- //2021 11/20 接口类型:"写" 测试人:冯坤
- //根据课程的id修改课程的名称,简介,以及图片链接
- @RequestMapping("/alterPicture")
- public R alterPicture(@RequestParam Map map){
- Object c_id = map.get("c_id");
- Object p_name = map.get("c_name");
- Object p_introduce = map.get("c_introduce");
- Object p_link = map.get("c_link");
- if (c_id==null||p_name==null||p_introduce==null||p_link==null)
- return R.error("请求参数缺少");
- if (classmodelService.alterCoursePicture(c_id.toString(),p_link.toString())&&
- classmodelService.alterCourseName(c_id.toString(),p_name.toString())&&
- classmodelService.alterCourseIntroduce(c_id.toString(),p_introduce.toString()))
- return R.ok();
- return R.error("图片id不存在");
+ /*
+ * 创建课程,测试人温雪婷
+ * */
+ @PostMapping("/save")
+ public R save(@RequestPart("classmodel") ClassmodelEntity classmodel, @RequestPart("file") MultipartFile file){
+ return R.ok().put("classmodel",classmodelService.createClassModel(classmodel,file));
}
- //课程id
- //2021 11/20 接口类型:"写" 测试人:冯坤
- //根据课程的id删除课程
- @RequestMapping("/deleteCourse")
- public R deleteCourse(@RequestParam Map map){
- Object c_id = map.get("c_id");
- if (c_id==null)
- return R.error("请求参数缺少");
- if (classmodelService.deleteCourse(c_id.toString()))
+ /*
+ * 更新课程,测试人温雪婷
+ * */
+ @PostMapping("/update")
+ public R update(@RequestPart("classmodel") ClassmodelEntity classmodel, @RequestPart("file") MultipartFile file){
+ return R.ok().put("classmodel",classmodelService.updateClassModel(classmodel,file));
+ }
+
+ /**
+ * 删除课程,测试人温雪婷
+ */
+ @RequestMapping("/deleteClassModelById")
+ public R deleteClassModelById(@RequestParam Map map){
+ Object class_id=map.get("class_id");
+ boolean b = classmodelService.deleteCourse(class_id.toString());
+ if(b)
return R.ok();
- return R.error("课程不存在");
+ return R.error("删除课程失败!");
}
- //课程id
- //2021 11/20 接口类型:"读" 测试人:冯坤
- //根据课程查询所有参与此课程的班级对象集合
- @RequestMapping("/getClasses")
- public R getClasses(@RequestParam Map map){
- Object c_id = map.get("c_id");
- if (c_id==null)
+ /*
+ * 根据课程id,查询课程。测试人温雪婷
+ * */
+ @RequestMapping("/queryClassModelById")
+ public R queryClassModelById(@RequestParam Map map){
+ Object class_id = map.get("class_id");
+ if (class_id==null)
return R.error("请求参数缺少");
- List classes = classmodelService.getClasses(c_id.toString());
- if(classes==null){
- return R.error("课程不存在");
+ ClassmodelEntity classmodel=classmodelService.queryClassModelById(class_id.toString());
+ if(classmodel==null){
+ return R.error("不存在此课程ID!");
+ }
+ return R.ok().put("classmodel",classmodel);
+ }
+ /*
+ * 查询所有课程,测试人温雪婷
+ * */
+ @RequestMapping("/queryClassModelAll")
+ public R queryClassModelAll(@RequestParam Map map){
+ List classmodelEntities=classmodelService.getClasseModels();
+ if(classmodelEntities==null){
+ return R.error("您的课程为空,请先创建课程");
}
- return R.ok().put("classes",classes);
+ return R.ok().put("classmodelEntities",classmodelEntities);
}
+
+
/**
* 列表
*/
@@ -84,11 +90,8 @@ public class ClassmodelController {
@RequiresPermissions("generator:classmodel:list")
public R list(@RequestParam Map params){
PageUtils page = classmodelService.queryPage(params);
-
return R.ok().put("page", page);
}
-
-
/**
* 信息
*/
@@ -96,43 +99,10 @@ public class ClassmodelController {
@RequiresPermissions("generator:classmodel:info")
public R info(@PathVariable("classId") String classId){
ClassmodelEntity classmodel = classmodelService.getById(classId);
-
return R.ok().put("classmodel", classmodel);
}
- /**
- * 保存
- */
- @RequestMapping("/save")
- @RequiresPermissions("generator:classmodel:save")
- public R save(@RequestBody ClassmodelEntity classmodel){
- classmodelService.save(classmodel);
- return R.ok();
- }
- /**
- * 修改
- */
- @RequestMapping("/update")
- @RequiresPermissions("generator:classmodel:update")
- public R update(@RequestBody ClassmodelEntity classmodel){
- classmodelService.updateById(classmodel);
- classmodelService.alterCourseName(classmodel.getClassId(),classmodel.getClassName());
- classmodelService.alterCourseIntroduce(classmodel.getClassId(),classmodel.getClassIntroduce());
- classmodelService.alterCoursePicture(classmodel.getClassId(),classmodel.getClassPicnumber());
- return R.ok();
- }
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- @RequiresPermissions("generator:classmodel:delete")
- public R delete(@RequestBody String[] classIds){
- classmodelService.removeByIds(Arrays.asList(classIds));
-
- return R.ok();
- }
}
diff --git a/src/main/java/io/renren/modules/generator/controller/TeacherController.java b/src/main/java/io/renren/modules/generator/controller/TeacherController.java
index 195f44c..d5b78b6 100644
--- a/src/main/java/io/renren/modules/generator/controller/TeacherController.java
+++ b/src/main/java/io/renren/modules/generator/controller/TeacherController.java
@@ -30,19 +30,6 @@ import io.renren.common.utils.R;
public class TeacherController {
@Autowired
private TeacherService teacherService;
-
- /**
- * 列表
- */
- @RequestMapping("/list")
- @RequiresPermissions("generator:teacher:list")
- public R list(@RequestParam Map params){
- PageUtils page = teacherService.queryPage(params);
-
- return R.ok().put("page", page);
- }
-
-
/**
* 信息
*/
@@ -64,6 +51,28 @@ public class TeacherController {
return R.ok();
}
+ /**
+ * 注册时,插入教师的信息。
+ */
+ @RequestMapping("/register")
+ public R register(@RequestBody TeacherEntity teacher){
+ int b=teacherService.register(teacher);
+ if (b == 0) {
+ return R.error("注册失败");
+ }
+ return R.ok();
+ }
+ /**
+ * 教师登录,进行核验
+ */
+ @RequestMapping("/login")
+ public R login(@RequestBody TeacherEntity teacher){
+ int b=teacherService.login(teacher);
+ if (b == 0) {
+ return R.error("登陆失败,请检查您的用户名称和密码");
+ }
+ return R.ok();
+ }
/**
* 修改
diff --git a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
index b969c0a..c2d07cd 100644
--- a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
+++ b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
@@ -2,8 +2,8 @@ package io.renren.modules.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
-import io.renren.modules.generator.entity.ClassesEntity;
import io.renren.modules.generator.entity.ClassmodelEntity;
+import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@@ -16,24 +16,22 @@ import java.util.Map;
* @date 2021-11-20 16:36:43
*/
public interface ClassmodelService extends IService {
- //根据课程id 来修改课程名称
- Boolean alterCourseName(String cid,String cname);
-
- //根据课程id 来修改课程简介
- Boolean alterCourseIntroduce(String cid,String cintroduce);
-
- //根据课程id 来修改课程图片
- Boolean alterCoursePicture(String cid,String link);
PageUtils queryPage(Map params);
- //根据课程id 来删除课程
- Boolean deleteCourse(String cid);
+ //创建课程
+ ClassmodelEntity createClassModel(ClassmodelEntity classmodelEntity, MultipartFile multipartFile);
+ //更新课程
+ int updateClassModel(ClassmodelEntity classmodelEntity,MultipartFile multipartFile);
+ //删除课程
+ Boolean deleteCourse(String class_id);
+ //查询单个课程信息
+ ClassmodelEntity queryClassModelById(String class_id);
+ //查询所有课程信息
+ List getClasseModels();
+ //查询该课程下所有班级
+ List getClasses(String class_id);
+ //根据课程id查找班级(将班号加到课程的班级组中)
+
- /**
- * //根据课程id 来查询课程对应的班级组,将班级组(班号)用spilt方法分隔为班级id数组,对每个班级id查询其对象,返回给前端
- * @param cid
- * @return
- */
- List getClasses(String cid);
}
diff --git a/src/main/java/io/renren/modules/generator/service/TeacherService.java b/src/main/java/io/renren/modules/generator/service/TeacherService.java
index b6ed290..0cfe41a 100644
--- a/src/main/java/io/renren/modules/generator/service/TeacherService.java
+++ b/src/main/java/io/renren/modules/generator/service/TeacherService.java
@@ -14,7 +14,8 @@ import java.util.Map;
* @date 2021-11-20 16:36:43
*/
public interface TeacherService extends IService {
-
- PageUtils queryPage(Map params);
+ //注册账号
+ int register(TeacherEntity teacherEntity);
+ int login(TeacherEntity teacherEntity);
}
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
index 3ad8b86..c58e3fa 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassesServiceImpl.java
@@ -28,7 +28,7 @@ public class ClassesServiceImpl extends ServiceImpl i
@Autowired
private ClassesDao classesDao;
- ClassesDao classesDao;
+
@Autowired
ClassmodelDao classmodelDao;
@@ -129,7 +129,7 @@ public class ClassesServiceImpl extends ServiceImpl i
return delete>0?true:false;
}
-}
+
//根据班级id获取所有的课程对象 如果班级不存在返回null
@Override
public List getAllClassModel(String classId) {
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
index 3cf5107..50c0eed 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
@@ -1,12 +1,12 @@
package io.renren.modules.generator.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import io.renren.common.validator.Assert;
import io.renren.modules.generator.dao.ClassesDao;
-import io.renren.modules.generator.entity.ClassesEntity;
+import io.renren.modules.generator.utils.OssUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -18,6 +18,7 @@ import io.renren.common.utils.Query;
import io.renren.modules.generator.dao.ClassmodelDao;
import io.renren.modules.generator.entity.ClassmodelEntity;
import io.renren.modules.generator.service.ClassmodelService;
+import org.springframework.web.multipart.MultipartFile;
@Service("classmodelService")
@@ -28,42 +29,6 @@ public class ClassmodelServiceImpl extends ServiceImpl updateWrapper=new UpdateWrapper<>();
- updateWrapper.eq("class_id",cid).set("class_name",cname);
- int update = classmodelDao.update(null, updateWrapper);
- if(update==1){
- return true;
- }
- else
- return false;
- }
-
- @Override
- public Boolean alterCourseIntroduce(String cid,String cintroduce) {
- UpdateWrapper updateWrapper=new UpdateWrapper<>();
- updateWrapper.eq("class_id",cid).set("class_introduce",cintroduce);
- int update = classmodelDao.update(null, updateWrapper);
- if(update==1){
- return true;
- }
- else
- return false;
- }
-
- @Override
- public Boolean alterCoursePicture(String cid,String link) {
- UpdateWrapper updateWrapper=new UpdateWrapper<>();
- updateWrapper.eq("class_id",cid).set("class_picNumber",link);
- int update = classmodelDao.update(null, updateWrapper);
- if(update==1){
- return true;
- }
- else
- return false;
- }
-
@Override
public PageUtils queryPage(Map params) {
IPage page = this.page(
@@ -73,35 +38,73 @@ public class ClassmodelServiceImpl extends ServiceImpl updateWrapper=new UpdateWrapper<>();
+ updateWrapper.eq("class_id",classmodelEntity.getClassId());
+ return classmodelDao.update(classmodelEntity,updateWrapper);
+ }
+
//根据课程id 来删除课程
@Override
- public Boolean deleteCourse(String cid) {
- UpdateWrapper updateWrapper=new UpdateWrapper<>();
- updateWrapper.eq("class_id",cid);
- int delete = classmodelDao.delete(updateWrapper);
+ public Boolean deleteCourse(String class_id) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ int delete = classmodelDao.delete(queryWrapper.eq("class_id",class_id));
if(delete==1){
return true;
}
return false;
}
-
- /**
- * //根据课程id 来查询课程对应的班级组,将班级组(班号)用spilt方法分隔为班级id数组,对每个班级id查询其对象,返回给前端
- *
- * @param cid
- * @return
+ /*
+ *根据课程id查询对应的课程信息
*/
@Override
- public List getClasses(String cid) {
-
- ClassmodelEntity classmodelEntity = classmodelDao.selectById(cid);
- String classCnumber = classmodelEntity.getClassCnumber();
- String[] arr = classCnumber.split(",,");
- List strings = Arrays.asList(arr);
- List classesEntities = classesDao.selectBatchIds(strings);
+ public ClassmodelEntity queryClassModelById(String class_id) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ ClassmodelEntity classmodel = classmodelDao.selectOne(queryWrapper.eq("class_id",class_id));
+ return classmodel;
+ }
+ /*
+ * 加载所有的课程信息
+ * */
+ @Override
+ public List getClasseModels() {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.like("class_id","");
+ List classesEntities=classmodelDao.selectList(queryWrapper);
return classesEntities;
}
+ /*
+ * 查询该课程下所开设的班级
+ * */
+ @Override
+ public List getClasses(String class_id) {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
index 38d6a7d..749629e 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
@@ -1,5 +1,11 @@
package io.renren.modules.generator.service.impl;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.renren.modules.generator.dao.ClassmodelDao;
+import io.renren.modules.generator.entity.ActivemodelEntity;
+import io.renren.modules.generator.entity.ClassesEntity;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -11,19 +17,33 @@ import io.renren.common.utils.Query;
import io.renren.modules.generator.dao.TeacherDao;
import io.renren.modules.generator.entity.TeacherEntity;
import io.renren.modules.generator.service.TeacherService;
-
+import java.util.Random;
@Service("teacherService")
public class TeacherServiceImpl extends ServiceImpl implements TeacherService {
+ @Autowired
+ TeacherDao teacherDao;
+ //注册账号
@Override
- public PageUtils queryPage(Map params) {
- IPage page = this.page(
- new Query().getPage(params),
- new QueryWrapper()
- );
-
- return new PageUtils(page);
+ public int register(TeacherEntity teacherEntity) {
+ Random random = new Random();
+ int rannum = (int) (random.nextDouble() * (99999 - 10000 + 1)) + 10000;// 获取5位随机数
+ teacherEntity.setTUsername(teacherEntity.getTName()+"@"+rannum);
+ int b=teacherDao.insert(teacherEntity);
+ return b;
}
+ @Override
+ public int login(TeacherEntity teacherEntity) {
+ QueryWrapper queryWrapper=new QueryWrapper<>();
+ queryWrapper.eq("t_username",teacherEntity.getTUsername());
+ queryWrapper.eq("t_password",teacherEntity.getTPassword());
+ TeacherEntity b=teacherDao.selectOne(queryWrapper);
+ if(b==null){
+ return 0;
+ }
+ else
+ return 1;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/io/renren/modules/generator/util/OssUploadService.java b/src/main/java/io/renren/modules/generator/util/OssUploadService.java
index 28caa15..ec19f7f 100644
--- a/src/main/java/io/renren/modules/generator/util/OssUploadService.java
+++ b/src/main/java/io/renren/modules/generator/util/OssUploadService.java
@@ -24,11 +24,17 @@ public class OssUploadService {
public static String uploadFileByFile(File multipartFile){
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
- String endpoint = "oss-cn-beijing.aliyuncs.com";
- // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
- String accessKeyId = "LTAI5tDF24ysrBBSaHfk7uNi";
- String accessKeySecret = "H3YolcFdB1Tiy0LTrMa7fXJ3CVZW10";
- String BUCKETNAME="ckedu2";
+ String endpoint = "oss-cn-beijing.aliyuncs.com";
+
+ // accessKeyId和accessKeySecret是OSS的访问密钥,您可以在控制台上创建和查看,
+ // 创建和查看访问密钥的链接地址是:https://ak-console.aliyun.com/#/。
+ // 注意:accessKeyId和accessKeySecret前后都没有空格,从控制台复制时请检查并去除多余的空格。
+ String accessKeyId = "LTAI5t6DDRUxs4QBieJoqX4z";
+ String accessKeySecret = "ZX7OaAeTyjuqwM56VDLws36SsMAH0y";
+
+ // Bucket用来管理所存储Object的存储空间,详细描述请参看“开发人员指南 > 基本概念 > OSS基本概念介绍”。
+ // Bucket命名规范如下:只能包括小写字母,数字和短横线(-),必须以小写字母或者数字开头,长度必须在3-63字节之间。
+ String BUCKETNAME = "daiyuwen";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
try {
@@ -68,12 +74,17 @@ public class OssUploadService {
public static String uploadFileByMultipartFile(MultipartFile multipartFile){
- // yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "oss-cn-beijing.aliyuncs.com";
- // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
- String accessKeyId = "LTAI5tDF24ysrBBSaHfk7uNi";
- String accessKeySecret = "H3YolcFdB1Tiy0LTrMa7fXJ3CVZW10";
- String BUCKETNAME="ckedu2";
+
+ // accessKeyId和accessKeySecret是OSS的访问密钥,您可以在控制台上创建和查看,
+ // 创建和查看访问密钥的链接地址是:https://ak-console.aliyun.com/#/。
+ // 注意:accessKeyId和accessKeySecret前后都没有空格,从控制台复制时请检查并去除多余的空格。
+ String accessKeyId = "LTAI5t6DDRUxs4QBieJoqX4z";
+ String accessKeySecret = "ZX7OaAeTyjuqwM56VDLws36SsMAH0y";
+
+ // Bucket用来管理所存储Object的存储空间,详细描述请参看“开发人员指南 > 基本概念 > OSS基本概念介绍”。
+ // Bucket命名规范如下:只能包括小写字母,数字和短横线(-),必须以小写字母或者数字开头,长度必须在3-63字节之间。
+ String BUCKETNAME = "daiyuwen";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
try {
diff --git a/src/main/java/io/renren/modules/generator/utils/OssUploadService.java b/src/main/java/io/renren/modules/generator/utils/OssUploadService.java
index 9cece6c..1abdb32 100644
--- a/src/main/java/io/renren/modules/generator/utils/OssUploadService.java
+++ b/src/main/java/io/renren/modules/generator/utils/OssUploadService.java
@@ -23,12 +23,17 @@ public class OssUploadService {
public static String uploadFileByFile(File multipartFile){
- // yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "oss-cn-beijing.aliyuncs.com";
- // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
- String accessKeyId = "LTAI5tDF24ysrBBSaHfk7uNi";
- String accessKeySecret = "H3YolcFdB1Tiy0LTrMa7fXJ3CVZW10";
- String BUCKETNAME="ckedu2";
+
+ // accessKeyId和accessKeySecret是OSS的访问密钥,您可以在控制台上创建和查看,
+ // 创建和查看访问密钥的链接地址是:https://ak-console.aliyun.com/#/。
+ // 注意:accessKeyId和accessKeySecret前后都没有空格,从控制台复制时请检查并去除多余的空格。
+ String accessKeyId = "LTAI5t6DDRUxs4QBieJoqX4z";
+ String accessKeySecret = "ZX7OaAeTyjuqwM56VDLws36SsMAH0y";
+
+ // Bucket用来管理所存储Object的存储空间,详细描述请参看“开发人员指南 > 基本概念 > OSS基本概念介绍”。
+ // Bucket命名规范如下:只能包括小写字母,数字和短横线(-),必须以小写字母或者数字开头,长度必须在3-63字节之间。
+ String BUCKETNAME = "daiyuwen";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
try {
@@ -68,12 +73,17 @@ public class OssUploadService {
public static String uploadFileByMultipartFile(MultipartFile multipartFile){
- // yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "oss-cn-beijing.aliyuncs.com";
- // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
- String accessKeyId = "LTAI5tDF24ysrBBSaHfk7uNi";
- String accessKeySecret = "H3YolcFdB1Tiy0LTrMa7fXJ3CVZW10";
- String BUCKETNAME="ckedu2";
+
+ // accessKeyId和accessKeySecret是OSS的访问密钥,您可以在控制台上创建和查看,
+ // 创建和查看访问密钥的链接地址是:https://ak-console.aliyun.com/#/。
+ // 注意:accessKeyId和accessKeySecret前后都没有空格,从控制台复制时请检查并去除多余的空格。
+ String accessKeyId = "LTAI5t6DDRUxs4QBieJoqX4z";
+ String accessKeySecret = "ZX7OaAeTyjuqwM56VDLws36SsMAH0y";
+
+ // Bucket用来管理所存储Object的存储空间,详细描述请参看“开发人员指南 > 基本概念 > OSS基本概念介绍”。
+ // Bucket命名规范如下:只能包括小写字母,数字和短横线(-),必须以小写字母或者数字开头,长度必须在3-63字节之间。
+ String BUCKETNAME = "daiyuwen";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
try {
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index c8a6571..1e2e2fa 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -3,7 +3,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/ckedu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://localhost:3306/ckedu-2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
initial-size: 10
@@ -46,4 +46,4 @@ spring:
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/renren_security
# username: renren
-# password: 123456
+# password: 123456
\ No newline at end of file
--
Gitee
From 198cb8b6ba61190f2f79f97734af1c43c214ce6d Mon Sep 17 00:00:00 2001
From: DELL <3189328559@qq.com>
Date: Sun, 28 Nov 2021 11:26:20 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8B=E7=9A=84?=
=?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/compiler.xml | 2 ++
.../java/io/renren/modules/generator/dao/ClassesDao.java | 8 +++++++-
.../modules/generator/service/ClassmodelService.java | 3 ++-
.../generator/service/impl/ClassmodelServiceImpl.java | 7 +++++--
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fd4f4c8..5adbc3e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -8,11 +8,13 @@
+
+
diff --git a/src/main/java/io/renren/modules/generator/dao/ClassesDao.java b/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
index 32cdbdf..5ce59a1 100644
--- a/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
+++ b/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
@@ -1,9 +1,13 @@
package io.renren.modules.generator.dao;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.modules.generator.entity.ClassesEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.renren.modules.generator.entity.ClassmodelEntity;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 班级表
*
@@ -13,5 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ClassesDao extends BaseMapper {
-
+
+
+ List selectList(QueryWrapper c_mid);
}
diff --git a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
index c2d07cd..accbc4c 100644
--- a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
+++ b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
@@ -2,6 +2,7 @@ package io.renren.modules.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
+import io.renren.modules.generator.entity.ClassesEntity;
import io.renren.modules.generator.entity.ClassmodelEntity;
import org.springframework.web.multipart.MultipartFile;
@@ -28,7 +29,7 @@ public interface ClassmodelService extends IService {
//查询所有课程信息
List getClasseModels();
//查询该课程下所有班级
- List getClasses(String class_id);
+ List getClasses(String class_id);
//根据课程id查找班级(将班号加到课程的班级组中)
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
index 50c0eed..8e91594 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
@@ -3,6 +3,7 @@ package io.renren.modules.generator.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.renren.common.validator.Assert;
import io.renren.modules.generator.dao.ClassesDao;
+import io.renren.modules.generator.entity.ClassesEntity;
import io.renren.modules.generator.utils.OssUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -102,8 +103,10 @@ public class ClassmodelServiceImpl extends ServiceImpl getClasses(String class_id) {
- return null;
+ public List getClasses(String class_id) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ List classesEntities=classesDao.selectList(queryWrapper.like("c_mid",class_id));
+ return classesEntities;
}
--
Gitee
From d3b38bbedef03a346ee3f0643ee81a1735818be7 Mon Sep 17 00:00:00 2001
From: Aurox
Date: Sun, 28 Nov 2021 11:26:20 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AF=BE=E7=A8=8Bid?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=8F=AD=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/vcs.xml | 2 +-
.../java/io/renren/modules/generator/dao/ClassesDao.java | 8 +++++++-
.../modules/generator/service/ClassmodelService.java | 3 ++-
.../generator/service/impl/ClassmodelServiceImpl.java | 7 +++++--
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/io/renren/modules/generator/dao/ClassesDao.java b/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
index 32cdbdf..5ce59a1 100644
--- a/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
+++ b/src/main/java/io/renren/modules/generator/dao/ClassesDao.java
@@ -1,9 +1,13 @@
package io.renren.modules.generator.dao;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.modules.generator.entity.ClassesEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.renren.modules.generator.entity.ClassmodelEntity;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 班级表
*
@@ -13,5 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ClassesDao extends BaseMapper {
-
+
+
+ List selectList(QueryWrapper c_mid);
}
diff --git a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
index c2d07cd..accbc4c 100644
--- a/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
+++ b/src/main/java/io/renren/modules/generator/service/ClassmodelService.java
@@ -2,6 +2,7 @@ package io.renren.modules.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
+import io.renren.modules.generator.entity.ClassesEntity;
import io.renren.modules.generator.entity.ClassmodelEntity;
import org.springframework.web.multipart.MultipartFile;
@@ -28,7 +29,7 @@ public interface ClassmodelService extends IService {
//查询所有课程信息
List getClasseModels();
//查询该课程下所有班级
- List getClasses(String class_id);
+ List getClasses(String class_id);
//根据课程id查找班级(将班号加到课程的班级组中)
diff --git a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
index 50c0eed..7d52360 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/ClassmodelServiceImpl.java
@@ -3,6 +3,7 @@ package io.renren.modules.generator.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.renren.common.validator.Assert;
import io.renren.modules.generator.dao.ClassesDao;
+import io.renren.modules.generator.entity.ClassesEntity;
import io.renren.modules.generator.utils.OssUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -102,8 +103,10 @@ public class ClassmodelServiceImpl extends ServiceImpl getClasses(String class_id) {
- return null;
+ public List getClasses(String class_id) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ List classesEntities=classesDao.selectList(queryWrapper.like("c_mid",class_id));
+ return classesEntities;
}
--
Gitee
From d55e540a97199156402d18dbea2b569bd82bc68f Mon Sep 17 00:00:00 2001
From: DELL <3189328559@qq.com>
Date: Sun, 28 Nov 2021 16:01:12 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E7=99=BB=E9=99=86=E5=92=8C=E6=B3=A8?=
=?UTF-8?q?=E5=86=8C=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/TeacherController.java | 8 ++++---
.../generator/service/TeacherService.java | 3 ++-
.../service/impl/TeacherServiceImpl.java | 21 ++++++++++++++-----
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/main/java/io/renren/modules/generator/controller/TeacherController.java b/src/main/java/io/renren/modules/generator/controller/TeacherController.java
index e7eab3d..387c7db 100644
--- a/src/main/java/io/renren/modules/generator/controller/TeacherController.java
+++ b/src/main/java/io/renren/modules/generator/controller/TeacherController.java
@@ -2,7 +2,9 @@ package io.renren.modules.generator.controller;
import java.util.Arrays;
import java.util.Map;
+import java.util.UUID;
+import io.renren.modules.generator.entity.StudentEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
@@ -59,14 +61,14 @@ public class TeacherController {
if (b == 0) {
return R.error("注册失败");
}
- return R.ok();
+ return R.ok().put("teacher",teacher);
}
/**
* 教师登录,进行核验
*/
@RequestMapping("/login")
- public R login(@RequestBody TeacherEntity teacher){
- int b=teacherService.login(teacher);
+ public R login(@RequestParam(value="username") String username,@RequestParam(value="password") String password){
+ int b=teacherService.login(username,password);
if (b == 0) {
return R.error("登陆失败,请检查您的用户名称和密码");
}
diff --git a/src/main/java/io/renren/modules/generator/service/TeacherService.java b/src/main/java/io/renren/modules/generator/service/TeacherService.java
index 0cfe41a..32f89ba 100644
--- a/src/main/java/io/renren/modules/generator/service/TeacherService.java
+++ b/src/main/java/io/renren/modules/generator/service/TeacherService.java
@@ -2,6 +2,7 @@ package io.renren.modules.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
+import io.renren.modules.generator.entity.StudentEntity;
import io.renren.modules.generator.entity.TeacherEntity;
import java.util.Map;
@@ -16,6 +17,6 @@ import java.util.Map;
public interface TeacherService extends IService {
//注册账号
int register(TeacherEntity teacherEntity);
- int login(TeacherEntity teacherEntity);
+ int login(String username,String password);
}
diff --git a/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java b/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
index 306878a..c881df7 100644
--- a/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
+++ b/src/main/java/io/renren/modules/generator/service/impl/TeacherServiceImpl.java
@@ -3,8 +3,10 @@ package io.renren.modules.generator.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.generator.dao.ClassmodelDao;
+import io.renren.modules.generator.dao.StudentDao;
import io.renren.modules.generator.entity.ActivemodelEntity;
import io.renren.modules.generator.entity.ClassesEntity;
+import io.renren.modules.generator.entity.StudentEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@@ -18,11 +20,15 @@ import io.renren.modules.generator.dao.TeacherDao;
import io.renren.modules.generator.entity.TeacherEntity;
import io.renren.modules.generator.service.TeacherService;
import java.util.Random;
+import java.util.UUID;
@Service("teacherService")
public class TeacherServiceImpl extends ServiceImpl implements TeacherService {
@Autowired
TeacherDao teacherDao;
+ @Autowired
+ StudentDao studentDao;
+
//注册账号
@Override
@@ -30,18 +36,23 @@ public class TeacherServiceImpl extends ServiceImpl i
Random random = new Random();
int rannum = (int) (random.nextDouble() * (99999 - 10000 + 1)) + 10000;// 获取5位随机数
teacherEntity.setTUsername(teacherEntity.getTName()+"@"+rannum);
+ teacherEntity.setTId(UUID.randomUUID().toString());
+ System.out.println(teacherEntity);
int b=teacherDao.insert(teacherEntity);
return b;
}
@Override
- public int login(TeacherEntity teacherEntity) {
+ public int login(String username,String password) {
QueryWrapper queryWrapper=new QueryWrapper<>();
- System.out.println(teacherEntity);
- queryWrapper.eq("t_username",teacherEntity.getTUsername());
- queryWrapper.eq("t_password",teacherEntity.getTPassword());
+ QueryWrapper queryWrapper1=new QueryWrapper<>();
+ queryWrapper.eq("t_username",username);
+ queryWrapper.eq("t_password",password);
+ queryWrapper1.eq("s_username",username);
+ queryWrapper1.eq("s_password",password);
TeacherEntity b=teacherDao.selectOne(queryWrapper);
- if(b==null){
+ StudentEntity student=studentDao.selectOne(queryWrapper1);
+ if(b==null&&student==null){
return 0;
}
else
--
Gitee