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

@ -124,7 +124,7 @@ public class FunctionConsoleService extends CoreBaseService<CoreFunction> {
* @param userId
* @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){
return this.roleFunctionConsoleDao.getFunctionIdByUser(userId);
}

@ -81,14 +81,14 @@ public class MenuConsoleService extends CoreBaseService<CoreMenu> {
}
public String getMenuIdsByRoleId(Long roleId){
String menuIds = "";
StringBuffer stringBuffer = new StringBuffer();
CoreRoleMenu roleMenu = new CoreRoleMenu();
roleMenu.setRoleId(roleId);
List<CoreRoleMenu> coreRoleMenuList = roleMenuDao.template(roleMenu);
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) {

@ -26,6 +26,8 @@ import org.springframework.web.servlet.ModelAndView;
import java.util.*;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
/**
* :
*
@ -189,6 +191,11 @@ public class FunctionController {
return JsonResult.success(tree);
}
/**
* ID
*/
private static final ThreadLocal<String> currentUserRoleIds = ThreadLocal.withInitial(() -> null);
private List<FunctionNodeView> buildFunctionTree(FunctionItem node){
List<FunctionItem> list = node.getChildren();
@ -196,8 +203,14 @@ public class FunctionController {
return Collections.EMPTY_LIST;
}
CoreUser currentUser = platformService.getCurrentUser();
String ids = functionConsoleService.getFunctionIdByUser(currentUser.getId());
if(currentUserRoleIds.get() == null) {
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());
for(FunctionItem item :list){

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

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

Loading…
Cancel
Save