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)) 
     
  • 相关阅读:
    poj 1743 Musical Theme 后缀数组
    poj 1743 Musical Theme 后缀数组
    cf 432D Prefixes and Suffixes kmp
    cf 432D Prefixes and Suffixes kmp
    hdu Data Structure? 线段树
    关于position和anchorPoint之间的关系
    ios POST 信息
    CALayers的代码示例
    CALayers详解
    ios中得sqlite使用基础
  • 原文地址:https://www.cnblogs.com/fengff/p/9282690.html
Copyright © 2011-2022 走看看