Beispiel #1
0
    def get_interface_list(interface_name, interface_index, start_time,
                           end_time, is_deleted, page, limit):
        """获取任务流列表"""
        condition = []
        if interface_name:
            condition.append('interface_name LIKE "%%%%%s%%%%"' %
                             interface_name)
        if interface_index:
            condition.append('interface_index IN (%s)' %
                             ','.join('"%s"' % item
                                      for item in interface_index))
        if start_time:
            condition.append('insert_time >= %s' % start_time)
        if end_time:
            condition.append('insert_time <= %s' % end_time)
        if is_deleted == 1:
            condition.append('is_deleted = 0')
        elif is_deleted == 2:
            condition.append('is_deleted = 1')

        condition = 'WHERE ' + ' AND '.join(condition) if condition else ''

        result = InterfaceModel.get_interface_list(db.etl_db, condition, page,
                                                   limit)
        for item in result:
            item['run_time'] = item['run_time'].strftime(
                '%Y-%m-%d') if item['run_time'] else ''
        total = InterfaceModel.get_interface_count(db.etl_db, condition)
        return Response(result=result, total=total)
Beispiel #2
0
    def get_interface_list(interface_name, start_time, end_time,
                           interface_type, is_deleted, page, limit):
        """获取接口列表"""
        condition = []
        if interface_name:
            condition.append('interface_name LIKE "%%%%%s%%%%"' %
                             interface_name)
        if start_time:
            condition.append('insert_time >= %s' % start_time)
        if end_time:
            condition.append('insert_time <= %s' % end_time)
        if interface_type:
            condition.append('interface_type = %s' % interface_type)
        if is_deleted == 1:
            condition.append('is_deleted = 0')
        elif is_deleted == 2:
            condition.append('is_deleted = 1')

        condition = 'WHERE ' + ' AND '.join(condition) if condition else ''

        result = InterfaceModel.get_interface_list(db.etl_db, condition, page,
                                                   limit)
        total = InterfaceModel.get_interface_count(db.etl_db, condition)
        return Response(result=result, total=total)