beetlsql3-dev
Mlxa0324 2 years ago
parent 72150b929e
commit b7bccb4a00

@ -124,7 +124,7 @@ public class FunctionConsoleService extends CoreBaseService<CoreFunction> {
* @param userId * @param userId
* @return * @return
*/ */
@Cacheable(value=USER_FUNCTION_TREE_CACHE, key="userId") @Cacheable(value=USER_FUNCTION_TREE_CACHE, key="#userId", unless = "#result == null || #result.size() == 0", cacheManager = "cacheManager1Day")
public String getFunctionIdByUser(Long userId){ public String getFunctionIdByUser(Long userId){
return this.roleFunctionConsoleDao.getFunctionIdByUser(userId); return this.roleFunctionConsoleDao.getFunctionIdByUser(userId);
} }

@ -81,14 +81,14 @@ public class MenuConsoleService extends CoreBaseService<CoreMenu> {
} }
public String getMenuIdsByRoleId(Long roleId){ public String getMenuIdsByRoleId(Long roleId){
String menuIds = ""; StringBuffer stringBuffer = new StringBuffer();
CoreRoleMenu roleMenu = new CoreRoleMenu(); CoreRoleMenu roleMenu = new CoreRoleMenu();
roleMenu.setRoleId(roleId); roleMenu.setRoleId(roleId);
List<CoreRoleMenu> coreRoleMenuList = roleMenuDao.template(roleMenu); List<CoreRoleMenu> coreRoleMenuList = roleMenuDao.template(roleMenu);
for(int i=0;null != coreRoleMenuList && i<coreRoleMenuList.size();i++){ for(int i=0;null != coreRoleMenuList && i<coreRoleMenuList.size();i++){
menuIds += coreRoleMenuList.get(i).getMenuId()+","; stringBuffer.append(coreRoleMenuList.get(i).getMenuId()+",");
} }
return menuIds; return stringBuffer.toString();
} }
public void updateMenu(CoreMenu menu) { public void updateMenu(CoreMenu menu) {

@ -26,6 +26,8 @@ import org.springframework.web.servlet.ModelAndView;
import java.util.*; import java.util.*;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
/** /**
* : * :
* *
@ -189,6 +191,11 @@ public class FunctionController {
return JsonResult.success(tree); return JsonResult.success(tree);
} }
/**
* ID
*/
private static final ThreadLocal<String> currentUserRoleIds = ThreadLocal.withInitial(() -> null);
private List<FunctionNodeView> buildFunctionTree(FunctionItem node){ private List<FunctionNodeView> buildFunctionTree(FunctionItem node){
List<FunctionItem> list = node.getChildren(); List<FunctionItem> list = node.getChildren();
@ -196,8 +203,14 @@ public class FunctionController {
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
CoreUser currentUser = platformService.getCurrentUser(); if(currentUserRoleIds.get() == null) {
String ids = functionConsoleService.getFunctionIdByUser(currentUser.getId()); CoreUser user = getUser();
// 非管理员才查询权限ID.避免数据量过大,数据库压力大
if(!user.isAdmin()) {
currentUserRoleIds.set(functionConsoleService.getFunctionIdByUser(user.getId()));
}
}
String ids = currentUserRoleIds.get();
List<FunctionNodeView> views = new ArrayList<FunctionNodeView>(list.size()); List<FunctionNodeView> views = new ArrayList<FunctionNodeView>(list.size());
for(FunctionItem item :list){ for(FunctionItem item :list){

@ -188,11 +188,11 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* - * -
* *
* *
* @param questionSettingId ID * @param teacherOpenCourseQuestionSettingId ID
* @return * @return
*/ */
public TeacherOpenCourseQuestionLogScoreInfo getScoreInfo( public TeacherOpenCourseQuestionLogScoreInfo getScoreInfo(
@NotNull(message = "开课题目配置ID不能为空") final Long questionSettingId) { @NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId) {
// 查询学生身份 // 查询学生身份
Student student = studentDao.getByUserId(getUserId()); Student student = studentDao.getByUserId(getUserId());
@ -203,7 +203,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
new SQLReady("SELECT " + new SQLReady("SELECT " +
"? as teacher_open_course_question_setting_id, " + "? as teacher_open_course_question_setting_id, " +
"? as student_id ", "? as student_id ",
questionSettingId, student.getStudentId() teacherOpenCourseQuestionSettingId, student.getStudentId()
), ),
TeacherOpenCourseQuestionLogScoreInfo.class TeacherOpenCourseQuestionLogScoreInfo.class
); );

@ -234,11 +234,10 @@ public class ResourcesQuestionSnapshotController{
@Function("teacherOpenCourseQuestionLog.query") @Function("teacherOpenCourseQuestionLog.query")
@ResponseBody @ResponseBody
public JsonResult<TeacherOpenCourseQuestionLogScoreInfo> getScoreInfo( public JsonResult<TeacherOpenCourseQuestionLogScoreInfo> getScoreInfo(
Long questionSettingId, Long teacherOpenCourseQuestionSettingId,
@SCoreUser @SCoreUser
CoreUser coreUser) { CoreUser coreUser) {
Assert.isTrue(coreUser.isStudent(), "非学生身份,无法提交!"); return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(teacherOpenCourseQuestionSettingId));
return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(questionSettingId));
} }

Loading…
Cancel
Save