def list_user(self): userState = self.params.safeGetStringParam("userState") k = self.params.safeGetStringParam("k") qry = UserQuery(""" u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, u.email, u.subjectId, u.gradeId, u.createDate, u.userType """) qry.orderType = 0 if userState != "" and userState.isdigit() == True: qry.userStatus = int(userState) else: qry.userStatus = None if k != "": qry.f = "name" qry.k = k request.setAttribute("k", k) qry.unitId = self.unit.unitId 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("userState", userState)
def get_request(self): k = self.params.safeGetStringParam("k") f = self.params.safeGetStringParam("f") userState = self.params.safeGetStringParam("userState") qry = UserQuery( """ u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, u.subjectId, u.gradeId, u.createDate, u.userType, u.unitId, unit.unitTitle """) qry.orderType = 0 if userState != "" and userState.isdigit() == True: qry.userStatus = int(userState) else: qry.userStatus = None qry.delState = None request.setAttribute("f", f) if k != "": qry.k = k request.setAttribute("k", k) # 不使用unitId 查询过滤 qry.unitId = None qry.custormAndWhere = "(u.unitPathInfo LIKE '%/" + str( self.unit.unitId) + "/%') And (u.unitId <> " + str( self.unit.unitId) + ")" 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("userState", userState)
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 query_blog(self): qry = UserQuery( """ u.userId, u.loginName, u.nickName, u.trueName, u.createDate, u.blogName, u.blogIntroduce, u.userIcon, u.myArticleCount, u.otherArticleCount, u.resourceCount, u.commentCount, u.visitCount, u.photoCount,u.articleCount, subj.subjectName, grad.gradeName, grad.gradeId, unit.unitName """ ) qry.userStatus = 0 pager = self.createPager() # 根据页面参数处理. type = self.params.getStringParam("type") if type == "rcmd": qry.userTypeId = 2 elif type == "hot": qry.orderType = 1 else: type = "new" request.setAttribute("type", type) qry.subjectId = self.get_current_subjectId() qry.gradeId = self.get_current_gradeId() qry.k = self.params.getStringParam("k") qry.sysCateId = self.params.getIntParamZeroAsNull("categoryId") #qry.setSubjectCondition(self.subject) qry.sysCateId = self.params.getIntParamZeroAsNull("categoryId") pager.totalRows = qry.count() blog_list = qry.query_map(pager) request.setAttribute("blog_list", blog_list) request.setAttribute("pager", pager) return
def get_typeduser_list(self, typdId): 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 = 0 qry.userStatus = 0 qry.userTypeId = typdId 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) user_typename = "" userService = __jitar__.userService type_list = userService.getAllUserType() if type_list != None and len(type_list) > 0: for t in type_list: if t.typeId == typdId: user_typename = t.typeName break request.setAttribute("list_type", user_typename)
def execute(self): # 选择类型,单选还是多选?type:1单选,0多选 type = self.params.safeGetStringParam("type") idTag = self.params.safeGetStringParam("idTag") titleTag = self.params.safeGetStringParam("titleTag") backType = self.params.safeGetStringParam("back") qry = UserQuery( " u.userId, u.loginName, u.trueName, u.createDate, unit.unitName, unit.unitTitle " ) qry.orderType = 0 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("type", type) request.setAttribute("idTag", idTag) request.setAttribute("titleTag", titleTag) request.setAttribute("back", backType) return "/WEB-INF/common/user_select_bottom.ftl"
def get_hot_blog_list(self): qry = UserQuery( " u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce, u.articleCount " ) qry.orderType = 1 # visitCount DESC qry.userStatus = 0 hot_blog_list = qry.query_map(6) request.setAttribute("hot_blog_list", hot_blog_list)
def get_blog_score_charts(self): qry = UserQuery( " u.userScore, u.loginName, u.trueName,u.blogName, u.articleCount " ) qry.orderType = 6 qry.userStatus = 0 blog_score_charts = qry.query_map(5) request.setAttribute("blog_score_charts", blog_score_charts)
def get_expert_user_list(self): qry = UserQuery(""" u.loginName, u.nickName,u.trueName """) qry.userTypeId = 3 qry.userStatus = 0 qry.metaSubjectId = self.get_current_subjectId() qry.metaGradeId = self.get_current_gradeId() expert_user_list = qry.query_map(10) request.setAttribute("expert_user_list", expert_user_list)
def get_comissioner_list(self): userQuery = UserQuery( "u.loginName, u.trueName, u.userIcon, u.blogName, u.createDate, u.myArticleCount, u.otherArticleCount, u.resourceCount, u.blogIntroduce, u.articleCount" ) userQuery.userTypeId = 4 userQuery.userStatus = 0 userQuery.orderType = 100 request.setAttribute("comissioner_list", userQuery.query_map(9))
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_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_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_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_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 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 " ) qry.userTypeId = 2 qry.userStatus = 0 qry.orderType = 100 rcmd_list = qry.query_map(12) request.setAttribute("rcmd_list", rcmd_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 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_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_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_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_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_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_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 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_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_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_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"热门工作室")