From 0e024d586328efa51bc373ee266c7b983a9fc3b9 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Mon, 12 Dec 2022 12:42:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ibeetl/jlw/dao/StudentDao.java | 2 ++ .../java/com/ibeetl/jlw/dao/TeacherDao.java | 2 ++ .../TeacherOpenCourseMergeCourseInfoDao.java | 2 +- .../ibeetl/jlw/service/LoginTodoService.java | 3 ++ .../web/ResourcesApplicationController.java | 12 +++++++- .../resources/sql/jlw/resourcesApplication.md | 28 +++++++++++-------- 6 files changed, 36 insertions(+), 13 deletions(-) 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 e03811e4..8c0ab260 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentDao.java @@ -11,6 +11,7 @@ import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.mapper.BaseMapper; import org.beetl.sql.mapper.annotation.SqlResource; import org.beetl.sql.mapper.annotation.Update; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; import java.util.List; @@ -56,6 +57,7 @@ public interface StudentDao extends BaseMapper{ * @param studentIds * @return */ + @Cacheable(value = "studentDao:getStudentExtendSchoolInfo", key = "#studentIds", unless="#result == null || #result.size() == 0") List getStudentExtendSchoolInfo(String studentIds); /** 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 1f8c0ba9..20c9b833 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherDao.java @@ -7,6 +7,7 @@ import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.mapper.BaseMapper; import org.beetl.sql.mapper.annotation.SqlResource; import org.beetl.sql.mapper.annotation.Update; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; import java.util.List; @@ -40,6 +41,7 @@ public interface TeacherDao extends BaseMapper{ * @param teacherIds 教师ID集合 * @return */ + @Cacheable(value = "teacherDao:getStudentExtendSchoolInfo", key = "#teacherIds", unless="#result == null || #result.size() == 0") List getTeacherExtendSchoolInfo(String teacherIds); /** diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseMergeCourseInfoDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseMergeCourseInfoDao.java index 19d7a123..1accb244 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseMergeCourseInfoDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseMergeCourseInfoDao.java @@ -94,7 +94,7 @@ public interface TeacherOpenCourseMergeCourseInfoDao extends BaseMapper consumer) { Assert.isTrue(ObjectUtil.isAllNotEmpty(student, coreUser), "登录的用户信息不能为空!"); @@ -82,6 +84,7 @@ public class LoginTodoService { * @Author: lx * @Date: 2022/12/11 15:33 */ + @Cacheable(value = "loginTodoService:buildTeacherLoginTodo", key = "#coreUser.id", unless = "#coreUser == null || #teacher == null") public LoginTodo buildTeacherLoginTodo(Teacher teacher, CoreUser coreUser, Consumer consumer) { Assert.isTrue(ObjectUtil.isAllNotEmpty(teacher, coreUser), "登录的用户信息不能为空!"); diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java index 221fe2da..1bb67259 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java @@ -1,12 +1,16 @@ package com.ibeetl.jlw.web; import cn.jlw.Interceptor.SCoreUser; +import cn.jlw.Interceptor.TStudent; +import cn.jlw.Interceptor.TTeacher; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; import com.ibeetl.admin.core.service.CorePlatformService; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.entity.ResourcesApplication; +import com.ibeetl.jlw.entity.Student; +import com.ibeetl.jlw.entity.Teacher; import com.ibeetl.jlw.service.LoginTodoService; import com.ibeetl.jlw.service.ResourcesApplicationService; import com.ibeetl.jlw.web.query.ResourcesApplicationQuery; @@ -149,11 +153,17 @@ public class ResourcesApplicationController{ */ @PostMapping(API + "/myApplication.do") @ResponseBody - public JsonResult myApplication(ResourcesApplicationQuery condition, @SCoreUser CoreUser coreUser) { + public JsonResult myApplication(ResourcesApplicationQuery condition, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student) { if(null == coreUser){ return JsonResult.failMessage("请登录后再操作"); }else{ PageQuery page = condition.getPageQuery(); + if (coreUser.isTeacher()) { + page.setPara("teacherId", teacher.getTeacherId()); + } + if (coreUser.isStudent()) { + page.setPara("studentId", student.getStudentId()); + } resourcesApplicationService.queryMyApplicationByConditionQuery(page); return JsonResult.success(page); } diff --git a/web/src/main/resources/sql/jlw/resourcesApplication.md b/web/src/main/resources/sql/jlw/resourcesApplication.md index 2c070043..32f9ca4f 100644 --- a/web/src/main/resources/sql/jlw/resourcesApplication.md +++ b/web/src/main/resources/sql/jlw/resourcesApplication.md @@ -216,20 +216,26 @@ queryMyApplicationByConditionQuery @} @// 查找老师所在的院校 @if(!isEmpty(teacherId)){ - and tb.universities_colleges_id = - (select universities_colleges_id from teacher where teacher_id = #teacherId# and teacher_status = 1 limit 1) + and t.resources_application_id in ( + (select za.type_id from universities_colleges_jurisdiction_experimental_system za where za.type = 1 and za.universities_colleges_id = + (select universities_colleges_id from teacher where teacher_id = #teacherId# and teacher_status = 1 limit 1) + ) + ) @} @// 查找学生所在的院校 @if(!isEmpty(studentId)){ - and tb.universities_colleges_id = - (SELECT - rb.universities_colleges_id - FROM - student ra - LEFT JOIN school_class rb ON rb.class_id = ra.class_id - WHERE - ra.student_status = 1 and ra.student_id = #studentId# - LIMIT 1) + and t.resources_application_id in ( + (select za.type_id from universities_colleges_jurisdiction_experimental_system za where za.type = 1 and za.universities_colleges_id = + (SELECT + rb.universities_colleges_id + FROM + student ra + LEFT JOIN school_class rb ON rb.class_id = ra.class_id + WHERE + ra.student_status = 1 and ra.student_id = #studentId# + LIMIT 1) + ) + ) @} @if(!isEmpty(universitiesCollegesId)) { and tb.universities_colleges_id = #universitiesCollegesId#