feeding
This commit is contained in:
@ -42,7 +42,7 @@ class ArtifactDal(BaseDal):
|
||||
print(f"获取所有构件任务失败: {e}")
|
||||
return []
|
||||
|
||||
def get_top_artifact(self, top: int,desc:str="ArtifactID asc",where:str="1=1") -> List[ArtifactInfoModel]:
|
||||
def get_top_artifact(self, top: int,desc:str="ID desc",where:str="1=1") -> List[ArtifactInfoModel]:
|
||||
"""获取top条数数据,根据ArtifactID升序"""
|
||||
try:
|
||||
# 确保top为正整数
|
||||
@ -59,6 +59,8 @@ class ArtifactDal(BaseDal):
|
||||
# 保证row的变量和模板变量一致
|
||||
artifact = ArtifactInfoModel()
|
||||
artifact.ArtifactID=row["ArtifactID"]
|
||||
artifact.ArtifactActionID=row["ArtifactActionID"]
|
||||
artifact.ArtifactIDVice1=row["ArtifactIDVice1"]
|
||||
artifact.ProduceRingNumber=row["ProduceRingNumber"]
|
||||
artifact.MouldCode=row["MouldCode"]
|
||||
artifact.SkeletonID=row["SkeletonID"]
|
||||
@ -68,6 +70,9 @@ class ArtifactDal(BaseDal):
|
||||
artifact.BlockNumber=row["BlockNumber"]
|
||||
artifact.BetonVolume=row["BetonVolume"]
|
||||
artifact.BetonTaskID=row["BetonTaskID"]
|
||||
artifact.HoleRingMarking=row["HoleRingMarking"]
|
||||
artifact.GapRingMarking=row["GroutingPipeMarking"]
|
||||
artifact.PolypropyleneFiberMarking=row["PolypropyleneFiberMarking"]
|
||||
artifact.Status=row["Status"]
|
||||
artifact.BeginTime=row["BeginTime"]
|
||||
artifacts.append(artifact)
|
||||
@ -78,6 +83,21 @@ class ArtifactDal(BaseDal):
|
||||
return []
|
||||
|
||||
|
||||
def exists_by_id(self, artifact_id: int) -> bool:
|
||||
"""根据构件ID获取构件任务"""
|
||||
try:
|
||||
sql = "SELECT count(1) FROM ArtifactTask WHERE ArtifactID = ?"
|
||||
results = self.db_dao.execute_read(sql, (artifact_id,))
|
||||
|
||||
rows = list(results)
|
||||
if rows[0][0] == 1:
|
||||
return True
|
||||
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"根据ID获取构件任务失败: {e}")
|
||||
return False
|
||||
|
||||
def get_by_id(self, artifact_id: int) -> Optional[ArtifactInfoModel]:
|
||||
"""根据构件ID获取构件任务"""
|
||||
try:
|
||||
@ -108,7 +128,7 @@ class ArtifactDal(BaseDal):
|
||||
"""更新构件任务记录"""
|
||||
try:
|
||||
# 构建WHERE条件
|
||||
where_condition = {"ArtifactID": artifact_id}
|
||||
where_condition = f"ArtifactID='{artifact_id}'"
|
||||
# 使用update方法更新数据
|
||||
affected_rows = self.db_dao.update("ArtifactTask", update_data, where_condition)
|
||||
return affected_rows > 0
|
||||
|
||||
Reference in New Issue
Block a user