From a5619836f108b23cfb876f636b4326a1f581c3bb Mon Sep 17 00:00:00 2001 From: han0 Date: Wed, 5 Jun 2024 09:04:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dmodel=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/commons/models/asphalt_domestic.py | 3 ++- web/commons/models/asphalt_imported.py | 3 ++- web/commons/models/cement.py | 3 ++- web/commons/models/material.py | 3 ++- web/commons/models/material_task.py | 2 +- web/commons/models/mixin/calculator.py | 7 +++++++ web/commons/models/mixin/steel.py | 3 +++ web/commons/models/price_publish.py | 3 ++- web/commons/models/price_result.py | 4 +++- web/commons/models/steel_plate.py | 3 ++- web/commons/models/steel_rebar.py | 3 ++- web/commons/models/steel_section.py | 3 ++- web/commons/models/steel_strand.py | 3 ++- 13 files changed, 32 insertions(+), 11 deletions(-) diff --git a/web/commons/models/asphalt_domestic.py b/web/commons/models/asphalt_domestic.py index 7451082..5d8a6bc 100644 --- a/web/commons/models/asphalt_domestic.py +++ b/web/commons/models/asphalt_domestic.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.calculator import CalculatorMixin +from commons.models.model import Model from core.extensions import db -class AsphaltDomestic(db.Model, CalculatorMixin): +class AsphaltDomestic(db.Model, Model, CalculatorMixin): __tablename__ = 'ASPHALT_DOMESTIC' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/asphalt_imported.py b/web/commons/models/asphalt_imported.py index fb486ad..8056e11 100644 --- a/web/commons/models/asphalt_imported.py +++ b/web/commons/models/asphalt_imported.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.calculator import CalculatorMixin +from commons.models.model import Model from core.extensions import db -class AsphaltImported(db.Model, CalculatorMixin): +class AsphaltImported(db.Model, Model, CalculatorMixin): __tablename__ = 'ASPHALT_IMPORTED' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/cement.py b/web/commons/models/cement.py index 004a5c1..c537d03 100644 --- a/web/commons/models/cement.py +++ b/web/commons/models/cement.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.calculator import CalculatorMixin +from commons.models.model import Model from core.extensions import db -class Cement(db.Model, CalculatorMixin): +class Cement(db.Model, Model, CalculatorMixin): __tablename__ = 'CEMENT' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/material.py b/web/commons/models/material.py index 09581e0..9811b7a 100644 --- a/web/commons/models/material.py +++ b/web/commons/models/material.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String from commons.models.mixin.operation_track import OperationTrackMixin +from commons.models.model import Model from core.extensions import db -class Material(db.Model, OperationTrackMixin): +class Material(db.Model, Model, OperationTrackMixin): id = Column('ID', String(128), primary_key=True) parent_id = Column('PARENT_ID', String(128)) category_1 = Column('CATEGORY1', String(128), default='', comment='分类1') diff --git a/web/commons/models/material_task.py b/web/commons/models/material_task.py index 3d21572..a1e5350 100644 --- a/web/commons/models/material_task.py +++ b/web/commons/models/material_task.py @@ -6,7 +6,7 @@ from commons.models.model import Model from core.extensions import db -class MaterialTask(db.Model, OperationTrackMixin, Model): +class MaterialTask(db.Model, Model, OperationTrackMixin, Model): id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='任务名称') status = Column('STATUS', Integer, default=0, comment='状态(待采集、已采集、采集中)') diff --git a/web/commons/models/mixin/calculator.py b/web/commons/models/mixin/calculator.py index b9143cc..158bd19 100644 --- a/web/commons/models/mixin/calculator.py +++ b/web/commons/models/mixin/calculator.py @@ -1,3 +1,10 @@ +import datetime + +from sqlalchemy import func + +from calculators import Helper + + class CalculatorMixin: date = None diff --git a/web/commons/models/mixin/steel.py b/web/commons/models/mixin/steel.py index d3f8226..dd549f0 100644 --- a/web/commons/models/mixin/steel.py +++ b/web/commons/models/mixin/steel.py @@ -1,3 +1,6 @@ +from commons.models.mixin.calculator import CalculatorMixin + + class SteelMixin(CalculatorMixin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/web/commons/models/price_publish.py b/web/commons/models/price_publish.py index bc08f97..d750809 100644 --- a/web/commons/models/price_publish.py +++ b/web/commons/models/price_publish.py @@ -5,10 +5,11 @@ from sqlalchemy import Column, Integer, String, Numeric from commons.models.mixin.base import BaseModelMixin from commons.models.mixin.operation_track import OperationTrackMixin +from commons.models.model import Model from core.extensions import db -class PricePublish(db.Model, OperationTrackMixin, BaseModelMixin): +class PricePublish(db.Model, Model, OperationTrackMixin, BaseModelMixin): id = Column('ID', Integer, primary_key=True) year = Column('YEAR', Integer, default='', comment='统计年份') month = Column('MONTH', Integer, default='', comment='统计月份') diff --git a/web/commons/models/price_result.py b/web/commons/models/price_result.py index 5ed0995..6b0af3e 100644 --- a/web/commons/models/price_result.py +++ b/web/commons/models/price_result.py @@ -2,10 +2,12 @@ from sqlalchemy import Column, Integer, String, Numeric from commons.models.mixin.base import BaseModelMixin from commons.models.mixin.operation_track import OperationTrackMixin +from commons.models.model import Model from core.extensions import db -class PriceResult(db.Model, OperationTrackMixin, BaseModelMixin): +class PriceResult(db.Model, Model, OperationTrackMixin, BaseModelMixin): + id = Column('ID', Integer, primary_key=True) material_id = Column('MATERIAL_ID', String(128), default='', comment='编号') name = Column('NAME', String(128), default='', comment='材料名称') diff --git a/web/commons/models/steel_plate.py b/web/commons/models/steel_plate.py index 0767e33..7593d37 100644 --- a/web/commons/models/steel_plate.py +++ b/web/commons/models/steel_plate.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.steel import SteelMixin +from commons.models.model import Model from core.extensions import db -class SteelPlate(db.Model, SteelMixin): +class SteelPlate(db.Model, Model, SteelMixin): __tablename__ = 'STEEL_PLATE' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/steel_rebar.py b/web/commons/models/steel_rebar.py index 9153450..5f5595a 100644 --- a/web/commons/models/steel_rebar.py +++ b/web/commons/models/steel_rebar.py @@ -4,10 +4,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, from calculators import Helper from commons.models.mixin.steel import SteelMixin +from commons.models.model import Model from core.extensions import db -class SteelRebar(db.Model, SteelMixin): +class SteelRebar(db.Model, Model, SteelMixin): __tablename__ = 'STEEL_REBAR' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/steel_section.py b/web/commons/models/steel_section.py index 72e05f8..ffad66e 100644 --- a/web/commons/models/steel_section.py +++ b/web/commons/models/steel_section.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.steel import SteelMixin +from commons.models.model import Model from core.extensions import db -class SteelSection(db.Model, SteelMixin): +class SteelSection(db.Model, Model, SteelMixin): __tablename__ = 'STEEL_SECTION' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称') diff --git a/web/commons/models/steel_strand.py b/web/commons/models/steel_strand.py index fcd8bac..a11a177 100644 --- a/web/commons/models/steel_strand.py +++ b/web/commons/models/steel_strand.py @@ -1,10 +1,11 @@ from sqlalchemy import Column, Integer, String, Numeric, Date, UniqueConstraint, func from commons.models.mixin.steel import SteelMixin +from commons.models.model import Model from core.extensions import db -class SteelStrand(db.Model, SteelMixin): +class SteelStrand(db.Model, Model, SteelMixin): __tablename__ = 'STEEL_STRAND' id = Column('ID', Integer, primary_key=True) name = Column('NAME', String(128), default='', comment='名称')