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 get_typeduser_list(self, typdId): qry = UserQuery( """ u.loginName, u.articleCount, u.userIcon, u.userTags, u.blogName, u.trueName, u.blogIntroduce, u.createDate, u.visitCount, u.articleCount, u.resourceCount, u.commentCount, u.userScore """ ) qry.orderType = 0 qry.userStatus = 0 qry.unitId = self.unit.unitId 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 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_hot_blog_list(self): qry = UserQuery( """ u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce, u.articleCount, u.userType """ ) qry.orderType = 1 # visitCount DESC qry.unitId = self.unit.unitId hot_blog_list = qry.query_map(5) 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.unitId = self.unit.unitId blog_score_charts = qry.query_map(10) request.setAttribute("blog_score_charts", blog_score_charts)
def teacher_star(self): qry = UserQuery( """ u.userId, u.loginName, u.trueName, u.userIcon, u.blogName, u.blogIntroduce, u.articleCount, u.userType """ ) qry.userTypeId = 5 qry.unitId = self.unit.unitId teacher_star = qry.query_map(2) request.setAttribute("teacher_star", teacher_star)
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, u.userType " ) qry.userTypeId = 3 qry.unitId = self.unit.unitId qry.orderType = 100 expert_list = qry.query_map(3) 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, u.userType " ) qry.userTypeId = 1 qry.unitId = self.unit.unitId qry.orderType = 100 famous_teachers = qry.query_map(3) request.setAttribute("famous_teachers", famous_teachers)
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_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, u.userType """ ) qry.userTypeId = 4 qry.orderType = 100 qry.unitId = self.unit.unitId comissioner_list = qry.query_map(6) request.setAttribute("comissioner_list", comissioner_list)
def get_hot_list(self): qry = UserQuery( """ u.loginName, u.articleCount, u.userIcon, u.blogName, u.trueName,u.blogIntroduce,u.createDate, u.visitCount, u.articleCount, u.resourceCount, u.commentCount,u.userScore """ ) qry.orderType = 1 qry.userStatus = 0 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("list_type", u"热门工作室")