Esempio n. 1
0
def SearchAlertCount(search_text):
    params = []
    sql = " SELECT count(*)count from hsh_alert c where 1=1 "
    if isblank(search_text):
        sql = sql + " and c.alert_detail like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or c.alert_number like %s "
        params.append(search_text)
    return executeQuery(sql, params, "json")
Esempio n. 2
0
def SearchSpareCount(search_text):
    params = []
    sql = " SELECT count(*)count from hsh_spare s where 1=1 "
    if isblank(search_text):
        sql = sql + " and s.spare_pn like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or s.spare_product_pn like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or s.spare_substitue_pn like %s "
        params.append(search_text)
    return executeQuery(sql, params, "json")
Esempio n. 3
0
def SearchEOLProductCount(search_text):
    params = []
    sql = " SELECT count(*) count from hsh_category c INNER JOIN  hsh_product p ON c.id = p.hsh_category_id where p.product_eol=1 "
    if isblank(search_text):
        sql = sql + " and c.category_name like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or p.product_name like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or p.product_long_name like %s "
        params.append(search_text)
    return executeQuery(sql, params, "json")
Esempio n. 4
0
def SearchAlert(search_text, page):
    params = []
    sql = """ select *,(select GROUP_CONCAT(hpd.product_name) from hsh_product_alert h inner join hsh_product hpd on h.product_id=hpd.id  where h.alert_id=ha.id) product_name
                from hsh_alert ha  """
    if isblank(search_text):
        sql = sql + " and ha.alert_detail like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or ha.alert_number like %s "
        params.append(search_text)
    sql = sql + " GROUP BY ha.id limit %s,%s"
    params.append((int(page) - 1) * Resp.PAGESIZE)
    params.append(Resp.PAGESIZE)
    return executeQuery(sql, params, "")
Esempio n. 5
0
def SearchTipCount(search_text):
    params = []
    sql = " SELECT count(*)count from hsh_tip c where 1=1 " 
    if isblank(search_text):
        sql = sql + " and c.tip_detail like %s "
        params.append(search_text)
    return executeQuery(sql, params, "")
Esempio n. 6
0
def SearchDocCount(search_text):
    params = []
    sql = " SELECT count(*)count from hsh_doc where 1=1 "
    if isblank(search_text):
        sql = sql + " and doc_url like %s or doc_title like %s "
        params.append(search_text)
        params.append(search_text)
    return executeQuery(sql, params, "json")
Esempio n. 7
0
def SearchSpare(search_text, page):
    params = []
    sql = """ select ha.id, ha.spare_pn, ha.spare_description, ha.spare_product_pn, ha.spare_substitue_pn,(select GROUP_CONCAT(hpd.product_name) from hsh_product_spare h inner join hsh_product hpd on h.product_id=hpd.id  
            where h.spare_id=ha.id) product_name , (select GROUP_CONCAT(ty.spare_type_name) from hsh_spare_type ty
            where ty.id = ha.spare_type_id)type_name from hsh_spare ha 
            """
    if isblank(search_text):
        sql = sql + " and ha.spare_pn like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or ha.spare_product_pn like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or ha.spare_substitue_pn like %s "
        params.append(search_text)
    sql = sql + " GROUP BY ha.id limit %s,%s"
    params.append((int(page) - 1) * Resp.PAGESIZE)
    params.append(Resp.PAGESIZE)
    return executeQuery(sql, params, "")
Esempio n. 8
0
def SearchProduct(search_text, page):
    params = []
    sql = """ SELECT c.id as category_id, category_name, p.id as product_id
            , p.product_name, p.product_long_name, p.hsh_property_id, p.product_eol
            ,p.product_view_url, p.create_time as create_time from hsh_category c INNER JOIN  hsh_product p ON c.id = p.hsh_category_id 
            where p.product_eol=0 """
    if isblank(search_text):
        sql = sql + " and c.category_name like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or p.product_name like %s "
        params.append(search_text)
    if isblank(search_text):
        sql = sql + " or p.product_long_name like %s "
        params.append(search_text)
    sql = sql + " ORDER BY p.create_time DESC limit %s,%s"
    params.append((int(page) - 1) * Resp.PAGESIZE)
    params.append(Resp.PAGESIZE)
    return executeQuery(sql, params, "")
Esempio n. 9
0
def SearchDoc(search_text, page):
    params = []
    sql = """ SELECT ha.id, ha.doc_title, ha.doc_url, (SELECT GROUP_CONCAT(hpd.product_name) FROM hsh_product_doc h INNER JOIN hsh_product hpd 
            ON h.product_id=hpd.id WHERE h.doc_id=ha.id) product_name FROM hsh_doc ha """
    if isblank(search_text):
        sql = sql + "WHERE ha.doc_title like %s or ha.doc_url like %s "
        params.append(search_text)
        params.append(search_text)
    sql = sql + "GROUP BY id limit %s, %s "
    params.append((int(page) - 1) * Resp.PAGESIZE)
    params.append(Resp.PAGESIZE)
    return executeQuery(sql, params, "")
Esempio n. 10
0
def SearchTip(search_text, page):
    params = []
    sql = """ SELECT hsh_tip.`id` AS tip_id,hsh_tip.`tip_detail`,hsh_product.`product_name`
                FROM hsh_tip 
                    LEFT JOIN hsh_product_tip ON hsh_tip.`id`=hsh_product_tip.`tip_id`
                    LEFT JOIN hsh_product ON hsh_product.`id`= hsh_product_tip.`product_id`
                where 1=1""" 
    if isblank(search_text):
        sql = sql + " and hsh_tip.tip_detail like %s "
        params.append(search_text)
    sql = sql + " GROUP BY hsh_tip.id limit %s,%s"
    params.append((int(page)-1) * Resp.PAGESIZE)
    params.append(Resp.PAGESIZE)
    return executeQuery(sql, params, "")