Commit ff83e25d by larosa

add update

parent 489de7fb
Showing with 11 additions and 11 deletions
......@@ -217,17 +217,17 @@ def update_ext_attr_by_class_ids(conf: dict):
print("暂时未兼容此种类型的拓展属性 input_type: " + str(input_type))
# 检查此分类的此拓展属性在 db 中是否已存在,未存在则 insert, 存在则 update
# check_sql = "select id from lie_shop_attr where class_id = %s and attr_id = %s"
# cursor.execute(query=check_sql, args=(class_id, attr_id,))
# db_result = cursor.fetchall()
# if len(db_result) == 0:
# # 不存在时
# insert_sql = "insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
# cursor.execute(query=insert_sql, args=(class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time,))
# db.commit()
# print(insert_sql % (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time))
# else:
# update_sql = ""
check_sql = "select id from lie_shop_attr where class_id = %s and attr_id = %s"
cursor.execute(query=check_sql, args=(class_id, attr_id,))
db_result = cursor.fetchall()
if len(db_result) == 0:
# 不存在时
insert_sql = "insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
cursor.execute(query=insert_sql, args=(class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time,))
db.commit()
print(insert_sql % (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time))
else:
update_sql = ""
insert_ext_attr_to_redis(class_attr_mapping, conf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment