统一pagesize的值

dev
周平 9 months ago
parent d3bb437a53
commit 1ea04cbf6a

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""静态配置"""
PAGE_NO = 1
PAGE_SIZE = 10
# 行业分类

@ -130,6 +130,7 @@ class ClassificationEditHandler(APIHandler):
self.finish()
class ListHandler(APIHandler):
"""
模型列表
@ -485,7 +486,7 @@ class VersionListHandler(APIHandler):
def post(self):
model_id = self.get_int_argument("model_id")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 20)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
if not model_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "参数缺失")

@ -38,7 +38,7 @@ class ListHandler(APIHandler):
@operation_log("企业管理", "业务模型", consts.op_type_list_str, "查询企业部署的业务模型列表", "")
def post(self):
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 10)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
entity_id = self.get_int_argument("entity_id")
if not entity_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "参数错误")

@ -126,9 +126,9 @@ class DeviceClassificationDeleteHandler(APIHandler):
cur = conn.execute(
text(
"""
select d.id from enterprise_device d, device_classification c
where d.classification=c.suid and c.id=:id and c.del=0
"""
select d.id from enterprise_device d, device_classification c
where d.classification=c.suid and c.id=:id and c.del=0
"""
),
{"id": did},
)
@ -326,7 +326,7 @@ class DeviceListHandler(APIHandler):
def post(self):
node_id = self.get_int_argument("node_id")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 20)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
if not node_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "企业节点不能为空")
db_device = DB_Device.EnterpriseDeviceRepository()
@ -425,7 +425,7 @@ class DeviceBasemodelListHandler(APIHandler):
errors.ERROR_BAD_REQUEST, "企业节点或设备不能为空"
)
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 10)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
db_busi_model = DB_BusiModelNodeDevice.EnterpriseBusiModelNodeDeviceRepository()
busi_models, count = db_busi_model.get_busi_model_by_device(device_id=device_id, pagination=True,
page_no=pageNo,
@ -583,7 +583,7 @@ class StatusListHandler(APIHandler):
classification = self.get_escaped_argument("classification", "")
status = self.get_int_argument("status", 1000)
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 20)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
if not entity_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "企业节点不能为空")
@ -743,7 +743,7 @@ class StatusLogHandler(APIHandler):
def post(self):
entity_id = self.get_int_argument("entity_id")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 10)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
db_device = DB_Device.EnterpriseDeviceRepository()
res = db_device.list_entity_devices(entity_id=entity_id, pageno=pageNo, pagesize=pageSize)

@ -27,7 +27,7 @@ class EntityIndexHandler(APIHandler):
@operation_log("首页", "企业列表", consts.op_type_list_str, "企业列表")
async def post(self):
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 10)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
name = self.tostr(self.get_escaped_argument("name", ""))
with self.app_mysql.connect() as conn:

@ -244,7 +244,7 @@ class BusimodelHandler(APIHandler):
def post(self):
node_id = self.get_int_argument("node_id")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 20)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
if not node_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "企业节点不能为空")

@ -6,6 +6,7 @@ from sqlalchemy import text
from website import errors
from website import settings
from website import consts
from website.db.enterprise_device.enterprise_device import EnterpriseEntityRepository as EntRepo
from website.db_mysql import to_json_list, to_json
from website.handler import APIHandler, authenticated, operation_log
@ -131,7 +132,7 @@ class ListHandler(APIHandler):
entity_id = self.get_int_argument('entity_id')
status = self.get_int_argument("status")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 10)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
if not entity_id:
raise errors.HTTPAPIError(errors.ERROR_BAD_REQUEST, "entity_id is required")
if status and status not in (1001, 1002):
@ -241,7 +242,7 @@ class LogHandler(APIHandler):
def post(self):
entity_id = self.get_int_argument('entity_id')
pageNo = self.get_int_argument('pageNo', 1)
pageSize = self.get_int_argument('pageSize', 10)
pageSize = self.get_int_argument('pageSize', consts.PAGE_SIZE)
with self.app_mysql.connect() as conn:
p = {}

@ -140,7 +140,7 @@ class LogHandler(APIHandler):
start = self.get_escaped_argument("startDate", "")
end = self.get_escaped_argument("endDate", "")
pageNo = self.get_int_argument("pageNo", 1)
pageSize = self.get_int_argument("pageSize", 20)
pageSize = self.get_int_argument("pageSize", consts.PAGE_SIZE)
user_list = user.split(",") if user else []
with self.app_mysql.connect() as conn:

Loading…
Cancel
Save