Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def list_user(self):
        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
        qry.userStatus = 2
        qry.delState = 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)