Example #1
0
def _slice_category_select(key, page=1, per_page=10):
    if key and len(key) > 0:
        categories = r"select `id`,`name` from `cms_navi_category` where `parent_id` =0 and `fatherId`=0 and `type`<>0 and id not in (select category_id from cms_category_index) and (`id` like '%{0}%' or `name` like '%{0}%')".format(
            key)
    else:
        categories = r"select `id`,`name` from `cms_navi_category` where `parent_id` =0 and `fatherId`=0 and `type`<>0 and id not in (select category_id from cms_category_index)"
    total_page, result = BaseCursor.get_pageinate(page, per_page, categories)
    return total_page, result
Example #2
0
def _slice_goods_desc_select(key, category_id, page=1, per_page=15):
    if key and len(key) > 0:
        goods = r"select `goods_id`,CONCAT(name,'-',cp_name) from `view_cms_goods_formal` where `parent_id`=-1 and `new_category`={1} and  (`id` like '%{0}%' or `name` like '%{0}%' or `desc` like '%{0}%' )".format(
            key, category_id)
    else:
        goods = r"select `goods_id`,CONCAT(name,'-',cp_name) from `view_cms_goods_formal` where `parent_id`=-1 and `new_category`={0}".format(
            category_id)
    total_page, result = BaseCursor.get_pageinate(page, per_page, goods)
    return total_page, result
Example #3
0
def _slice_quick_order_select(key, category_id, page=1, per_page=20):
    if key and len(key) > 0:
        goods = r"select qo.id,qo.cms_quick_desc,qo.cms_quick_name from cms_quick_order_category qoc inner join  cms_quick_order qo on qoc.quick_order_id = qo.id where qoc.category_id={1} and (qo.id like '%{0}%' or qo.cms_quick_name like '%{0}%')".format(
            key, category_id)
    else:
        goods = r"select qo.id,qo.cms_quick_desc,qo.cms_quick_name from cms_quick_order_category qoc inner join  cms_quick_order qo on qoc.quick_order_id = qo.id where qoc.category_id={0}".format(
            category_id)
    total_page, result = BaseCursor.get_pageinate(page, per_page, goods)
    return total_page, result
Example #4
0
 def search_quick_order(cls, page, per_page, key=None):
     sql = "select qo.id,c.name,qo.cms_quick_name,qo.cms_quick_desc from cms_quick_order qo inner join cms_quick_order_category qoc on qoc.quick_order_id = qo.id inner join cms_navi_category c on c.id=qoc.category_id order by qo.id desc"
     total_page, result = BaseCursor.get_pageinate(page, per_page, sql)
     return total_page, result
Example #5
0
 def search_category_index(cls, page, per_page, key=None):
     sql = "select ci.id,nc.name,ci.city from cms_category_index ci inner join cms_navi_category nc on nc.id = ci.category_id order by ci.id DESC "
     total_page, result = BaseCursor.get_pageinate(page, per_page, sql)
     return total_page, result