zoukankan      html  css  js  c++  java
  • 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不区分大小写的话,设置表中的该字符串类型未不区分大小写就可以了

    discount_info_list = DiscountInfoModel.query.filter(or_(
    and_(DiscountInfoModel.discount_expiry_start_time <= today,
    DiscountInfoModel.discount_expiry_end_time >= today,
    DiscountInfoModel.discount_time_type == 0,
    "JSON_CONTAINS(shop_id->'$', '{}')".format(shop_info.get('shop_id'))),
    and_(DiscountInfoModel.discount_expiry_start_time <= today1,
    DiscountInfoModel.discount_expiry_end_time >= today1,
    DiscountInfoModel.discount_time_type == 1,
    "JSON_CONTAINS(shop_id->'$', '{}')".format(shop_info.get('shop_id')))
    )).all()
    filter(DiscountInfoModel.shop_id.contains(shop_id)) 
     
  • 相关阅读:
    Bot Style Tests VS Page Objects
    Qemu文档
    PlantUML
    include <xxx.h> 和 include "xxxx.h"的区别
    2021.40 喜欢当下
    2021.39 MIUI崩溃
    2021.38 聚焦
    2021.37 心流
    2021.36 负熵
    2021.35 精神熵
  • 原文地址:https://www.cnblogs.com/fengff/p/9282690.html
Copyright © 2011-2022 走看看