|
@@ -32,6 +32,10 @@ def template_id_get_classification_list(db,id):
|
|
|
query = query.filter_by(template_id = id,del_flag = '0')
|
|
|
query = query.order_by(TpPatternClassification.order_num.asc())
|
|
|
return query.all()
|
|
|
+def template_id_get_template_info(db,id):
|
|
|
+ query = db.query(TpPatternTemplate)
|
|
|
+ query = query.filter_by(template_id = id,del_flag = '0')
|
|
|
+ return query.first()
|
|
|
|
|
|
@router.post("/create")
|
|
|
async def create_pattern(
|
|
@@ -98,8 +102,10 @@ async def get_pattern_info(
|
|
|
info = classification_id_get_classification_info(db,id)
|
|
|
if not info:
|
|
|
return JSONResponse(status_code=404,content={"code":404,"msg":"classification not found"})
|
|
|
+ template_info = template_id_get_template_info(db,info.template_id)
|
|
|
data = {"classification_id": info.classification_id,
|
|
|
"template_id": info.template_id,
|
|
|
+ "template_name":template_info.name,
|
|
|
"name": info.name,
|
|
|
"value": info.value,
|
|
|
"order_num": info.order_num,
|
|
@@ -132,8 +138,12 @@ async def get_pattern_list(
|
|
|
query = query.order_by(TpPatternClassification.order_num.asc())
|
|
|
# 执行分页查询
|
|
|
lists = query.offset((page - 1) * pageSize).limit(pageSize).all()
|
|
|
- data = [{"classification_id": info.classification_id,
|
|
|
+ data = [ ]
|
|
|
+ for info in lists:
|
|
|
+ template_info = template_id_get_template_info(db, info.template_id)
|
|
|
+ data.append({"classification_id": info.classification_id,
|
|
|
"template_id": info.template_id,
|
|
|
+ "template_name":template_info.name,
|
|
|
"name": info.name,
|
|
|
"value": info.value,
|
|
|
"order_num": info.order_num,
|
|
@@ -141,7 +151,7 @@ async def get_pattern_list(
|
|
|
"image": info.image,
|
|
|
"icon": info.icon,
|
|
|
"size": info.size,
|
|
|
- "create_time": info.create_time} for info in lists]
|
|
|
+ "create_time": info.create_time})
|
|
|
return {"code": 200, "msg": "查询成功", "data": data,
|
|
|
"total": total_items,
|
|
|
"page": page,
|