using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Repository.BaseRepository.Interface { public interface IBaseRepository { /// /// 新增table一筆資料 /// dictionary ex:{"@guid", Guid.NewGuid()} /// /// 新增資料庫名稱以及值 /// 資料表名稱 /// /// Task AddOneByCustomTable(Dictionary dict, string Table_name); /// /// 透過guid,軟刪除單一筆資料 /// UPDATE {tableName} SET deleted = 1 WHERE {idName} = @Guid /// /// /// /// /// Task DeleteOne(string guid, string tableName, string idName); /// /// 透過guid、db_name、table_name,刪除指定的資料庫之資料表的一筆資料 /// UPDATE {db_name}.{table_name} SET Deleted = 1 WHERE {idName} = @Guid /// /// /// /// /// /// Task DeleteOneByGuidWithCustomDBNameAndTable(string guid, string db_name, string table_name, string idName); /// /// 根據Where條件進行刪除 /// DELETE FROM {table_name} WHERE {sWhere} /// /// /// /// Task PurgeOneByGuidWithCustomDBNameAndTable(string table_name, string sWhere); /// /// 指定單一欄位,實際刪除單一筆資料 /// DELETE FROM {table_name} WHERE {idName} = @Guid /// /// /// /// /// Task PurgeOneAsync(string guid, string table_name, string idName); /// /// 取得所有資料(根據條件以及排序) 不需要則填where為"" /// SELECT * FROM {tableName} WHERE {sWhere} /// /// /// /// /// Ex: new { status = 1} /// /// Task> GetAllAsync(string tableName, string sWhere, object param = null, string sOrderBy = ""); /// /// 根據SQL語句抓取整包資料 /// /// /// /// Ex: new { status = 1} /// Task> GetAllAsync(string sqlString, object param = null); /// /// 取得單一筆資料(排序),不需OrderBy填"" /// SELECT * FROM {tableName} WHERE {sWhere} ORDER BY {sOrderBy} /// /// /// /// /// /// /// Task GetOneAsync(string tableName, string sWhere, object param = null, string sOrderBy = ""); /// /// 取得單一筆資料某一欄位(排序),不需sWhere及sOrderBy填"" /// /// SELECT {selCol} FROM {tableName} WHERE {sWhere} ORDER BY {sOrderBy} /// /// /// /// /// /// 填放欄位 /// Task GetOneAsync(string tableName, string sWhere, string selCol, object param = null, string sOrderBy = ""); /// /// 取得單一筆資料某一欄位(排序),不需sWhere及sOrderBy填"" /// /// SELECT {selCol} FROM {tableName} WHERE {sWhere} ORDER BY {sOrderBy} /// /// /// /// /// /// 填放欄位 /// Task GetOneColAsync(string tableName, string sWhere, string selCol, object param = null, string sOrderBy = ""); /// /// 取得單一筆資料(根據自訂SQL, 自訂參數) /// /// /// /// Task GetOneAsync(string sqlString, object param = null); /// /// 取得多筆資料的某個欄位變成列表 /// SELECT {selCol} FROM {table_name} WHERE {idName} = @Guid /// /// 流水號 /// 資料表名稱 /// 指定欄位名稱的流水號 /// 選擇陣列資料庫欄位名稱 /// Task> GetAllWithCustomDBNameAndTableAsync(string guid, string table_name, string idName, string selCol); /// /// 取資料表當前流水號 /// SELECT SerialNumber FROM {Table_name} WHERE {where} ORDER BY SerialNumber DESC /// /// /// /// Task GetCurrentSerialNumber(string Table_name, string where = ""); /// /// 取資料表當前優先序 /// SELECT Priority FROM {Table_name} WHERE {where} ORDER BY Priority DESC /// /// /// /// Task GetCurrentPriority(string Table_name, string where = ""); /// /// 新增Table多筆資料 /// dictionary ex:{"@guid", Guid.NewGuid()} /// /// /// /// Task AddMutiByCustomTable(List> dict, string Table_name); /// /// 透過Guid來搜尋此筆資料是否存在 /// SELECT * FROM {Table_name} WHERE {id_name} = @Guid /// /// guid值 /// table名稱 /// id名稱 /// Task HasExistsWithGuid(string guid, string Table_name, string id_name); /// /// 根據SQL條件搜尋此筆資料是否存在 /// /// /// Task HasExistsWithParam(string sql, object param = null); /// /// 更新Table一筆資料 /// /// 更新資料庫名稱以及值 /// 資料表名稱 /// Where條件 /// Task UpdateOneByCustomTable(Dictionary dict, string Table_name, string sWhere); /// /// 更新Table多筆資料 /// /// 更新資料庫名稱以及值 /// 資料表名稱 /// Where條件 /// Task UpdateListByCustomTable(List> dicts, string Table_name, string sWhere); Task ExecuteSql(string sql, object param = null); /// /// 新增table一筆資料 /// dictionary ex:{"@guid", Guid.NewGuid()} /// /// 新增資料庫名稱以及值 /// 資料表名稱 /// /// Task AddOneByCustomTableReturnId(Dictionary dict, string Table_name, bool returnId = true); /// /// 清空table資料 /// /// 資料表名稱 /// /// Task TruncateTable(string table_name); } }