Commit d1dbdedf authored by pengxiong's avatar pengxiong

报告列表创建时间排序

parent 57fd7210
......@@ -119,8 +119,8 @@ class Group(Base, BaseModel):
ifauser_id = Column(String(64))
class HoldDiagnoseReport(Base, BaseModel):
__tablename__ = 'hold_diagnose_report'
class HoldReport(Base, BaseModel):
__tablename__ = 'hold_report'
id = Column(INTEGER(11), primary_key=True)
customer_id = Column(String(64))
......@@ -131,6 +131,7 @@ class HoldDiagnoseReport(Base, BaseModel):
be_viewed = Column(INTEGER(2), comment='0未查看1已查看')
report_data = Column(Text)
name = Column(String(100))
create_time = Column(DateTime)
def to_dict(self, allow_field=None):
all_field = [r.name for r in self.__table__.columns]
......@@ -146,8 +147,8 @@ class HoldDiagnoseReport(Base, BaseModel):
return data
class HoldReport(Base, BaseModel):
__tablename__ = 'hold_report'
class HoldDiagnoseReport(Base, BaseModel):
__tablename__ = 'hold_diagnose_report'
id = Column(INTEGER(11), primary_key=True)
customer_id = Column(String(64))
......@@ -158,6 +159,7 @@ class HoldReport(Base, BaseModel):
be_viewed = Column(INTEGER(2), comment='0未查看1已查看')
report_data = Column(Text)
name = Column(String(100))
create_time = Column(DateTime)
def to_dict(self, allow_field=None):
all_field = [r.name for r in self.__table__.columns]
......@@ -185,6 +187,7 @@ class PeriodicReport(Base, BaseModel):
be_viewed = Column(INTEGER(2), comment='0未查看1已查看')
report_data = Column(Text)
name = Column(String(100))
create_time = Column(DateTime)
def to_dict(self, allow_field=None):
all_field = [r.name for r in self.__table__.columns]
......@@ -215,6 +218,7 @@ class ReportView(Base, BaseModel):
customer_name = Column(String(100))
author_name = Column(String(100))
type = Column(INTEGER(2))
create_time = Column(DateTime)
def to_dict(self, allow_field=None):
all_field = [r.name for r in self.__table__.columns]
......
......@@ -48,12 +48,12 @@ def get_report_list(args):
ReportView.update_time >= start_time,
ReportView.update_time <= end_time
]
allow_field = ['id', 'customer_id', 'ifa_id', 'update_time', 'update_status', 'file', 'be_viewed', 'name', 'customer_name', 'author_name', 'type']
allow_field = ['id', 'customer_id', 'ifa_id', 'update_time', 'create_time', 'update_status', 'file', 'be_viewed', 'name', 'customer_name', 'author_name', 'type']
with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
tamp_diagnose_session = tamp_diagnose_app.session
report_res = tamp_diagnose_session.query(ReportView).filter(and_(*conditions))
totalSize = report_res.count()
report_res = report_res.offset(offset).limit(pageSize)
report_res = report_res.order_by(ReportView.create_time.desc()).offset(offset).limit(pageSize)
res = [r.to_dict(allow_field=allow_field) for r in report_res]
return {
......@@ -187,7 +187,7 @@ def make_report(args):
name = args.get('name')
report_data = json.loads(args.get('report_data').replace(template_folder, temp_img_save_folder))
pdf_name = str(uuid.uuid4()) + '.pdf'
args['update_time'] = datetime.datetime.now()
args['create_time'] = datetime.datetime.now()
args['update_status'] = 1
args.pop('type')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment