1234567891011121314151617181920212223 |
- from datetime import datetime
- class Standard:
- def __init__(self,
- standard_code: str,
- standard_name: str,
- id: int = None,
- created_at: datetime = None,
- updated_at: datetime = None):
- self.id = id # 自增ID
- self.standard_code = standard_code # 标准编号
- self.standard_name = standard_name # 标准名称
- self.created_at = created_at or datetime.now() # 创建时间
- self.updated_at = updated_at or datetime.now() # 更新时间
- def to_dict(self):
- return {
- 'id': self.id,
- 'standard_code': self.standard_code,
- 'standard_name': self.standard_name,
- 'created_at': self.created_at.strftime('%Y-%m-%d %H:%M:%S'),
- 'updated_at': self.updated_at.strftime('%Y-%m-%d %H:%M:%S')
- }
|