44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
class SupplierService:
|
|
def list_suppliers(self, filters: dict | None = None) -> dict:
|
|
supplier_list = [
|
|
{
|
|
"supplier_id": 1001,
|
|
"supplier_name": "工厂A",
|
|
"supplier_type": "factory",
|
|
"contact_name": "王师傅",
|
|
"contact_mobile": "13800000001",
|
|
"template_type": "default",
|
|
"status": 1,
|
|
},
|
|
{
|
|
"supplier_id": 1002,
|
|
"supplier_name": "物流合作方B",
|
|
"supplier_type": "logistics",
|
|
"contact_name": "赵调度",
|
|
"contact_mobile": "13800000002",
|
|
"template_type": "default",
|
|
"status": 1,
|
|
},
|
|
]
|
|
|
|
if filters and filters.get("supplier_type"):
|
|
supplier_list = [item for item in supplier_list if item["supplier_type"] == filters["supplier_type"]]
|
|
|
|
return {
|
|
"total": len(supplier_list),
|
|
"page_no": 1,
|
|
"page_size": 20,
|
|
"list": supplier_list,
|
|
}
|
|
|
|
def create_supplier(self) -> dict:
|
|
return {
|
|
"supplier_id": 1003,
|
|
"supplier_name": "新建供应商",
|
|
"supplier_type": "factory",
|
|
"status": 1,
|
|
}
|
|
|
|
|
|
supplier_service = SupplierService()
|