Example #1
0
 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)
Example #2
0
 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)
   request.setAttribute("comissioner_list", comissioner_list)
Example #3
0
 def get_new_blog_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.blogIntroduce, u.createDate """
     )
     qry.subjectId = self.get_subjectId()
     new_blog_list = qry.query_map(3)
     request.setAttribute("new_blog_list", new_blog_list)
Example #4
0
 def __init__(self, select):
   UserQuery.__init__(self, select)
   self.kk = None
   self.ff = 'name'
   self.isAdmin = None     # 是否查找用户管理员.
   self.isCensor = None    # 是否查找内容管理员.
   self.isCommon = True    # 是否查找非删除人员
Example #5
0
 def applyWhereCondition(self, qctx):
   UserQuery.applyWhereCondition(self, qctx)
   if self.kk != None and self.kk != '':
     newKey = self.kk.replace("'","''").replace("%","[%]").replace("_","[_]").replace("[","[[]")
     if self.ff == "name":
       qctx.addAndWhere("u.loginName LIKE :keyword OR u.nickName LIKE :keyword OR u.trueName LIKE :keyword")
       qctx.setString("keyword", "%" + newKey + "%")
Example #6
0
 def get_famous_user_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.loginName, u.nickName, subj.subjectId """
     )
     qry.userTypeId = 1
     qry.subjectId = self.get_subjectId()
     channel_user_list = qry.query_map(3)
     request.setAttribute("channel_user_list", channel_user_list)
Example #7
0
 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)
Example #8
0
 def get_rcmd_blog_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.createDate, u.blogIntroduce  """
     )
     qry.isRecommend = True
     qry.subjectId = self.get_subjectId()
     rcmd_blog_list = qry.query_map(3)
     request.setAttribute("rcmd_blog_list", rcmd_blog_list)
Example #9
0
 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)
Example #10
0
 def get_hot_blog_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.createDate, u.blogIntroduce """
     )
     qry.orderType = 1
     qry.subjectId = self.get_subjectId()
     hot_blog_list = qry.query_map(3)
     request.setAttribute("hot_blog_list", hot_blog_list)
Example #11
0
 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)
Example #12
0
 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)
Example #13
0
 def teacher_star(self):
     qry = UserQuery(
         " u.userId, u.loginName, u.trueName, u.userIcon, u.blogName, u.blogIntroduce, u.articleCount "
     )
     qry.userTypeId = 5
     qry.orderType = 100
     teacher_star = qry.query_map(1)
     request.setAttribute("teacher_star", teacher_star)
Example #14
0
 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)
Example #15
0
    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()
Example #16
0
 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)
Example #17
0
 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()
Example #18
0
 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)
Example #19
0
 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)
Example #20
0
 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)
Example #21
0
 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)
Example #22
0
 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)
Example #23
0
 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)
Example #24
0
 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)
Example #25
0
    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)
Example #26
0
 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)
Example #27
0
 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)
Example #28
0
    def main(self):
        qry = UserQuery(
            """ u.userId, u.loginName, u.userIcon, u.gender, u.trueName, u.email, u.blogName, u.blogIntroduce, 
                        u.myArticleCount, u.otherArticleCount, u.historyMyArticleCount, u.historyOtherArticleCount, u.visitCount,u.resourceCount,
                        u.commentCount,u.photoCount,u.subjectId, u.gradeId, u.positionId,
                        subj.subjectName, grad.gradeName, unit.unitTitle, sc.name
             """)
        qry.userStatus = None
        qry.loginName = self.loginUser.loginName
        users = qry.query_map()
        if users.size() == 0:
            response.sendRedirect("../login.jsp")

        user = users[0]
        request.setAttribute("user", user)

        # TODO: 下面的查询用 XxxQuery 改写, 现在统计不对.
        hql = """ select count(*) as groupCount
                          FROM GroupMember gm
                          where gm.userId = """ + str(
            self.loginUser.userId) + """
                         """
        cmd = Command(hql)
        groupCount = cmd.int_scalar()
        request.setAttribute("groupCount", groupCount)

        hql = """ select count(*) as messageCount
                          FROM Message m
                          where m.receiveId = """ + str(
            self.loginUser.userId) + """
                         """
        cmd = Command(hql)
        messageCount = cmd.int_scalar()
        request.setAttribute("messageCount", messageCount)

        hql = """ select count(*) as friendCount
                          FROM Friend f
                          where f.userId = """ + str(
            self.loginUser.userId) + """
                         """
        cmd = Command(hql)
        friendCount = cmd.int_scalar()
        request.setAttribute("friendCount", friendCount)

        return "/WEB-INF/ftl/user/manage_main.ftl"
Example #29
0
 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)
Example #30
0
 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)