def init_mouth_type(mouth_type): sql = "SELECT * FROM MouthType WHERE id=:id" result_set = ClientDatabase.get_result_set(sql, mouth_type) if len(result_set) != 0: return sql = "INSERT INTO MouthType (id, defaultUsePrice,defaultOverduePrice, name,deleteFlag)" \ "VALUES (:id,:defaultUsePrice,:defaultOverduePrice,:name,:deleteFlag)" ClientDatabase.insert_or_update_database(sql, mouth_type)
def get_record(record_param): sql = "SELECT * FROM TransactionRecord WHERE express_id = :express_id" return ClientDatabase.get_result_set(sql, record_param)
def check_download_by_id(param): sql = "SELECT * FROM Download WHERE id=:id" return ClientDatabase.get_result_set(sql, param)
def get_not_finish_info(param): sql = "SELECT * FROM Download WHERE status!=:status AND type=:type AND flagTime=:flagTime" return ClientDatabase.get_result_set(sql, param)
def get_box_by_box_id(box_id): sql = "SELECT * FROM Box WHERE id = :id AND deleteFlag = :deleteFlag" return ClientDatabase.get_result_set(sql, box_id)
def get_free_mouth_by_type_enable(mouth_param): sql = "SELECT * FROM Mouth WHERE deleteFlag = :deleteFlag AND status = :status " \ "LIMIT 0,1" return ClientDatabase.get_result_set(sql, mouth_param)
def get_holiday_by_id(param): sql = "SELECT * FROM Holiday WHERE deleteFlag = 0 AND id = :id" return ClientDatabase.get_result_set(sql, param)
def check_alert_by_value_id(param): sql = "SELECT * FROM Alert WHERE value_id = :value_id AND alertType =:alertType ORDER BY createTime DESC " return ClientDatabase.get_result_set(sql, param)
def get_mouth_by_id(mouth_param): sql = "SELECT * FROM Mouth WHERE id = :id" return ClientDatabase.get_result_set(sql, mouth_param)
def check_alert_status(ups_parm): sql = "SELECT * FROM Alert WHERE alertType = :alertType ORDER BY createTime DESC " return ClientDatabase.get_result_set(sql, ups_parm)
def check_not_sync(param): sql = "SELECT * FROM Alert WHERE SyncFlag = 0 ORDER BY createTime DESC " return ClientDatabase.get_result_set(sql, param)
def get_company_by_id(company_param): sql = "SELECT * FROM Company WHERE id = :id" return ClientDatabase.get_result_set(sql, company_param)
def get_overdue_express_by_manager(param): sql = "SELECT * FROM Express " \ "WHERE status =:status AND overdueTime < :overdueTime " \ "AND expressType =:expressType ORDER BY overdueTime DESC LIMIT :startLine,5 " return ClientDatabase.get_result_set(sql, param)
def get_overdue_express_by_logistics_id(param): sql = "SELECT * FROM Express " \ "WHERE logisticsCompany_id = :logisticsCompany_id AND status =:status AND overdueTime < :overdueTime " \ "AND expressType =:expressType ORDER BY overdueTime DESC LIMIT :startLine,5 " return ClientDatabase.get_result_set(sql, param)
def get_not_sync_mouth_list(param): sql = "SELECT * FROM Mouth WHERE deleteFlag=0 AND syncFlag=:syncFlag" return ClientDatabase.get_result_set(sql, param)
def get_cabinet_by_id(param): sql = "SELECT * FROM Cabinet WHERE id=:id" return ClientDatabase.get_result_set(sql, param)
def get_free_mouth_by_id(param): sql = "SELECT * FROM Mouth WHERE deleteFlag=0 AND id=:id AND status =:status" return ClientDatabase.get_result_set(sql, param)
def get_free_mouth_count_by_mouth_type_name(param): sql = "SELECT count(1) AS count " \ "FROM Mouth INNER JOIN MouthType " \ "ON Mouth.mouthType_id = MouthType.id AND Mouth.status = :status AND MouthType.name = :name" return ClientDatabase.get_result_set(sql, param)
def get_mouth(msg): sql = "SELECT * FROM Mouth WHERE express_id = :id" return ClientDatabase.get_result_set(sql, msg)[0]
def get_mouth_list(param): sql = "SELECT mouth.id, mouth.deleteFlag, Mouth.number, Mouth.syncFlag, Mouth.status, MouthType.name " \ "FROM Mouth INNER JOIN MouthType " \ "ON Mouth.mouthType_id = MouthType.id AND Mouth.deleteFlag = :deleteFlag " \ "ORDER BY Mouth.number LIMIT :startLine,25 " return ClientDatabase.get_result_set(sql, param)
def get_mouth_type(mouth_type_param): sql = "SELECT * FROM MouthType WHERE name = :name AND deleteFlag = 0" return ClientDatabase.get_result_set(sql, mouth_type_param)
def get_all_mouth(param): sql = "SELECT * FROM Mouth WHERE deleteFlag=:deleteFlag ORDER BY Mouth.number" return ClientDatabase.get_result_set(sql, param)
def get_box_by_order_no(order_no): sql = "SELECT * FROM Box WHERE orderNo = :orderNo AND deleteFlag = :deleteFlag" return ClientDatabase.get_result_set(sql, order_no)
def get_all_mouth_count(param): sql = "SELECT count(1) AS count FROM Mouth WHERE deleteFlag = :deleteFlag" return ClientDatabase.get_result_set(sql, param)
def get_all_download_info(param): sql = "SELECT * FROM Download WHERE status=:status" return ClientDatabase.get_result_set(sql, param)
def get_all_mouth_type(param): sql = "SELECT * FROM MouthType WHERE deleteFlag = :deleteFlag" return ClientDatabase.get_result_set(sql, param)
def get_md5_by_id(param): sql = "SELECT MD5 FROM Download WHERE id=:id" return ClientDatabase.get_result_set(sql, param)
def get_count_by_status_and_mouth_type_id(param): sql = "SELECT count(1) AS mouth_count FROM Mouth WHERE status=:status AND mouthType_id=:mouthType_id " \ "AND deleteFlag=:deleteFlag" return ClientDatabase.get_result_set(sql, param)
def get_upgrade_info(param): sql = "SELECT * FROM Download WHERE type=:type and status =:status AND deleteFlag=0" return ClientDatabase.get_result_set(sql, param)
def get_take_aID_by_validate(param): sql = "SELECT expressNumber FROM Express WHERE ValidateCode=:validateCode AND Status=:status" return ClientDatabase.get_result_set(sql, param)