From fccfe3d7e305d43a8e1bda0d1d08036ae5f33ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B2=85?= <907037276@qq.com> Date: Mon, 6 Nov 2023 09:49:29 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81swagger=E6=8E=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ibeetl/admin/core/dao/CoreUserDao.java | 2 + .../admin/core/service/CoreUserService.java | 5 ++ .../src/main/resources/sql/core/coreUser.md | 6 +- .../com/ibeetl/jlw/dao/SchoolClassDao.java | 2 + .../java/com/ibeetl/jlw/dao/StudentDao.java | 2 + .../java/com/ibeetl/jlw/dao/TeacherDao.java | 3 + .../jlw/dao/UniversitiesCollegesDao.java | 4 ++ .../jlw/service/SchoolClassService.java | 4 ++ .../ibeetl/jlw/service/StudentService.java | 4 ++ .../ibeetl/jlw/service/TeacherService.java | 5 ++ .../service/UniversitiesCollegesService.java | 5 ++ .../com/ibeetl/jlw/web/AccountController.java | 56 +++++++++++++++++-- web/src/main/resources/sql/jlw/schoolClass.md | 6 +- web/src/main/resources/sql/jlw/student.md | 7 ++- web/src/main/resources/sql/jlw/teacher.md | 3 + .../resources/sql/jlw/universitiesColleges.md | 6 +- 16 files changed, 112 insertions(+), 8 deletions(-) diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java index dc41ddb8..b39702cf 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreUserDao.java @@ -49,4 +49,6 @@ public interface CoreUserDao extends BaseMapper { Map getAdminByNo(String username); void updateUserId(Long newId,Long oldId); + + List getCoreUserListAndOldIdIsNull(); } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java index 108caa07..4a922a8c 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java @@ -150,6 +150,11 @@ public class CoreUserService extends CoreBaseService { return coreUserDao.template(coreUser); } + + public List getCoreUserListAndOldIdIsNull(){ + return coreUserDao.getCoreUserListAndOldIdIsNull(); + } + /** * 验证 * @return diff --git a/admin-core/src/main/resources/sql/core/coreUser.md b/admin-core/src/main/resources/sql/core/coreUser.md index f7746311..3e1c2a25 100644 --- a/admin-core/src/main/resources/sql/core/coreUser.md +++ b/admin-core/src/main/resources/sql/core/coreUser.md @@ -94,4 +94,8 @@ getAdminByNo select core_user.old_id AS userId, core_user.NAME AS NAME, core_role.NAME AS roleName from core_user JOIN core_user_role ON core_user_role.USER_ID = core_user.ID -JOIN core_role ON core_user_role.ROLE_ID = core_role.ID where core_user.CODE = #username# \ No newline at end of file +JOIN core_role ON core_user_role.ROLE_ID = core_role.ID where core_user.CODE = #username# + +getCoreUserListAndOldIdIsNull +=== + select * from core_user where old_id is null \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java b/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java index b50ec5fb..56f60bba 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/SchoolClassDao.java @@ -38,4 +38,6 @@ public interface SchoolClassDao extends BaseMapper { List> getClassListByMajorId(String majorId); + List> getClassesBySchoolId(Long schoolId); + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java index 7f8e3beb..c856ef7e 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java @@ -121,4 +121,6 @@ public interface StudentDao extends BaseMapper{ PageQuery> pagedListStudentInfoByClassId(PageQuery query); + List findAllBySchoolId(Long schoolId); + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java index 4dd01ec2..4f809302 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java @@ -53,4 +53,7 @@ public interface TeacherDao extends BaseMapper{ List getTeacherExtendSchoolInfoListByUserIds(String userIds); List getTeacherUserInfoRuleInfo(Long userId, Long teacherId); + + + List findAllTeacherBySchoolId(Long schoolId); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesDao.java b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesDao.java index 853c80a4..e2b9819e 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesDao.java @@ -10,6 +10,7 @@ import org.beetl.sql.mapper.annotation.Update; import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Map; /** @@ -43,4 +44,7 @@ public interface UniversitiesCollegesDao extends BaseMapper getAllUniversitiesColleges(); + + + List> findAllUniversitiesColleges(); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java b/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java index 6a9b071f..5fa76e19 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java @@ -256,6 +256,10 @@ public class SchoolClassService extends CoreBaseService { return schoolClassDao.getClassesByOrgId(orgId); } + public List> getClassesBySchoolId(Long schoolId){ + return schoolClassDao.getClassesBySchoolId(schoolId); + } + public List> getClassListByMajorId(String majorId) { return schoolClassDao.getClassListByMajorId(majorId); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java index e0e8bb63..82b372fa 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java @@ -1631,4 +1631,8 @@ public class StudentService extends CoreBaseService { pageQuery.setParas(map); return studentDao.pagedListStudentInfoByClassId(pageQuery); } + + public List findAllBySchoolId(Long schoolId) { + return studentDao.findAllBySchoolId(schoolId); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java index c69f241f..bbfd4cce 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java @@ -828,4 +828,9 @@ public class TeacherService extends CoreBaseService { errorRowIndex, 4, StrUtil.format("已存在的教师编号:\"{}\"!", duplicateElement)); } } + + + public List findAllTeacherBySchoolId(Long schoolId){ + return teacherDao.findAllTeacherBySchoolId(schoolId); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesService.java b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesService.java index 74ed7044..f527d340 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesService.java @@ -356,4 +356,9 @@ public class UniversitiesCollegesService extends CoreBaseService createLambdaQuery() { return universitiesCollegesDao.createLambdaQuery(); } + + + public List> findAll(){ + return universitiesCollegesDao.findAllUniversitiesColleges(); + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java index 9801c1bd..eb575a05 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java @@ -51,6 +51,11 @@ public class AccountController { private SchoolClassService schoolClassService; @Autowired private UniversitySystemService universitySystemService; + @Autowired + private UniversitiesCollegesService universitiesCollegesService; + + @Autowired + private TeacherService teacherService; private final static String URL = "jdbc:sqlserver://120.79.161.177:1433;databaseName=Test.Zhiyun_v2.0;trustServerCertificate=true;encrypt=true"; private final static String USER = "sa"; @@ -104,9 +109,9 @@ public class AccountController { return JsonResult.success(userService.getStudentByNo(username)); } else if (roleName.equals("教师")) { return JsonResult.success(userService.getTeacherByNo(username)); - }else if (roleName.equals("超级管理员")) { + } else if (roleName.equals("超级管理员")) { return JsonResult.success(userService.getAdminByNo(username)); - }else{ + } else { return null; } } @@ -835,7 +840,9 @@ public class AccountController { List coreUsers = userService.getCoreUserList(coreUser); int i = 0; for (CoreUser user : coreUsers) { - if(user.getOldId()!=null){continue;} + if (user.getOldId() != null) { + continue; + } Connection conn = openConn(); PreparedStatement ps = conn.prepareStatement("select * from EduUsers where username = '" + user.getCode() + "' and IsDeleted = 0"); @@ -847,8 +854,49 @@ public class AccountController { } closeConn(conn); ps.close(); - System.out.println("已完成:"+i++); + System.out.println("已完成:" + i++); + } + return JsonResult.success(); + } + + @ApiOperation("修改用户表userid") + @PostMapping("updateUserIdAndOldIdIsNull.json") + public JsonResult updateUserIdAndOldIdIsNull() throws SQLException { + CoreUser coreUser = new CoreUser(); + List coreUsers = userService.getCoreUserListAndOldIdIsNull(); + int i = 0; + Long j = 50000L; + for (CoreUser user : coreUsers) { + j++; + user.setOldId(j); + userService.updateTemplate(user); + System.out.println("已完成:" + i++); } return JsonResult.success(); } + + @ApiOperation("根据学校id查询班级数据") + @GetMapping("getClassesBySchoolId.json") + public JsonResult>> getClassesBySchoolId(Long schoolId) { + return JsonResult.success(schoolClassService.getClassesBySchoolId(schoolId)); + } + + @ApiOperation("获取所有学校") + @GetMapping("findAllSchool.json") + public JsonResult>> findAllSchool() { + return JsonResult.success(universitiesCollegesService.findAll()); + } + + @ApiOperation("根据学校id获取学生信息") + @GetMapping("findAllStudentBySchoolId.json") + public JsonResult> findAllStudentBySchoolId(Long schoolId) { + return JsonResult.success(studentService.findAllBySchoolId(schoolId)); + } + + @ApiOperation("根据学校id获取教师信息") + @GetMapping("findAllTeacherBySchoolId.json") + public JsonResult> findAllTeacherBySchoolId(Long schoolId) { + return JsonResult.success(teacherService.findAllTeacherBySchoolId(schoolId)); + } + } diff --git a/web/src/main/resources/sql/jlw/schoolClass.md b/web/src/main/resources/sql/jlw/schoolClass.md index bb1e85da..c4e3b871 100644 --- a/web/src/main/resources/sql/jlw/schoolClass.md +++ b/web/src/main/resources/sql/jlw/schoolClass.md @@ -192,4 +192,8 @@ school_class.universities_colleges_id = universities_colleges.universities_colle getClassListByMajorId === -select class_id as id,class_name as name from school_class where university_system_id = #majorId# \ No newline at end of file +select class_id as id,class_name as name from school_class where university_system_id = #majorId# + +getClassesBySchoolId +=== +select class_id as id,class_name as name from school_class where universities_colleges_id = #schoolId# \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/student.md b/web/src/main/resources/sql/jlw/student.md index a3c9a4df..52366afb 100644 --- a/web/src/main/resources/sql/jlw/student.md +++ b/web/src/main/resources/sql/jlw/student.md @@ -2209,4 +2209,9 @@ pagedListStudentInfoByClassId join core_user on core_user.CODE = student.student_sn WHERE 1=1 @if(!isEmpty(classIds)){ and find_in_set(student.class_id ,#classIds#) - @} \ No newline at end of file + @} + + +findAllBySchoolId +=== +select * from student join universities_colleges uc on student.org_id = uc.org_id where universities_colleges_id = #schoolId# \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/teacher.md b/web/src/main/resources/sql/jlw/teacher.md index b1314650..1e64e935 100644 --- a/web/src/main/resources/sql/jlw/teacher.md +++ b/web/src/main/resources/sql/jlw/teacher.md @@ -559,3 +559,6 @@ getTeacherUserInfoRuleInfo and t.user_id =#userId# @} +findAllTeacherBySchoolId +=== +select * from teacher where universities_colleges_id =#schoolId# \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/universitiesColleges.md b/web/src/main/resources/sql/jlw/universitiesColleges.md index fb5e7b9f..c7624a8f 100644 --- a/web/src/main/resources/sql/jlw/universitiesColleges.md +++ b/web/src/main/resources/sql/jlw/universitiesColleges.md @@ -278,4 +278,8 @@ getAllUniversitiesColleges FROM universities_colleges t WHERE 1 - AND t.universities_colleges_status = 1 \ No newline at end of file + AND t.universities_colleges_status = 1 + +findAllUniversitiesColleges +=== +select universities_colleges_id as id,universities_colleges_name as name from universities_colleges \ No newline at end of file