From dddd1f4c9d69ee247bcad44af3950259054a60a8 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期日, 14 一月 2024 13:51:40 +0800 Subject: [PATCH] 模块整理升级 --- Yw.Service.Unit.Core/05-service/02-type/SysUnitType.cs | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Yw.Service.Unit.Core/5-service/2-type/SysUnitType.cs b/Yw.Service.Unit.Core/05-service/02-type/SysUnitType.cs similarity index 94% rename from Yw.Service.Unit.Core/5-service/2-type/SysUnitType.cs rename to Yw.Service.Unit.Core/05-service/02-type/SysUnitType.cs index d6e9d74..7641650 100644 --- a/Yw.Service.Unit.Core/5-service/2-type/SysUnitType.cs +++ b/Yw.Service.Unit.Core/05-service/02-type/SysUnitType.cs @@ -47,7 +47,9 @@ private static void UpdateCache(List<long> Ids) { if (Ids == null || Ids.Count < 1) + { return; + } var dal = new DAL.SysUnitType(); var entityList = dal.GetByIds(Ids); var modelList = Entity2Models(entityList); @@ -105,8 +107,10 @@ /// </summary> public List<Model.SysUnitType> GetByIds(List<long> Ids) { - if (Ids == null || Ids.Count() < 1) + if (Ids == null || Ids.Count < 1) + { return default; + } var all = GetAll(); var list = all.Where(x => Ids.Contains(x.ID)).OrderBy(x => x.SortCode).ToList(); return list; @@ -118,7 +122,9 @@ public Model.SysUnitType GetByCode(string Code) { if (string.IsNullOrEmpty(Code)) + { return default; + } var all = GetAll(); var model = all.Find(x => x.Code == Code); return model; @@ -150,8 +156,10 @@ public int GetMaxSortCode() { var all = GetAll(); - if (all.Count < 1) + if (all == null || all.Count < 1) + { return 0; + } return all.Max(x => x.SortCode); } @@ -165,7 +173,9 @@ public long Insert(Model.SysUnitType model) { if (model == null) + { return default; + } var entity = Model2Entity(model); var dal = new DAL.SysUnitType(); var id = dal.Insert(entity); @@ -182,7 +192,9 @@ public bool Inserts(List<Model.SysUnitType> list) { if (list == null || list.Count < 1) + { return default; + } var dal = new DAL.SysUnitType(); var entityList = Model2Entities(list); var ids = dal.InsertsR(entityList); @@ -204,7 +216,9 @@ public bool Update(Model.SysUnitType model) { if (model == null) + { return default; + } var entity = Model2Entity(model); var dal = new DAL.SysUnitType(); var bol = dal.Update(entity); @@ -221,7 +235,9 @@ public bool Updates(List<Model.SysUnitType> list) { if (list == null || list.Count < 1) + { return default; + } var entityList = Model2Entities(list.ToList()); var dal = new DAL.SysUnitType(); var bol = dal.Updates(entityList); @@ -238,7 +254,9 @@ public bool UpdateSortCode(long ID, int SortCode) { if (ID < 1) + { return default; + } var dal = new DAL.SysUnitType(); var bol = dal.UpdateSortCode(ID, SortCode); if (bol) @@ -254,7 +272,9 @@ public bool UpdateSorter(List<Model.Sorter> sorters) { if (sorters == null || sorters.Count < 1) + { return default; + } var dal = new DAL.SysUnitType(); var bol = dal.UpdateSorter(sorters.ToEntityList()); if (bol) @@ -274,10 +294,14 @@ public bool IsExistCode(string Code) { if (string.IsNullOrEmpty(Code)) + { return false; + } var all = GetAll(); if (all == null || all.Count < 1) + { return default; + } return all.Exists(x => x.Code == Code); } @@ -287,10 +311,14 @@ public bool IsExistCodeExceptID(string Code, long ExceptID) { if (string.IsNullOrEmpty(Code)) + { return false; + } var all = GetAll(); if (all == null || all.Count < 1) + { return default; + } return all.Exists(x => x.Code == Code && x.ID != ExceptID); } -- Gitblit v1.9.3