pdf_standard.py 883 B

1234567891011121314151617181920212223
  1. from datetime import datetime
  2. class Standard:
  3. def __init__(self,
  4. standard_code: str,
  5. standard_name: str,
  6. id: int = None,
  7. created_at: datetime = None,
  8. updated_at: datetime = None):
  9. self.id = id # 自增ID
  10. self.standard_code = standard_code # 标准编号
  11. self.standard_name = standard_name # 标准名称
  12. self.created_at = created_at or datetime.now() # 创建时间
  13. self.updated_at = updated_at or datetime.now() # 更新时间
  14. def to_dict(self):
  15. return {
  16. 'id': self.id,
  17. 'standard_code': self.standard_code,
  18. 'standard_name': self.standard_name,
  19. 'created_at': self.created_at.strftime('%Y-%m-%d %H:%M:%S'),
  20. 'updated_at': self.updated_at.strftime('%Y-%m-%d %H:%M:%S')
  21. }