From a38b50675f2cf8e813bd337ca2f9d9456cc421d3 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期四, 17 十月 2024 09:50:14 +0800 Subject: [PATCH] WCS --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs | 114 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 96 insertions(+), 18 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" index fa36fd6..b35fc98 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" @@ -23,12 +23,16 @@ /// <returns>鏌ヨ缁撴灉</returns> TEntity QureyDataById(object id); + Task<TEntity> QureyDataByIdAsync(object id); + /// <summary> /// 閫氳繃涓婚敭鏁扮粍鏌ヨ鏁版嵁 /// </summary> /// <param name="lstIds">涓婚敭鏁扮粍</param> /// <returns>鏌ヨ缁撴灉闆嗗悎</returns> List<TEntity> QureyDataByIds(object[] lstIds); + + Task<List<TEntity>> QureyDataByIdsAsync(object[] lstIds); /// <summary> /// 閫氳繃涓婚敭闆嗗悎鏌ヨ鏁版嵁 @@ -37,12 +41,16 @@ /// <returns>鏌ヨ缁撴灉闆嗗悎</returns> List<TEntity> QureyDataByIds(List<object> lstIds); + Task<List<TEntity>> QureyDataByIdsAsync(List<object> lstIds); + /// <summary> /// 娣诲姞鍗曟潯鏁版嵁 /// </summary> /// <param name="entity"></param> /// <returns>褰卞搷琛屾暟</returns> int AddData(TEntity entity); + + Task<int> AddDataAsync(TEntity entity); /// <summary> /// 娣诲姞澶氭潯鏁版嵁 @@ -51,12 +59,16 @@ /// <returns>褰卞搷琛屾暟</returns> int AddData(List<TEntity> listEntity); + Task<int> AddDataAsync(List<TEntity> listEntity); + /// <summary> /// 閫氳繃涓婚敭鍒犻櫎鏁版嵁 /// </summary> /// <param name="id">涓婚敭</param> /// <returns>鍒犻櫎缁撴灉</returns> bool DeleteDataById(object id); + + Task<bool> DeleteDataByIdAsync(object id); /// <summary> /// 閫氳繃涓婚敭鏁版嵁鍒犻櫎澶氭潯鏁版嵁 @@ -65,12 +77,16 @@ /// <returns>鍒犻櫎缁撴灉</returns> bool DeleteDataByIds(object[] ids); + Task<bool> DeleteDataByIdsAsync(object[] ids); + /// <summary> /// 閫氳繃瀹炰綋鏁版嵁鍒犻櫎鏁版嵁 /// </summary> /// <param name="ids">涓婚敭鏁扮粍</param> /// <returns>鍒犻櫎缁撴灉</returns> bool DeleteData(TEntity entity); + + Task<bool> DeleteDataAsync(TEntity entity); /// <summary> /// 閫氳繃瀹炰綋闆嗗悎鏁版嵁鍒犻櫎鏁版嵁 @@ -79,12 +95,16 @@ /// <returns>鍒犻櫎缁撴灉</returns> bool DeleteData(List<TEntity> listEntity); + Task<bool> DeleteDataAsync(List<TEntity> listEntity); + /// <summary> /// 鏇存柊鍗曟潯鏁版嵁 /// </summary> /// <param name="entity"></param> /// <returns></returns> bool UpdateData(TEntity entity); + + Task<bool> UpdateDataAsync(TEntity entity); /// <summary> /// 鏇存柊澶氭潯鏁版嵁 @@ -93,6 +113,8 @@ /// <returns></returns> bool UpdateData(List<TEntity> listEntity); + Task<bool> UpdateDataAsync(List<TEntity> listEntity); + /// <summary> /// 鎸囧畾鍒楁洿鏂版暟鎹� /// </summary> @@ -100,13 +122,17 @@ /// <param name="lstColumns"></param> /// <param name="lstIgnoreColumns"></param> /// <returns></returns> - bool UpdateData(TEntity entity, List<string> lstColumns, List<string> lstIgnoreColumns = null); + bool UpdateData(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null); + + Task<bool> UpdateDataAsync(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null); /// <summary> /// 鏌ヨ鎵�鏈夋暟鎹� /// </summary> /// <returns></returns> List<TEntity> QueryData(); + + Task<List<TEntity>> QueryDataAsync(); /// <summary> /// 鏉′欢鏌ヨ鏁版嵁 @@ -115,6 +141,8 @@ /// <returns></returns> List<TEntity> QueryData(string where); + Task<List<TEntity>> QueryDataAsync(string where); + /// <summary> /// 鏉′欢鏌ヨ鏁版嵁 /// </summary> @@ -122,9 +150,23 @@ /// <returns></returns> List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression); + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression); + TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression); + Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression); + TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression); + + Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression); + + TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy); + + Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy); + + TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy); + + Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy); /// <summary> /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� @@ -132,7 +174,9 @@ /// <param name="whereExpression"></param> /// <param name="orderByFields"></param> /// <returns></returns> - List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, string orderByFields); + List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy); + + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, string orderByFields); /// <summary> /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� @@ -142,6 +186,8 @@ /// <returns></returns> List<TEntity> QueryData(string where, Dictionary<string, OrderByType> orderBy); + Task<List<TEntity>> QueryDataAsync(string where, Dictionary<string, OrderByType> orderBy); + /// <summary> /// 鏌ヨ鎸囧畾鏁版嵁瀵硅薄 /// </summary> @@ -149,6 +195,8 @@ /// <param name="expression"></param> /// <returns></returns> List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression); + + Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression); /// <summary> /// 鏉′欢鏌ヨ鎸囧畾鏁版嵁瀵硅薄 @@ -158,7 +206,9 @@ /// <param name="whereExpression"></param> /// <param name="orderByFields"></param> /// <returns></returns> - List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields); + List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields = ""); + + Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields); /// <summary> /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� @@ -169,6 +219,8 @@ /// <returns></returns> List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true); + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true); + /// <summary> /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� /// </summary> @@ -177,13 +229,7 @@ /// <returns></returns> List<TEntity> QueryData(string where, string orderByFields); - /// <summary> - /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁 - /// </summary> - /// <param name="sql"></param> - /// <param name="parameters"></param> - /// <returns></returns> - List<TEntity> QueryDataBySql(string sql, SugarParameter[] parameters = null); + Task<List<TEntity>> QueryDataAsync(string where, string orderByFields); /// <summary> /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁 @@ -191,9 +237,23 @@ /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> - List<dynamic> QueryDynamicDataBySql(string sql, SugarParameter[] parameters = null); + List<TEntity> QueryDataBySql(string sql, SugarParameter[]? parameters = null); - List<object> QueryObjectDataBySql(string sql, SugarParameter[] parameters = null); + Task<List<TEntity>> QueryDataBySqlAsync(string sql, SugarParameter[]? parameters = null); + + /// <summary> + /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁 + /// </summary> + /// <param name="sql"></param> + /// <param name="parameters"></param> + /// <returns></returns> + List<dynamic> QueryDynamicDataBySql(string sql, SugarParameter[]? parameters = null); + + Task<List<dynamic>> QueryDynamicDataBySqlAsync(string sql, SugarParameter[]? parameters = null); + + List<object> QueryObjectDataBySql(string sql, SugarParameter[]? parameters = null); + + Task<List<object>> QueryObjectDataBySqlAsync(string sql, SugarParameter[]? parameters = null); /// <summary> /// 鍘熺敓Sql璇彞鎵ц鎿嶄綔 @@ -201,7 +261,9 @@ /// <param name="sql"></param> /// <param name="sqlParameters"></param> /// <returns></returns> - public int ExecuteSqlCommand(string sql, params SqlParameter[] sqlParameters); + int ExecuteSqlCommand(string sql, params SqlParameter[] sqlParameters); + + Task<int> ExecuteSqlCommandAsync(string sql, params SqlParameter[] sqlParameters); /// <summary> /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁 @@ -209,7 +271,9 @@ /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> - DataTable QueryTable(string sql, SugarParameter[] parameters = null); + DataTable QueryTable(string sql, SugarParameter[]? parameters = null); + + Task<DataTable> QueryTableAsync(string sql, SugarParameter[]? parameters = null); /// <summary> /// 鏉′欢鏌ヨ鏁版嵁鎸囧畾鏁伴噺鐨勮 @@ -220,6 +284,8 @@ /// <returns></returns> List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields); + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields); + /// <summary> /// 鏉′欢鏌ヨ鎸囧畾鏁伴噺鐨勮 /// </summary> @@ -228,6 +294,8 @@ /// <param name="orderByFields"></param> /// <returns></returns> List<TEntity> QueryData(string where, int top, string orderByFields); + + Task<List<TEntity>> QueryDataAsync(string where, int top, string orderByFields); /// <summary> /// 鍒嗛〉鏌ヨ @@ -239,6 +307,8 @@ /// <returns></returns> List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields); + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields); + /// <summary> /// 鍒嗛〉鏌ヨ /// </summary> @@ -249,6 +319,8 @@ /// <returns></returns> List<TEntity> QueryData(string where, int pageIndex, int pageSize, string orderByFields); + Task<List<TEntity>> QueryDataAsync(string where, int pageIndex, int pageSize, string orderByFields); + /// <summary> /// 鍒嗛〉鏌ヨ /// </summary> @@ -257,7 +329,7 @@ /// <param name="pageSize"></param> /// <param name="orderByFields"></param> /// <returns></returns> - PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields = null); + PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string? orderByFields = null); /// <summary> /// 鍒嗛〉鏌ヨ @@ -284,6 +356,12 @@ List<TResult> QueryTabs<T, T2, TResult>( Expression<Func<T, T2, object[]>> joinExpression, Expression<Func<T, T2, TResult>> selectExpression, + Expression<Func<T, T2, bool>> whereExpressionT1, + Expression<Func<TResult, bool>> whereExpression); + + Task<List<TResult>> QueryTabsAsync<T, T2, TResult>( + Expression<Func<T, T2, object[]>> joinExpression, + Expression<Func<T, T2, TResult>> selectExpression, Expression<Func<TResult, bool>> whereExpression); /// <summary> @@ -305,7 +383,7 @@ Expression<Func<TResult, bool>> whereExpression, int pageIndex = 1, int pageSize = 20, - string orderByFields = null); + string? orderByFields = null); /// <summary> /// 涓よ〃鑱斿悎鏌ヨ-鍒嗛〉-鍒嗙粍 @@ -328,7 +406,7 @@ Expression<Func<T, object>> groupExpression, int pageIndex = 1, int pageSize = 20, - string orderByFields = null); + string? orderByFields = null); //List<TResult> QueryMuch<T, T2, T3, TResult>( // Expression<Func<T, T2, T3, object[]>> joinExpression, @@ -336,4 +414,4 @@ // Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new(); //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination); } -} +} \ No newline at end of file -- Gitblit v1.9.3