From 858b8d80827fde2ebe0ffc8b832b96a849c14bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Mon, 13 Jan 2025 16:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9E=9A=E4=B8=BE=E4=B9=9F=E6=94=AF=E6=8C=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A80=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=80=BC=E4=BD=BF?= =?UTF-8?q?=E7=94=A8-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XCode/Code/EntityBuilder.cs | 6 +++--- XCodeTool/CubeBuilder.cs | 4 ++-- .../Code/Controllers/controller_parameter.cs | 2 +- XUnitTest.XCode/Code/Controllers/controller_user.cs | 2 +- .../Code/Entity/\345\234\260\345\214\272.cs" | 4 ++-- ...255\227\345\205\270\345\217\202\346\225\260.Biz.cs" | 2 +- ...345\255\227\345\205\270\345\217\202\346\225\260.cs" | 8 ++++---- ...346\210\220\345\221\230\346\227\245\345\277\227.cs" | 6 +++--- .../Code/Entity/\346\227\245\345\277\227.cs" | 6 +++--- .../Code/Entity/\347\224\250\346\210\267.Biz.cs" | 2 +- .../Code/Entity/\347\224\250\346\210\267.cs" | 4 ++-- ...347\224\250\346\210\267\346\227\245\345\277\227.cs" | 6 +++--- .../Code/Entity/\347\247\237\346\210\267.cs" | 2 +- ...347\247\237\346\210\267\345\205\263\347\263\273.cs" | 10 +++++----- .../Code/Entity/\350\217\234\345\215\225.cs" | 6 +++--- .../Code/Entity/\350\247\222\350\211\262.cs" | 2 +- .../Code/Entity/\351\203\250\351\227\250.cs" | 6 +++--- XUnitTest.XCode/Code/entity_log_normal.cs | 6 +++--- XUnitTest.XCode/Code/entity_user_normal.cs | 6 +++--- XUnitTest.XCode/Code/entity_user_normal_biz.cs | 2 +- XUnitTest.XCode/Model/Code/entity_city.cs | 4 ++-- XUnitTest.XCode/XUnitTest.XCode.csproj | 3 --- 22 files changed, 48 insertions(+), 51 deletions(-) diff --git a/XCode/Code/EntityBuilder.cs b/XCode/Code/EntityBuilder.cs index 6356f8d1a..4a4e1cf4b 100644 --- a/XCode/Code/EntityBuilder.cs +++ b/XCode/Code/EntityBuilder.cs @@ -1685,7 +1685,7 @@ protected virtual Boolean BuildExtendFind(IDataColumn[] columns, Int32 index) foreach (var dc in columns) { if (dc.DataType != null && dc.DataType.IsInt()) - WriteLine("if ({0} < 0) return null;", dc.CamelName()); + WriteLine("if ({0} <= 0) return null;", dc.CamelName()); else if (dc.DataType == typeof(String)) { if (nullable && dc.Nullable) @@ -1787,7 +1787,7 @@ protected virtual Boolean BuildExtendFindAll(IDataColumn[] columns, Int32 index) foreach (var dc in columns) { if (dc.DataType != null && dc.DataType.IsInt()) - WriteLine("if ({0} < 0) return [];", dc.CamelName(), ClassName); + WriteLine("if ({0} <= 0) return [];", dc.CamelName(), ClassName); else if (dc.DataType == typeof(String)) { if (Option.Nullable && dc.Nullable) @@ -1950,7 +1950,7 @@ protected virtual IList BuildAdvanceSearch() foreach (var dc in cs) { if (dc.DataType.IsInt() && (dc.DataType.IsEnum || !dc.Properties["Type"].IsNullOrEmpty())) - WriteLine("if ({0} > 0) exp &= _.{1} == {0};", dc.CamelName(), dc.Name); + WriteLine("if ({0} >= 0) exp &= _.{1} == {0};", dc.CamelName(), dc.Name); else if (dc.DataType.IsInt()) WriteLine("if ({0} >= 0) exp &= _.{1} == {0};", dc.CamelName(), dc.Name); else if (dc.DataType == typeof(Boolean)) diff --git a/XCodeTool/CubeBuilder.cs b/XCodeTool/CubeBuilder.cs index c31b90a00..660ea8649 100644 --- a/XCodeTool/CubeBuilder.cs +++ b/XCodeTool/CubeBuilder.cs @@ -349,9 +349,9 @@ private String BuildSearch() if (dc.DataType.IsInt()) { if (dc.DataType.IsEnum) - sb.AppendLine($" var {name} = ({dc.DataType.FullName})p[\"{name}\"].ToInt();"); + sb.AppendLine($" var {name} = ({dc.DataType.FullName})p[\"{name}\"].ToInt(-1);"); else if (!dc.Properties["Type"].IsNullOrEmpty()) - sb.AppendLine($" var {name} = ({dc.Properties["Type"]})p[\"{name}\"].ToInt();"); + sb.AppendLine($" var {name} = ({dc.Properties["Type"]})p[\"{name}\"].ToInt(-1);"); else if (dc.DataType == typeof(Int64)) sb.AppendLine($" var {name} = p[\"{name}\"].ToLong(-1);"); else diff --git a/XUnitTest.XCode/Code/Controllers/controller_parameter.cs b/XUnitTest.XCode/Code/Controllers/controller_parameter.cs index d47cf5ce2..6cb52e9fb 100644 --- a/XUnitTest.XCode/Code/Controllers/controller_parameter.cs +++ b/XUnitTest.XCode/Code/Controllers/controller_parameter.cs @@ -57,7 +57,7 @@ protected override IEnumerable Search(Pager p) var userId = p["userId"].ToInt(-1); var category = p["category"]; var name = p["name"]; - var kind = (XCode.Membership.ParameterKinds)p["kind"].ToInt(); + var kind = (XCode.Membership.ParameterKinds)p["kind"].ToInt(-1); var enable = p["enable"]?.ToBoolean(); var start = p["dtStart"].ToDateTime(); diff --git a/XUnitTest.XCode/Code/Controllers/controller_user.cs b/XUnitTest.XCode/Code/Controllers/controller_user.cs index 9433d35f9..c6749e2cb 100644 --- a/XUnitTest.XCode/Code/Controllers/controller_user.cs +++ b/XUnitTest.XCode/Code/Controllers/controller_user.cs @@ -60,7 +60,7 @@ protected override IEnumerable Search(Pager p) var code = p["code"]; var roleId = p["roleId"].ToInt(-1); var departmentId = p["departmentId"].ToInt(-1); - var sex = (XCode.Membership.SexKinds)p["sex"].ToInt(); + var sex = (XCode.Membership.SexKinds)p["sex"].ToInt(-1); var mailVerified = p["mailVerified"]?.ToBoolean(); var mobileVerified = p["mobileVerified"]?.ToBoolean(); var areaId = p["areaId"].ToInt(-1); diff --git "a/XUnitTest.XCode/Code/Entity/\345\234\260\345\214\272.cs" "b/XUnitTest.XCode/Code/Entity/\345\234\260\345\214\272.cs" index c51b90b02..ed70b3698 100644 --- "a/XUnitTest.XCode/Code/Entity/\345\234\260\345\214\272.cs" +++ "b/XUnitTest.XCode/Code/Entity/\345\234\260\345\214\272.cs" @@ -266,7 +266,7 @@ public override Object? this[String name] /// 实体对象 public static Area? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -282,7 +282,7 @@ public override Object? this[String name] /// 实体列表 public static IList FindAllByParentID(Int32 parentId) { - if (parentId < 0) return []; + if (parentId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.ParentID == parentId); diff --git "a/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.Biz.cs" "b/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.Biz.cs" index ca2030e16..b2434a55b 100644 --- "a/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.Biz.cs" +++ "b/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.Biz.cs" @@ -144,7 +144,7 @@ public static IList Search(Int32 userId, String? category, String? na if (userId >= 0) exp &= _.UserID == userId; if (!category.IsNullOrEmpty()) exp &= _.Category == category; if (!name.IsNullOrEmpty()) exp &= _.Name == name; - if (kind > 0) exp &= _.Kind == kind; + if (kind >= 0) exp &= _.Kind == kind; if (enable != null) exp &= _.Enable == enable; exp &= _.UpdateTime.Between(start, end); if (!key.IsNullOrEmpty()) exp &= SearchWhereByKeys(key); diff --git "a/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.cs" "b/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.cs" index 598a4d0ac..bd3a33f4f 100644 --- "a/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.cs" +++ "b/XUnitTest.XCode/Code/Entity/\345\255\227\345\205\270\345\217\202\346\225\260.cs" @@ -338,7 +338,7 @@ public override Object? this[String name] /// 实体对象 public static Parameter? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -356,7 +356,7 @@ public override Object? this[String name] /// 实体对象 public static Parameter? FindByUserIDAndCategoryAndName(Int32 userId, String? category, String? name) { - if (userId < 0) return null; + if (userId <= 0) return null; if (category == null) return null; if (name == null) return null; @@ -371,7 +371,7 @@ public override Object? this[String name] /// 实体列表 public static IList FindAllByUserID(Int32 userId) { - if (userId < 0) return []; + if (userId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.UserID == userId); @@ -385,7 +385,7 @@ public static IList FindAllByUserID(Int32 userId) /// 实体列表 public static IList FindAllByUserIDAndCategory(Int32 userId, String? category) { - if (userId < 0) return []; + if (userId <= 0) return []; if (category == null) return []; // 实体缓存 diff --git "a/XUnitTest.XCode/Code/Entity/\346\210\220\345\221\230\346\227\245\345\277\227.cs" "b/XUnitTest.XCode/Code/Entity/\346\210\220\345\221\230\346\227\245\345\277\227.cs" index 4be3bd788..56477b2cd 100644 --- "a/XUnitTest.XCode/Code/Entity/\346\210\220\345\221\230\346\227\245\345\277\227.cs" +++ "b/XUnitTest.XCode/Code/Entity/\346\210\220\345\221\230\346\227\245\345\277\227.cs" @@ -289,7 +289,7 @@ public override Object? this[String name] /// 实体对象 public static MemberLog? FindByID(Int64 id) { - if (id < 0) return null; + if (id <= 0) return null; return Find(_.ID == id); } @@ -313,7 +313,7 @@ public static IList FindAllByActionAndCategory(String? action, String public static IList FindAllByCategoryAndLinkID(String? category, Int32 linkId) { if (category == null) return []; - if (linkId < 0) return []; + if (linkId <= 0) return []; return FindAll(_.Category == category & _.LinkID == linkId); } @@ -323,7 +323,7 @@ public static IList FindAllByCategoryAndLinkID(String? category, Int3 /// 实体列表 public static IList FindAllByCreateUserID(Int32 createUserId) { - if (createUserId < 0) return []; + if (createUserId <= 0) return []; return FindAll(_.CreateUserID == createUserId); } diff --git "a/XUnitTest.XCode/Code/Entity/\346\227\245\345\277\227.cs" "b/XUnitTest.XCode/Code/Entity/\346\227\245\345\277\227.cs" index 31c231ea2..0b3e09dcd 100644 --- "a/XUnitTest.XCode/Code/Entity/\346\227\245\345\277\227.cs" +++ "b/XUnitTest.XCode/Code/Entity/\346\227\245\345\277\227.cs" @@ -280,7 +280,7 @@ public override Object? this[String name] /// 实体对象 public static Log? FindByID(Int64 id) { - if (id < 0) return null; + if (id <= 0) return null; return Find(_.ID == id); } @@ -304,7 +304,7 @@ public static IList FindAllByActionAndCategory(String? action, String? cate public static IList FindAllByCategoryAndLinkID(String? category, Int32 linkId) { if (category == null) return []; - if (linkId < 0) return []; + if (linkId <= 0) return []; return FindAll(_.Category == category & _.LinkID == linkId); } @@ -314,7 +314,7 @@ public static IList FindAllByCategoryAndLinkID(String? category, Int32 link /// 实体列表 public static IList FindAllByCreateUserID(Int32 createUserId) { - if (createUserId < 0) return []; + if (createUserId <= 0) return []; return FindAll(_.CreateUserID == createUserId); } diff --git "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.Biz.cs" "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.Biz.cs" index d463cbdc1..ed665f782 100644 --- "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.Biz.cs" +++ "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.Biz.cs" @@ -179,7 +179,7 @@ public static IList Search(String name, String? mail, String? mobile, Stri if (!mobile.IsNullOrEmpty()) exp &= _.Mobile == mobile; if (!code.IsNullOrEmpty()) exp &= _.Code == code; if (roleId >= 0) exp &= _.RoleID == roleId; - if (sex > 0) exp &= _.Sex == sex; + if (sex >= 0) exp &= _.Sex == sex; if (areaId >= 0) exp &= _.AreaId == areaId; if (online != null) exp &= _.Online == online; if (enable != null) exp &= _.Enable == enable; diff --git "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.cs" "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.cs" index 9a105ce6d..7548f2d6b 100644 --- "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.cs" +++ "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267.cs" @@ -475,7 +475,7 @@ public override Object? this[String name] /// 实体对象 public static User? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -546,7 +546,7 @@ public static IList FindAllByCode(String? code) /// 实体列表 public static IList FindAllByRoleID(Int32 roleId) { - if (roleId < 0) return []; + if (roleId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.RoleID == roleId); diff --git "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267\346\227\245\345\277\227.cs" "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267\346\227\245\345\277\227.cs" index 8f7f32a06..68acc2df0 100644 --- "a/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267\346\227\245\345\277\227.cs" +++ "b/XUnitTest.XCode/Code/Entity/\347\224\250\346\210\267\346\227\245\345\277\227.cs" @@ -291,7 +291,7 @@ public override Object? this[String name] /// 实体对象 public static UserLog? FindByID(Int64 id) { - if (id < 0) return null; + if (id <= 0) return null; return Find(_.ID == id); } @@ -315,7 +315,7 @@ public static IList FindAllByActionAndCategory(String? action, String? public static IList FindAllByCategoryAndLinkID(String? category, Int32 linkId) { if (category == null) return []; - if (linkId < 0) return []; + if (linkId <= 0) return []; return FindAll(_.Category == category & _.LinkID == linkId); } @@ -325,7 +325,7 @@ public static IList FindAllByCategoryAndLinkID(String? category, Int32 /// 实体列表 public static IList FindAllByCreateUserID(Int32 createUserId) { - if (createUserId < 0) return []; + if (createUserId <= 0) return []; return FindAll(_.CreateUserID == createUserId); } diff --git "a/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267.cs" "b/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267.cs" index 76e5f87f2..aace8e214 100644 --- "a/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267.cs" +++ "b/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267.cs" @@ -256,7 +256,7 @@ public override Object? this[String name] /// 实体对象 public static Tenant? FindById(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id); diff --git "a/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267\345\205\263\347\263\273.cs" "b/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267\345\205\263\347\263\273.cs" index 1da2fa42e..eb7996413 100644 --- "a/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267\345\205\263\347\263\273.cs" +++ "b/XUnitTest.XCode/Code/Entity/\347\247\237\346\210\267\345\205\263\347\263\273.cs" @@ -229,7 +229,7 @@ public override Object? this[String name] /// 实体对象 public static TenantUser? FindById(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id); @@ -246,8 +246,8 @@ public override Object? this[String name] /// 实体对象 public static TenantUser? FindByTenantIdAndUserId(Int32 tenantId, Int32 userId) { - if (tenantId < 0) return null; - if (userId < 0) return null; + if (tenantId <= 0) return null; + if (userId <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.TenantId == tenantId && e.UserId == userId); @@ -260,7 +260,7 @@ public override Object? this[String name] /// 实体列表 public static IList FindAllByTenantId(Int32 tenantId) { - if (tenantId < 0) return []; + if (tenantId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TenantId == tenantId); @@ -273,7 +273,7 @@ public static IList FindAllByTenantId(Int32 tenantId) /// 实体列表 public static IList FindAllByUserId(Int32 userId) { - if (userId < 0) return []; + if (userId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.UserId == userId); diff --git "a/XUnitTest.XCode/Code/Entity/\350\217\234\345\215\225.cs" "b/XUnitTest.XCode/Code/Entity/\350\217\234\345\215\225.cs" index e6d88712e..85a9075ad 100644 --- "a/XUnitTest.XCode/Code/Entity/\350\217\234\345\215\225.cs" +++ "b/XUnitTest.XCode/Code/Entity/\350\217\234\345\215\225.cs" @@ -373,7 +373,7 @@ public override Object? this[String name] /// 实体对象 public static Menu? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -403,7 +403,7 @@ public static IList FindAllByName(String name) /// 实体对象 public static Menu? FindByParentIDAndName(Int32 parentId, String name) { - if (parentId < 0) return null; + if (parentId <= 0) return null; if (name.IsNullOrEmpty()) return null; // 实体缓存 @@ -417,7 +417,7 @@ public static IList FindAllByName(String name) /// 实体列表 public static IList FindAllByParentID(Int32 parentId) { - if (parentId < 0) return []; + if (parentId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.ParentID == parentId); diff --git "a/XUnitTest.XCode/Code/Entity/\350\247\222\350\211\262.cs" "b/XUnitTest.XCode/Code/Entity/\350\247\222\350\211\262.cs" index 33dc7548f..fcf374f7e 100644 --- "a/XUnitTest.XCode/Code/Entity/\350\247\222\350\211\262.cs" +++ "b/XUnitTest.XCode/Code/Entity/\350\247\222\350\211\262.cs" @@ -306,7 +306,7 @@ public override Object? this[String name] /// 实体对象 public static Role? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); diff --git "a/XUnitTest.XCode/Code/Entity/\351\203\250\351\227\250.cs" "b/XUnitTest.XCode/Code/Entity/\351\203\250\351\227\250.cs" index 163f0bce9..462513802 100644 --- "a/XUnitTest.XCode/Code/Entity/\351\203\250\351\227\250.cs" +++ "b/XUnitTest.XCode/Code/Entity/\351\203\250\351\227\250.cs" @@ -381,7 +381,7 @@ public override Object? this[String name] /// 实体对象 public static Department? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -411,7 +411,7 @@ public static IList FindAllByName(String name) /// 实体列表 public static IList FindAllByParentIDAndName(Int32 parentId, String name) { - if (parentId < 0) return []; + if (parentId <= 0) return []; if (name.IsNullOrEmpty()) return []; // 实体缓存 @@ -438,7 +438,7 @@ public static IList FindAllByCode(String? code) /// 实体列表 public static IList FindAllByTenantId(Int32 tenantId) { - if (tenantId < 0) return []; + if (tenantId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TenantId == tenantId); diff --git a/XUnitTest.XCode/Code/entity_log_normal.cs b/XUnitTest.XCode/Code/entity_log_normal.cs index f0e7efbf6..e754978c1 100644 --- a/XUnitTest.XCode/Code/entity_log_normal.cs +++ b/XUnitTest.XCode/Code/entity_log_normal.cs @@ -248,7 +248,7 @@ public override Object? this[String name] /// 实体对象 public static Log? FindByID(Int64 id) { - if (id < 0) return null; + if (id <= 0) return null; return Find(_.ID == id); } @@ -272,7 +272,7 @@ public static IList FindAllByActionAndCategory(String action, String? categ public static IList FindAllByCategoryAndLinkID(String? category, Int64 linkId) { if (category == null) return []; - if (linkId < 0) return []; + if (linkId <= 0) return []; return FindAll(_.Category == category & _.LinkID == linkId); } @@ -282,7 +282,7 @@ public static IList FindAllByCategoryAndLinkID(String? category, Int64 link /// 实体列表 public static IList FindAllByCreateUserID(Int32 createUserId) { - if (createUserId < 0) return []; + if (createUserId <= 0) return []; return FindAll(_.CreateUserID == createUserId); } diff --git a/XUnitTest.XCode/Code/entity_user_normal.cs b/XUnitTest.XCode/Code/entity_user_normal.cs index 001860233..269353f6b 100644 --- a/XUnitTest.XCode/Code/entity_user_normal.cs +++ b/XUnitTest.XCode/Code/entity_user_normal.cs @@ -468,7 +468,7 @@ public override Object? this[String name] /// 实体对象 public static User? FindByID(Int32 id) { - if (id < 0) return null; + if (id <= 0) return null; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id); @@ -539,7 +539,7 @@ public static IList FindAllByCode(String? code) /// 实体列表 public static IList FindAllByRoleID(Int32 roleId) { - if (roleId < 0) return []; + if (roleId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.RoleID == roleId); @@ -552,7 +552,7 @@ public static IList FindAllByRoleID(Int32 roleId) /// 实体列表 public static IList FindAllByDepartmentID(Int32 departmentId) { - if (departmentId < 0) return []; + if (departmentId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.DepartmentID == departmentId); diff --git a/XUnitTest.XCode/Code/entity_user_normal_biz.cs b/XUnitTest.XCode/Code/entity_user_normal_biz.cs index 7ae53af76..17b583f92 100644 --- a/XUnitTest.XCode/Code/entity_user_normal_biz.cs +++ b/XUnitTest.XCode/Code/entity_user_normal_biz.cs @@ -178,7 +178,7 @@ public static IList Search(String name, String? mail, String? mobile, Stri if (!code.IsNullOrEmpty()) exp &= _.Code == code; if (roleId >= 0) exp &= _.RoleID == roleId; if (departmentId >= 0) exp &= _.DepartmentID == departmentId; - if (sex > 0) exp &= _.Sex == sex; + if (sex >= 0) exp &= _.Sex == sex; if (mailVerified != null) exp &= _.MailVerified == mailVerified; if (mobileVerified != null) exp &= _.MobileVerified == mobileVerified; if (areaId >= 0) exp &= _.AreaId == areaId; diff --git a/XUnitTest.XCode/Model/Code/entity_city.cs b/XUnitTest.XCode/Model/Code/entity_city.cs index ce6b642e6..1e47e7a11 100644 --- a/XUnitTest.XCode/Model/Code/entity_city.cs +++ b/XUnitTest.XCode/Model/Code/entity_city.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.Serialization; @@ -262,7 +262,7 @@ public static IList FindAllByPname(String pname) /// 实体列表 public static IList FindAllByBuildID(Int32 buildId) { - if (buildId < 0) return []; + if (buildId <= 0) return []; // 实体缓存 if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.BuildID == buildId); diff --git a/XUnitTest.XCode/XUnitTest.XCode.csproj b/XUnitTest.XCode/XUnitTest.XCode.csproj index 24a4f62d2..9d913414d 100644 --- a/XUnitTest.XCode/XUnitTest.XCode.csproj +++ b/XUnitTest.XCode/XUnitTest.XCode.csproj @@ -116,9 +116,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest