1228
This commit is contained in:
31
test_dal_debug.py
Normal file
31
test_dal_debug.py
Normal file
@ -0,0 +1,31 @@
|
||||
from busisness.dals import ArtifactDal
|
||||
|
||||
# 测试 exists_by_module_code 方法
|
||||
dal = ArtifactDal()
|
||||
|
||||
# 测试1: 不存在的模具编号
|
||||
print("=== 测试1: 不存在的模具编号 ===")
|
||||
result = dal.exists_by_module_code("不存在的模具编号")
|
||||
print(f"结果: {result}")
|
||||
print()
|
||||
|
||||
# 测试2: 存在的模具编号(如果有数据的话)
|
||||
print("=== 测试2: 存在的模具编号 ===")
|
||||
result = dal.exists_by_module_code("TEST001")
|
||||
print(f"结果: {result}")
|
||||
print()
|
||||
|
||||
# 测试3: 直接查询数据库验证
|
||||
print("=== 测试3: 直接SQL查询验证 ===")
|
||||
db_dao = dal.db_dao
|
||||
sql = "SELECT count(1) as cnt FROM ArtifactTask WHERE MouldCode = ?"
|
||||
results = db_dao.execute_read(sql, ("不存在的模具编号",))
|
||||
print(f"查询结果类型: {type(results)}")
|
||||
print(f"查询结果: {results}")
|
||||
rows = list(results)
|
||||
print(f"rows: {rows}")
|
||||
if rows:
|
||||
print(f"rows[0]: {rows[0]}")
|
||||
print(f"rows[0][0]: {rows[0][0]}")
|
||||
else:
|
||||
print("rows为空列表")
|
||||
Reference in New Issue
Block a user