예제 #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)
예제 #2
0
    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)
예제 #3
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
예제 #4
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