From d4cae5c48af02e109b1febce8c7c21e560cd6525 Mon Sep 17 00:00:00 2001 From: xxyy <cathay_xy@163.com> Date: 星期二, 18 三月 2025 14:23:55 +0800 Subject: [PATCH] 更新配置和代码逻辑,优化查询及日志 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs index 6dffe4e..7b5b5b2 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs @@ -105,7 +105,7 @@ LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition(); if (expressionType == LinqExpressionType.Equal) { - where += $"{searchParametersList[i].Name} = '{results[j].Item3}'"; + where += $"{searchParametersList[i].Name} like '%{results[j].Item3}%'"; } else { @@ -225,7 +225,10 @@ { return WebResponseContent.Instance.Error("浼犲弬閿欒,鍙傛暟涓嶈兘涓虹┖"); } - string validResult = typeof(TEntity).ValidateDicInEntity(saveModel.MainData, true, TProperties); + + var x = saveModel.MainData; + + string validResult = typeof(TEntity).ValidateDicInEntity(x, true, TProperties); if (!string.IsNullOrEmpty(validResult)) { @@ -286,7 +289,7 @@ List<TDetail> list = detailDics.DicToIEnumerable<TDetail>(); - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); int id = BaseDal.Db.Insertable(entity).ExecuteReturnIdentity(); @@ -298,13 +301,13 @@ BaseDal.Db.Insertable(list).ExecuteCommand(); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); content = WebResponseContent.Instance.OK(); } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); content = WebResponseContent.Instance.Error(ex.Message); } return content; @@ -457,7 +460,7 @@ object mainId = typeof(TEntity).GetPropertyValue(entity, typeof(TEntity).GetKeyName()); if (mainId != null) { - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); if (dynamicDelKeys.Count > 0) BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{detailType.GetKeyName()} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); @@ -474,7 +477,7 @@ BaseDal.Db.Insertable(addRows).ExecuteCommand(); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); content = WebResponseContent.Instance.OK(); } @@ -486,7 +489,7 @@ } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); content = WebResponseContent.Instance.Error(ex.Message); } return content; @@ -532,14 +535,14 @@ { dynamicDelKeys.Add(keys[i]); } - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); if (dynamicDelKeys.Count > 0) BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); BaseDal.DeleteDataByIds(keys); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); return WebResponseContent.Instance.OK(); } @@ -551,7 +554,7 @@ } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); return WebResponseContent.Instance.Error(ex.Message); } } -- Gitblit v1.9.3