加缓存

beetlsql3-dev
Mlxa0324 2 years ago
parent 115e62a73e
commit 0e024d5863

@ -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<Student>{
* @param studentIds
* @return
*/
@Cacheable(value = "studentDao:getStudentExtendSchoolInfo", key = "#studentIds", unless="#result == null || #result.size() == 0")
List<StudentExtendSchoolInfo> getStudentExtendSchoolInfo(String studentIds);
/**

@ -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<Teacher>{
* @param teacherIds ID
* @return
*/
@Cacheable(value = "teacherDao:getStudentExtendSchoolInfo", key = "#teacherIds", unless="#result == null || #result.size() == 0")
List<TeacherExtendSchoolInfo> getTeacherExtendSchoolInfo(String teacherIds);
/**

@ -94,7 +94,7 @@ public interface TeacherOpenCourseMergeCourseInfoDao extends BaseMapper<TeacherO
* @param teacherOpenCourseId
* @return
*/
@Cacheable(value = "teacherOpenCourseMergeCourseInfoDao.getCourseInfoNodeByTeacherOpenCourseId", unless = "#result != null")
@Cacheable(value = "teacherOpenCourseMergeCourseInfoDao.getCourseInfoNodeByTeacherOpenCourseId", unless = "#result == null")
default TeacherOpenCourseMergeCourseInfo getCourseInfoNodeByTeacherOpenCourseId(@NotNull Long teacherOpenCourseId) {
return createLambdaQuery().andEq(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseId, teacherOpenCourseId)
.andEq(TeacherOpenCourseMergeCourseInfo::getCourseInfoStatus, 1)

@ -7,6 +7,7 @@ import com.ibeetl.jlw.dao.StudentDao;
import com.ibeetl.jlw.dao.TeacherDao;
import com.ibeetl.jlw.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@ -46,6 +47,7 @@ public class LoginTodoService {
* @Author: lx
* @Date: 2022/12/11 15:33
*/
@Cacheable(value = "loginTodoService:buildStudentLoginTodo", key = "#coreUser.id", unless = "#coreUser == null || #student == null")
public LoginTodo buildStudentLoginTodo(Student student, CoreUser coreUser, Consumer<LoginTodo> 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<LoginTodo> consumer) {
Assert.isTrue(ObjectUtil.isAllNotEmpty(teacher, coreUser), "登录的用户信息不能为空!");

@ -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);
}

@ -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#

Loading…
Cancel
Save