Parcourir la source

Merge branch 'v2' of https://gitee.com/zuohuaijun/Admin.NET into v2

Cyrus Zhou il y a 10 mois
Parent
commit
de61fc3da6

+ 2 - 1
Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj

@@ -41,7 +41,8 @@
     <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.10.0" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
-    <PackageReference Include="SqlSugarCore" Version="5.1.4.197" />
+    <PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.220" />
+    <PackageReference Include="SqlSugarCore" Version="5.1.4.198" />
     <PackageReference Include="SSH.NET" Version="2025.0.0" />
     <PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.6" />
     <PackageReference Include="System.Net.Http" Version="4.3.4" />

+ 3 - 9
Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

@@ -319,15 +319,9 @@ public class SysCodeGenService : IDynamicApiController, ITransient
         var types = new List<Type>();
         if (_codeGenOptions.EntityAssemblyNames != null)
         {
-            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
-            foreach (var assembly in assemblies)
-            {
-                var assemblyName = assembly.GetName().Name;
-                if (!_codeGenOptions.EntityAssemblyNames.Contains(assemblyName) && !_codeGenOptions.EntityAssemblyNames.Any(name => assemblyName!.Contains(name))) continue;
-
-                Assembly asm = Assembly.Load(assemblyName!);
-                types.AddRange(asm.GetExportedTypes().ToList());
-            }
+            types = App.EffectiveTypes.Where(c => c.IsClass)
+                .Where(c => _codeGenOptions.EntityAssemblyNames.Contains(c.Assembly.GetName().Name) || _codeGenOptions.EntityAssemblyNames.Any(name => c.Assembly.GetName().Name!.Contains(name)))
+                .ToList();
         }
 
         Type[] cosType = types.Where(o => IsMyAttribute(Attribute.GetCustomAttributes(o, true))).ToArray();

+ 5 - 0
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -43,6 +43,11 @@ public static class SqlSugarSetup
         var dbOptions = App.GetConfig<DbConnectionOptions>("DbConnection", true);
         dbOptions.ConnectionConfigs.ForEach(SetDbConfig);
 
+        //注册DLL防止找不到DLL(扔在程序启动时)
+        InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] {
+            typeof(SqlSugar.MongoDb.MongoDbProvider).Assembly
+        };
+
         SqlSugarScope sqlSugar = new(dbOptions.ConnectionConfigs.Adapt<List<ConnectionConfig>>(), db =>
         {
             dbOptions.ConnectionConfigs.ForEach(config =>

+ 3 - 0
Admin.NET/Admin.NET.Web.Entry/wwwroot/template/Service.cs.vm

@@ -68,7 +68,10 @@ public partial class @(Model.ClassName)Service : IDynamicApiController, ITransie
             @:.WhereIF(input.@(column.PropertyName).HasValue, u => u.@(column.PropertyName) == (int)input.@(column.PropertyName))
             } else if (column.NetType.TrimEnd('?') == "DateTime" && column.QueryType == "~") {
             @:.WhereIF(input.@(column.PropertyName)Range?.Length == 2, u => u.@(column.PropertyName) >= input.@(column.PropertyName)Range[0] && u.@(column.PropertyName) <= input.@(column.PropertyName)Range[1])
+            } else if (column.NetType.TrimEnd('?').EndsWith("bool")) {
+            @:.WhereIF(input.@(column.PropertyName).HasValue, u => u.@(column.PropertyName) == input.@(column.PropertyName))
             }
+
           }
           // 联表
           if (Model.HasJoinTable) {

+ 6 - 2
Admin.NET/Admin.NET.Web.Entry/wwwroot/template/editDialog.vue.vm

@@ -103,7 +103,11 @@ defineExpose({ openDialog });
 					}
 					@foreach (var column in Model.AddUpdateFieldList) {
 					var showStatus = Model.IsStatus(column) ? $"v-if=\"state.ruleForm.{Model.PrimaryKeyFieldList.First().LowerPropertyName}\" " : "";
-					@:<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" @showStatus>
+					if (column.EffectType == "InputTextArea"){
+						@:<el-col :xs="24" class="mb20" @showStatus>
+							} else{
+						@:<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" @showStatus>
+							} 
 						@:<el-form-item label="@column.ColumnComment" prop="@(column.LowerPropertyName)">
 						if (column.IsSelectorEffectType) {
 							if (column.EffectType == "ApiTreeSelector") {
@@ -161,7 +165,7 @@ defineExpose({ openDialog });
                              else if (column.EffectType == "InputNumber") {
 							@:<el-input-number v-model="state.ruleForm.@(column.LowerPropertyName)" placeholder="请输入@(column.ColumnComment)" clearable />
 						} else if (column.EffectType == "Switch") {
-							@:<el-switch v-model="state.ruleForm.@(column.LowerPropertyName)" active-text="是" inactive-text="否" />
+							@:<el-switch v-model="state.ruleForm.@(column.LowerPropertyName)" />
 						} else if (column.EffectType == "DatePicker") {
 							@:<el-date-picker v-model="state.ruleForm.@(column.LowerPropertyName)" type="date" placeholder="@(column.ColumnComment)" />
 						} else {

+ 5 - 0
Admin.NET/Admin.NET.Web.Entry/wwwroot/template/index.vue.vm

@@ -197,6 +197,11 @@ handleQuery();
               } else {
               @:<el-date-picker placeholder="请选择@(column.ColumnComment)" value-format="YYYY/MM/DD"  v-model="state.tableQueryParams.@(column.LowerPropertyName)" />
               }
+            } else if  (column.EffectType == "Switch"){ 
+                  @:<el-select clearable filterable v-model="state.tableQueryParams.@(column.LowerPropertyName)" placeholder="请选择@(column.ColumnComment)"> 
+                    @:<el-option     value="true" label="是" /> 
+                    @:<el-option     value="false" label="否" />  
+                  @:</el-select>
             } else {
               @:<el-input v-model="state.tableQueryParams.@(column.LowerPropertyName)" clearable placeholder="请输入@(column.ColumnComment)"/>
             }