1、问题引出
在做开发项目时肯定会遇到搜索的时候,平常简单的搜索可以是输入关键字后直接去数据库查询,但是当遇到你你不缺点有哪些字段是前端会传过来的时候如何查询呢?
2、如何进行不确定条件查询
先看一下我是如何来写进行不确定查询的
@app.route('/v1/task/auditing/viewlist/search', methods=['GET'])
@api_validator(schema={
"search": {"type": "string", "required": False},
"task_type": {"type": "string", "required": False},
"execution": {"type": "string", "required": False},
"create_time": {"type": "string", "required": False},
"task_status": {"type": "string", "required": False}
})
def auditing_tasks_search(search, task_type, execution, create_time, task_status):
search_dic = {"task_type": task_type, "execution": execution, "create_time": create_time,