You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
5.0 KiB
C#

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using ZKLT.Hadoop.Model;
namespace ZKLT.Hadoop.Interface
{
public interface ITableService
{
/// <summary>
/// 初始化云计算
/// </summary>
/// <param name="config">配置</param>
public void Init(Action<HDP_Source> config);
/// <summary>
/// 获取源
/// </summary>
/// <param name="sourceid">数据源编号</param>
/// <returns>结果</returns>
public HDP_Source GetSource(string sourceid);
/// <summary>
/// 获取表
/// </summary>
/// <param name="tableid">表编号</param>
/// <returns>结果</returns>
public HDP_Table GetTable(string tableid);
/// <summary>
/// 同步结构
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="table">数据表</param>
/// <returns>是否成功</returns>
public bool InitStruct(string sourceId, HDP_Table table);
/// <summary>
/// 删除结构
/// </summary>
/// <param name="sourceId">源</param>
/// <param name="tableId">表</param>
/// <returns>是否成功</returns>
public bool RemoveStruct(string sourceId, string tableId);
/// <summary>
/// 插入数据
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="tableId">数据表</param>
/// <param name="data">数据</param>
/// <returns>是否成功</returns>
public bool Insert(string sourceId, string tableId, JToken? data);
/// <summary>
/// 更新
/// </summary>
/// <param name="source">数据源</param>
/// <param name="table">数据表</param>
/// <param name="where">条件</param>
/// <param name="data">数据</param>
/// <returns>是否成功</returns>
public bool Update(string sourceId, string tableId, JToken? where, JToken? data);
/// <summary>
/// 删除
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="tableId">数据表</param>
/// <param name="where">条件</param>
/// <param name="row">数据</param>
/// <returns>是否成功</returns>
public bool Delete(string sourceId, string tableId, JToken? where, JToken? data);
/// <summary>
/// 查询单个
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="tableId">数据表</param>
/// <param name="where">条件</param>
/// <param name="data">数据</param>
/// <returns>结果</returns>
public T? QuerySingle<T>(string sourceId, string tableId, JToken? where, JToken? data,
string[]? col);
/// <summary>
/// 查询列表
/// </summary>
/// <typeparam name="T">返回类型</typeparam>
/// <param name="source">数据源</param>
/// <param name="table">数据表</param>
/// <param name="where">条件</param>
/// <param name="data">数据</param>
/// <param name="order">排序</param>
/// <param name="col">筛选返回字段</param>
/// <returns>结果集</returns>
public T[] Query<T>(string sourceId, string tableId, JToken? where, JToken? data,
JToken? order, string[]? col);
public string QueryString(string sourceId, string tableId, JToken? where, JToken? data,
JToken? order, string[]? col, Dictionary<string, object> param);
/// <summary>
/// 查询分页列表
/// </summary>
/// <typeparam name="T">返回类型</typeparam>
/// <param name="sourceId">数据源</param>
/// <param name="tableId">数据表</param>
/// <param name="pageIndex">分页下标</param>
/// <param name="pageSize">分页大小</param>
/// <param name="where">条件</param>
/// <param name="data">数据</param>
/// <param name="order">排序</param>
/// <param name="col">返回咧</param>
/// <returns>结果集</returns>
public HDP_Page<T> QueryPage<T>(string sourceId, string tableId, int pageIndex, int pageSize, JToken? where,
JToken? data, JToken? order, string[]? col);
/// <summary>
/// 判断数据源是否存在表
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="tableName">表名</param>
/// <returns>是否存在</returns>
public bool DbExistTable(string sourceId, string tableName);
/// <summary>
/// 查询数据列
/// </summary>
/// <param name="sourceId">数据源</param>
/// <param name="tableId">表</param>
/// <returns>列</returns>
public HDP_Column[] DbGetColumns(string sourceId, string tableId);
}
}