From f43b7df8400f4fcffc9f19dca0888d61e2b33d5f Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 12 三月 2025 18:41:52 +0800 Subject: [PATCH] WMS系统添加PDA权限,PDA程序 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs | 430 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 430 insertions(+), 0 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" new file mode 100644 index 0000000..5f57b15 --- /dev/null +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" @@ -0,0 +1,430 @@ +锘縰sing Microsoft.Data.SqlClient; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Core.Enums; + +namespace WIDESEA_Core.BaseRepository +{ + public interface IRepository<TEntity> : IDependency where TEntity : class, new() + { + /// <summary> + /// SqlsugarClient瀹炰綋 + /// </summary> + ISqlSugarClient Db { get; } + /// <summary> + /// 閫氳繃涓婚敭鏌ヨ鏁版嵁 + /// </summary> + /// <param name="id">涓婚敭</param> + /// <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> + /// 閫氳繃涓婚敭闆嗗悎鏌ヨ鏁版嵁 + /// </summary> + /// <param name="lstIds">涓婚敭闆嗗悎</param> + /// <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> + /// 娣诲姞澶氭潯鏁版嵁 + /// </summary> + /// <param name="listEntity"></param> + /// <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); + + bool DeleteAndMoveIntoHty(TEntity entity, OperateType operateType); + + bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateType operateType); + + /// <summary> + /// 閫氳繃涓婚敭鏁版嵁鍒犻櫎澶氭潯鏁版嵁 + /// </summary> + /// <param name="ids">涓婚敭鏁扮粍</param> + /// <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> + /// 閫氳繃瀹炰綋闆嗗悎鏁版嵁鍒犻櫎鏁版嵁 + /// </summary> + /// <param name="ids">涓婚敭鏁扮粍</param> + /// <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> + /// 鏇存柊澶氭潯鏁版嵁 + /// </summary> + /// <param name="listEntity"></param> + /// <returns></returns> + bool UpdateData(List<TEntity> listEntity); + + Task<bool> UpdateDataAsync(List<TEntity> listEntity); + + /// <summary> + /// 鎸囧畾鍒楁洿鏂版暟鎹� + /// </summary> + /// <param name="entity"></param> + /// <param name="lstColumns"></param> + /// <param name="lstIgnoreColumns"></param> + /// <returns></returns> + 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> + /// 鏉′欢鏌ヨ鏁版嵁 + /// </summary> + /// <param name="where"></param> + /// <returns></returns> + List<TEntity> QueryData(string where); + + Task<List<TEntity>> QueryDataAsync(string where); + + /// <summary> + /// 鏉′欢鏌ヨ鏁版嵁 + /// </summary> + /// <param name="whereExpression"></param> + /// <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> + /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="orderByFields"></param> + /// <returns></returns> + List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy); + + Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, string orderByFields); + + /// <summary> + /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="where"></param> + /// <returns></returns> + List<TEntity> QueryData(string where, Dictionary<string, OrderByType> orderBy); + + Task<List<TEntity>> QueryDataAsync(string where, Dictionary<string, OrderByType> orderBy); + + /// <summary> + /// 鏌ヨ鎸囧畾鏁版嵁瀵硅薄 + /// </summary> + /// <typeparam name="TResult"></typeparam> + /// <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> + /// 鏉′欢鏌ヨ鎸囧畾鏁版嵁瀵硅薄 + /// </summary> + /// <typeparam name="TResult"></typeparam> + /// <param name="expression"></param> + /// <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 = ""); + + Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields); + + /// <summary> + /// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴� + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="orderByExpression"></param> + /// <param name="isAsc"></param> + /// <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> + /// <param name="where"></param> + /// <param name="orderByFields"></param> + /// <returns></returns> + List<TEntity> QueryData(string where, string orderByFields); + + Task<List<TEntity>> QueryDataAsync(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>> 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璇彞鎵ц鎿嶄綔 + /// </summary> + /// <param name="sql"></param> + /// <param name="sqlParameters"></param> + /// <returns></returns> + int ExecuteSqlCommand(string sql, params SqlParameter[] sqlParameters); + + Task<int> ExecuteSqlCommandAsync(string sql, params SqlParameter[] sqlParameters); + + /// <summary> + /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁 + /// </summary> + /// <param name="sql"></param> + /// <param name="parameters"></param> + /// <returns></returns> + DataTable QueryTable(string sql, SugarParameter[]? parameters = null); + + Task<DataTable> QueryTableAsync(string sql, SugarParameter[]? parameters = null); + + /// <summary> + /// 鏉′欢鏌ヨ鏁版嵁鎸囧畾鏁伴噺鐨勮 + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="top"></param> + /// <param name="orderByFields"></param> + /// <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> + /// <param name="where"></param> + /// <param name="top"></param> + /// <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> + /// 鍒嗛〉鏌ヨ + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="pageIndex"></param> + /// <param name="pageSize"></param> + /// <param name="orderByFields"></param> + /// <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> + /// <param name="where"></param> + /// <param name="pageIndex"></param> + /// <param name="pageSize"></param> + /// <param name="orderByFields"></param> + /// <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> + /// <param name="whereExpression"></param> + /// <param name="pageIndex"></param> + /// <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); + + /// <summary> + /// 鍒嗛〉鏌ヨ + /// </summary> + /// <param name="whereExpression"></param> + /// <param name="pageIndex"></param> + /// <param name="pagesize"></param> + /// <param name="orderBy"></param> + /// <returns></returns> + PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pagesize, Dictionary<string, OrderByType> orderBy); + + PageGridData<TEntity> QueryPage(string where, int pageIndex, int pageSize, Dictionary<string, OrderByType> orderBy); + + /// <summary> + /// 涓よ〃鑱旀煡 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <typeparam name="T2"></typeparam> + /// <typeparam name="TResult"></typeparam> + /// <param name="joinExpression"></param> + /// <param name="selectExpression"></param> + /// <param name="whereExpression"></param> + /// <returns></returns> + 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); + + List<TResult> QueryTabs<T, T2, TResult>( + Expression<Func<T, T2, bool>> joinExpression, + Expression<Func<T, T2, TResult>> selectExpression, + Expression<Func<T, bool>> whereExpressionT1, + Expression<Func<T2, bool>> whereExpressionT2, + 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> + /// 涓よ〃鑱旀煡-鍒嗛〉 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <typeparam name="T2"></typeparam> + /// <typeparam name="TResult"></typeparam> + /// <param name="joinExpression"></param> + /// <param name="selectExpression"></param> + /// <param name="whereExpression"></param> + /// <param name="pageIndex"></param> + /// <param name="pageSize"></param> + /// <param name="orderByFields"></param> + /// <returns></returns> + PageGridData<TResult> QueryTabsPage<T, T2, TResult>( + Expression<Func<T, T2, object[]>> joinExpression, + Expression<Func<T, T2, TResult>> selectExpression, + Expression<Func<TResult, bool>> whereExpression, + int pageIndex = 1, + int pageSize = 20, + string? orderByFields = null); + + /// <summary> + /// 涓よ〃鑱斿悎鏌ヨ-鍒嗛〉-鍒嗙粍 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <typeparam name="T2"></typeparam> + /// <typeparam name="TResult"></typeparam> + /// <param name="joinExpression"></param> + /// <param name="selectExpression"></param> + /// <param name="whereExpression"></param> + /// <param name="groupExpression"></param> + /// <param name="pageIndex"></param> + /// <param name="pageSize"></param> + /// <param name="orderByFields"></param> + /// <returns></returns> + PageGridData<TResult> QueryTabsPage<T, T2, TResult>( + Expression<Func<T, T2, object[]>> joinExpression, + Expression<Func<T, T2, TResult>> selectExpression, + Expression<Func<TResult, bool>> whereExpression, + Expression<Func<T, object>> groupExpression, + int pageIndex = 1, + int pageSize = 20, + string? orderByFields = null); + + //List<TResult> QueryMuch<T, T2, T3, TResult>( + // Expression<Func<T, T2, T3, object[]>> joinExpression, + // Expression<Func<T, T2, T3, TResult>> selectExpression, + // 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