JSON LIKE

is_exist = HelperInfoModel.query.filter(and_("json_extract(content,'$.cn'" == content.get('cn'), 
HelperInfoModel.type == type, HelperInfoModel.status == Constants.DB_STATE_NORMAL)).first()

if content:
base_query = base_query.filter(or_("upper(json_extract(content,'$.cn')) like '%{}%'".format(content),
"upper(json_extract(content,'$.en')) like '%{}%'".format(content),
"upper(json_extract(content,'$.th')) like '%{}%'".format(content)))

如果是字符串like不区分大小写的话,设置表中的该字符串类型未不区分大小写就可以了
 

猜你喜欢

转载自www.cnblogs.com/fengff/p/9282690.html