feat: 更新十一地市计算逻辑

This commit is contained in:
han0
2024-07-10 16:08:47 +08:00
parent 5afcfc4846
commit 967bb57136
19 changed files with 144 additions and 139 deletions

View File

@@ -17,6 +17,7 @@ class FujianSurvey(db.Model):
unit = Column('UNIT', String(128), comment='单位')
brand = Column('BRAND', String(128), comment='品牌')
tax = Column('TAX', Integer, comment='税率')
region = Column('REGION', String(128), comment='地区')
__table_args__ = (
UniqueConstraint(name, spec, date, name='Idx_key'),
@@ -24,7 +25,7 @@ class FujianSurvey(db.Model):
)
@classmethod
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None):
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None, region='福州'):
query = cls.query
if year and month:
start_date = datetime.date(year, month, 1)
@@ -37,4 +38,6 @@ class FujianSurvey(db.Model):
query = query.filter(cls.name.in_(name_in))
if spec:
query = query.filter(cls.spec == spec)
if region:
query = query.filter(cls.region.like(f'%{region}%'))
return query