def get_rcmd_list(self): qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName, u.articleCount " ) qry.userTypeId = 2 qry.userStatus = 0 qry.orderType = 100 rcmd_list = qry.query_map(12) request.setAttribute("rcmd_list", rcmd_list)
def get_expert_list(self): qry = UserQuery( """ u.loginName, u.blogName, u.nickName,u.trueName, u.blogIntroduce,u.articleCount, subj.subjectId """ ) qry.userTypeId = 3 qry.userStatus = 0 qry.setSubjectCondition(self.subject) expert_list = qry.query_map(3) request.setAttribute("expert_list", expert_list)
def get_upload_sorter(self): qry = UserQuery(""" u.resourceCount, u.loginName, u.nickName """) qry.metaSubjectId = self.subject.metaSubject.msubjId qry.metaGradeId = self.subject.metaGrade.gradeId qry.FuzzyMatch = True qry.orderType = 4 #UserQuery.ORDER_TYPE_RESOURCE_COUNT_DESC qry.userStatus = 0 upload_sorter = qry.query_map(20) request.setAttribute("upload_sorter", upload_sorter)
def get_new_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce, u.articleCount, u.userType """ ) qry.orderType = 0 qry.userStatus = 0 qry.unitId = self.unit.unitId new_blog_list = qry.query_map(5) request.setAttribute("new_blog_list", new_blog_list)
def get_expert_list(self): qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName, u.visitCount, unit.unitName, u.articleCount " ) qry.userTypeId = 3 qry.userStatus = 0 qry.orderType = 100 expert_list = qry.query_map(13) request.setAttribute("expert_list", expert_list)
def get_expert_user_list(self): qry = UserQuery(""" u.loginName, u.nickName """) qry.userTypeId = 3 qry.subjectId = self.get_subjectId() expert_user_list = qry.query_map() request.setAttribute("expert_user_list", expert_user_list) # 学科教研员 - 未实现. self.get_subject_comissioner()
def get_comissioner_list(self): qry = UserQuery( """ u.loginName, u.trueName, u.userIcon, u.blogName, u.createDate, u.myArticleCount, u.otherArticleCount, u.resourceCount, u.blogIntroduce, u.articleCount """ ) qry.userTypeId = 4 qry.userStatus = 0 qry.orderType = 100 comissioner_list = qry.query_map(6) request.setAttribute("comissioner_list", comissioner_list)
def get_hot_list(self): qry = UserQuery(""" u.loginName, u.blogName, u.visitCount """) qry.orderType = 1 hot_list = qry.query_map(10) request.setAttribute("hot_list", hot_list) # 主工作室查询数据. self.query_blog()
def get_new_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce, u.articleCount """ ) qry.orderType = 0 qry.userStatus = 0 #qry.metaSubjectId=2 new_blog_list = qry.query_map(6) request.setAttribute("new_blog_list", new_blog_list)
def get_rcmd_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName, u.articleCount, u.userType """ ) qry.userTypeId = 2 qry.orderType = 100 qry.unitId = self.unit.unitId rcmd_list = qry.query_map(5) request.setAttribute("rcmd_list", rcmd_list)
def get_famous_teacher(self): qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName, u.visitCount, u.articleCount " ) qry.userTypeId = 1 qry.userStatus = 0 qry.orderType = 100 famous_teachers = qry.query_map(3) request.setAttribute("famous_teachers", famous_teachers)
def user_list(self, type): # 系统用户管理员可以管理所有用户 pager = self.createPager() qry = UserQuery( """ u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, u.pushState, u.email, u.subjectId, u.gradeId, u.createDate, u.qq, u.idCard, u.positionId, u.userType, subj.subjectName, grad.gradeName, unit.unitTitle """) qry.userStatus = None qry.userTypeId = self.typeId qry.kk = self.params.getStringParam("k") qry.subjectId = self.params.getIntParamZeroAsNull("subjectId") qry.f = self.params.getStringParam("f") # print("type=" + type) # 根据 type 设置过滤. if type == "unaudit": qry.userStatus = User.USER_STATUS_WAIT_AUTID elif type == "locked": qry.userStatus = User.USER_STATUS_LOCKED elif type == "deleted": qry.userStatus = User.USER_STATUS_DELETED # 普通管理员不能设置 超级管理员的内容 if self.loginUser.loginName != "admin": qry.custormAndWhere = "u.loginName <> 'admin'" pager.totalRows = qry.count() user_list = qry.query_map(pager) request.setAttribute("pager", pager) request.setAttribute("userList", user_list) request.setAttribute("k", qry.kk) request.setAttribute("f", qry.f) request.setAttribute("subjectId", qry.subjectId) request.setAttribute("cmdtype", type) self.putSubjectList() self.putGradeList() #判断是否是中教启星的用户系统,使用了别家公司的用户系统,则部分操作需要限制 #if request.getServletContext().getServletRegistration("CAS-Authentication-Filter") != None: if request.getServletContext().getFilterRegistration( "CAS-Authentication-Filter") != None: request.setAttribute("usermgr3", 1) elif request.getServletContext().getFilterRegistration( "ssoUserFilter") != None: request.setAttribute("usermgr3", 1) else: request.setAttribute("usermgr3", 0) # 不能输入' if qry.kk == "'": self.addActionError(u"请不要输入非法的字符串。") return self.ERROR return ADMIN_USER_LIST
def get_famous_user_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.loginName, u.nickName,u.trueName, subj.subjectId """ ) qry.userTypeId = 1 qry.userStatus = 0 qry.metaSubjectId = self.get_current_subjectId() qry.metaGradeId = self.get_current_gradeId() channel_user_list = qry.query_map(3) request.setAttribute("channel_user_list", channel_user_list)
def get_subject_comissioner(self): qry = UserQuery( """ u.loginName, u.nickName, u.userIcon, u.blogName, u.createDate, u.articleCount, u.resourceCount, u.blogIntroduce """) qry.subjectId = self.subject.subjectId qry.isComissioner = True comissioner_list = qry.query_map( 6) # 按照界面 mengv1/subject/jiaoyanyuan.ftl 中获取 13 个. #print "comissioner_list = ", comissioner_list request.setAttribute("comissioner_list", comissioner_list)
def get_hot_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName,u.createDate, u.blogIntroduce """ ) qry.userStatus = 0 qry.orderType = UserQuery.ORDER_TYPE_VISITCOUNT_DESC qry.metaSubjectId = self.get_current_subjectId() qry.metaGradeId = self.get_current_gradeId() hot_blog_list = qry.query_map(3) request.setAttribute("hot_blog_list", hot_blog_list)
def get_rcmd_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName,u.trueName, u.createDate, u.blogIntroduce """ ) qry.userTypeId = 2 qry.userStatus = 0 qry.metaSubjectId = self.get_current_subjectId() qry.metaGradeId = self.get_current_gradeId() rcmd_blog_list = qry.query_map(3) request.setAttribute("rcmd_blog_list", rcmd_blog_list)
def get_rcmd_wr_list(self): cache_key = "rcmd_wr_list" rcmd_wr_list = cache.get(cache_key) if rcmd_wr_list == None: qry = UserQuery(" u.loginName, u.userIcon, u.blogName ") qry.userTypeId = 2 qry.userStatus = 0 rcmd_wr_list = qry.query_map(6) cache.put(cache_key, rcmd_wr_list) request.setAttribute("rcmd_wr_list", rcmd_wr_list)
def get_new_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce, u.createDate """ ) qry.userStatus = 0 #qry.setSubjectCondition(self.subject) 导航有改动 qry.metaSubjectId = self.get_current_subjectId() qry.metaGradeId = self.get_current_gradeId() new_blog_list = qry.query_map(3) request.setAttribute("new_blog_list", new_blog_list)
def tearcher_show(self): cache_key = "teacher_show" teacher_show = cache.get(cache_key) if teacher_show == None: qry = UserQuery(" u.userId, u.loginName, u.trueName, u.userIcon ") qry.userTypeId = 6 qry.orderType = 100 teacher_show = qry.query_map(8) cache.put(cache_key, teacher_show) request.setAttribute("teacher_show", teacher_show)
def get_new_wr_list(self): cache_key = "new_wr_list" new_wr_list = cache.get(cache_key) if new_wr_list == None: qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce " ) qry.userStatus = 0 new_wr_list = qry.query_map(7) cache.put(cache_key, new_wr_list) request.setAttribute("new_wr_list", new_wr_list)
def get_expert_list(self): cache_key = "expert_list" expert_list = cache.get(cache_key) if expert_list == None: qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName, u.visitCount """ ) qry.userTypeId = 3 qry.userStatus = 0 expert_list = qry.query_map(12) cache.put(cache_key, expert_list) request.setAttribute("expert_list", expert_list)
def get_hot_wr_list(self): cache_key = "hot_wr_list" hot_wr_list = cache.get(cache_key) if hot_wr_list == None: qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce " ) qry.userStatus = 0 qry.orderType = 1 # visitCount DESC hot_wr_list = qry.query_map(6) cache.put(cache_key, hot_wr_list) request.setAttribute("hot_wr_list", hot_wr_list)
def get_famous_teacher(self): cache_key = "famous_teachers" famous_teachers = cache.get(cache_key) if famous_teachers == None: qry = UserQuery( """ u.loginName, u.userIcon, u.trueName, u.visitCount """) qry.userTypeId = 1 qry.userStatus = 0 qry.orderType = 100 famous_teachers = qry.query_map(12) cache.put(cache_key, famous_teachers) request.setAttribute("famous_teachers", famous_teachers)
def get_hot_list(self): qry = UserQuery( """ u.loginName, u.blogName,u.trueName, u.visitCount,u.articleCount """ ) qry.orderType = 1 qry.userStatus = 0 qry.setSubjectCondition(self.subject) hot_list = qry.query_map(10) request.setAttribute("hot_list", hot_list) # 主工作室查询数据. self.query_blog()
def get_score_wr_list(self): cache_key = "score_wr_list" score_wr_list = cache.get(cache_key) if score_wr_list == None: qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce ,u.commentCount,u.userScore """ ) qry.orderType = 6 qry.userStatus = 0 score_wr_list = qry.query_map(6) cache.put(cache_key, score_wr_list) request.setAttribute("score_wr_list", score_wr_list)
def get_subject_comissioner(self): qry = UserQuery( """ u.loginName, u.nickName, u.trueName,u.userIcon, u.blogName, u.createDate, u.myArticleCount, u.otherArticleCount, u.resourceCount, u.blogIntroduce,u.articleCount """ ) qry.setSubjectCondition(self.subject) qry.isComissioner = True qry.userStatus = 0 qry.bmd = 1 comissioner_list = qry.query_map(6) #print "comissioner_list = ", comissioner_list request.setAttribute("comissioner_list", comissioner_list)
def query_blog(self): qry = UserQuery(""" u.userId, u.loginName, u.nickName, u.createDate, u.blogName, u.blogIntroduce, u.userIcon, u.articleCount, u.resourceCount, u.commentCount, u.visitCount, u.photoCount, subj.subjectName, unit.unitName """) qry.subjectId = self.subject.subjectId qry.sysCateId = self.params.getIntParamZeroAsNull("categoryId") qry.k = self.params.getStringParam("k") pager = self.createPager() pager.totalRows = qry.count() blog_list = qry.query_map(pager) request.setAttribute("blog_list", blog_list) request.setAttribute("pager", pager) return
def teacher_star(self): cache_key = "teacher_star" star = cache.get(cache_key) if star == None: qry = UserQuery( """ u.userId, u.loginName, u.trueName, u.userIcon, u.blogName, u.blogIntroduce """ ) qry.userTypeId = 5 # 1- 教师风采; 2- 研修之星. qry.orderType = 100 # 按随机来排序 # star = qry.first_map() star = qry.query_map(12) cache.put(cache_key, star) request.setAttribute("teacher_star", star)
def get_hot_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce,u.createDate, u.visitCount, u.articleCount, u.resourceCount, u.commentCount,u.userScore, u.userTags """ ) qry.orderType = 1 qry.userStatus = 0 pager = self.params.createPager() pager.itemName = u"用户" pager.itemUnit = u"个" pager.pageSize = 20 pager.totalRows = qry.count() user_list = qry.query_map(pager) request.setAttribute("pager", pager) request.setAttribute("user_list", user_list) request.setAttribute("list_type", u"热门工作室")
def show_list(self): qry = UserQuery(""" u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, u.pushState,u.pushUserId, u.email, u.subjectId, u.gradeId, u.createDate, u.blogIntroduce, subj.subjectName, grad.gradeName, unit.unitName, u.positionId """) qry.userStatus = 0 qry.pushState = 2 # 待推送 qry.isFamous = True pager = self.params.createPager() pager.itemName = u"名师" pager.itemUnit = u"位" pager.pageSize = 25 pager.totalRows = qry.count() user_list = qry.query_map(pager) request.setAttribute("user_list", user_list) request.setAttribute("pager", pager) return "/WEB-INF/push/admin_push_famous_list.ftl"