Example #1
0
    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
Example #2
0
 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