diff --git a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj
index 0930f88d..71db614c 100644
--- a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj
+++ b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj
@@ -32,13 +32,13 @@
-
+
-
+
diff --git a/Admin.NET/Admin.NET.Core/Entity/SysCodeGenConfig.cs b/Admin.NET/Admin.NET.Core/Entity/SysCodeGenConfig.cs
index 03f6b814..873fd0ad 100644
--- a/Admin.NET/Admin.NET.Core/Entity/SysCodeGenConfig.cs
+++ b/Admin.NET/Admin.NET.Core/Entity/SysCodeGenConfig.cs
@@ -81,6 +81,13 @@ public partial class SysCodeGenConfig : EntityBase
[MaxLength(64)]
public string? FkColumnName { get; set; }
+ ///
+ /// 外键链接字段
+ ///
+ [SugarColumn(ColumnDescription = "外键链接字段", Length = 64)]
+ [MaxLength(64)]
+ public string? FkLinkColumnName { get; set; }
+
///
/// 外键显示字段.NET类型
///
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenConfig.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenConfig.cs
index 0b842d8b..90b52b29 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenConfig.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenConfig.cs
@@ -77,6 +77,11 @@ public class CodeGenConfig
///
public string FkColumnName { get; set; }
+ ///
+ /// 外键链接字段
+ ///
+ public string FkLinkColumnName { get; set; }
+
///
/// 外键显示字段(首字母小写)
///
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/PageCodeGenInput.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/PageCodeGenInput.cs
index 2e51e331..ab0574d8 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/PageCodeGenInput.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/PageCodeGenInput.cs
@@ -178,7 +178,7 @@ public class DeleteCodeGenInput
public long Id { get; set; }
}
-public class UpdateCodeGenInput : PageCodeGenInput
+public class UpdateCodeGenInput : AddCodeGenInput
{
///
/// 代码生成器Id
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
index a6ab9946..bc30f16c 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
@@ -61,7 +61,8 @@ public class SysCodeGenService : IDynamicApiController, ITransient
var codeGen = input.Adapt();
var newCodeGen = await _db.Insertable(codeGen).ExecuteReturnEntityAsync();
- // 加入配置表中
+
+ // 增加配置表
_codeGenConfigService.AddList(GetColumnList(input), newCodeGen);
}
@@ -78,7 +79,12 @@ public class SysCodeGenService : IDynamicApiController, ITransient
if (isExist)
throw Oops.Oh(ErrorCodeEnum.D1400);
- await _db.Updateable(input.Adapt()).ExecuteCommandAsync();
+ var codeGen = input.Adapt();
+ await _db.Updateable(codeGen).ExecuteCommandAsync();
+
+ // 更新配置表
+ await _codeGenConfigService.DeleteCodeGenConfig(codeGen.Id);
+ _codeGenConfigService.AddList(GetColumnList(input.Adapt()), codeGen);
}
///
@@ -97,7 +103,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
{
_db.Deleteable().In(u.Id).ExecuteCommand();
- // 删除配置表中
+ // 删除配置表
codeGenConfigTaskList.Add(_codeGenConfigService.DeleteCodeGenConfig(u.Id));
});
await Task.WhenAll(codeGenConfigTaskList);
diff --git a/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs b/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
index f974a88e..5b1a8cb8 100644
--- a/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
@@ -180,7 +180,7 @@ public class SysRegionService : IDynamicApiController, ITransient
list.Add(region);
// 市级
- if (!string.IsNullOrEmpty(item.Href) && syncLevel > 1)
+ if (!string.IsNullOrEmpty(item.Href))
{
var dom1 = await context.OpenAsync(item.Href);
var itemList1 = dom1.QuerySelectorAll("table.citytable tr.citytr td a");
@@ -196,6 +196,13 @@ public class SysRegionService : IDynamicApiController, ITransient
Remark = item1.Href,
Level = 2,
};
+ // 若URL中查询的一级行政区域缺少Code则通过二级区域填充
+ if (list.Count == 1 && !string.IsNullOrEmpty(region1.Code))
+ region.Code = region1.Code.Substring(0, 2).PadRight(region1.Code.Length, '0');
+ // 同步层级为“1-省级”退出
+ if (syncLevel < 2)
+ break;
+
list.Add(region1);
// 区县级
diff --git a/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs b/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
index 33f93a2d..5c3c3ee9 100644
--- a/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
+++ b/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
@@ -92,6 +92,10 @@ public static class SqlSugarSetup
IsAutoUpdateQueryFilter = true, // 启用更新查询过滤器
SqlServerCodeFirstNvarchar = true // 采用Nvarchar
};
+
+ // 若库类型是人大金仓则默认设置PG模式
+ if (config.DbType == SqlSugar.DbType.Kdbndp)
+ config.MoreSettings.DatabaseModel = SqlSugar.DbType.PostgreSQL; // 配置PG模式主要是兼容系统表差异
}
///
diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/Service.cs.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/Service.cs.vm
index 2516af7a..4b4e8356 100644
--- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/Service.cs.vm
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/Service.cs.vm
@@ -78,7 +78,7 @@ if (@column.QueryWhether == "Y"){
@foreach (var column in Model.TableField){
if(@column.EffectType == "fk"){
joinTableName += ", " + column.PropertyName.ToLower();
- @:.LeftJoin<@(@column.FkEntityName)>((@(@joinTableName)) => u.@(@column.PropertyName) == @(@column.PropertyName.ToLower()).Id )
+ @:.LeftJoin<@(@column.FkEntityName)>((@(@joinTableName)) => u.@(@column.PropertyName) == @(@column.PropertyName.ToLower()).@(@column.FkLinkColumnName) )
} else if(@column.EffectType == "ApiTreeSelect"){
joinTableName += ", " + column.PropertyName.ToLower();
@:.LeftJoin<@(@column.FkEntityName)>((@(@joinTableName)) => u.@(@column.PropertyName) == @(@column.PropertyName.ToLower()).@(@column.ValueColumn) )
@@ -205,7 +205,7 @@ if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.Quer
@:.Select(u => new
@:{
@:Label = u.@(@column.FkColumnName),
- @:Value = u.Id
+ @:Value = u.@(@column.FkLinkColumnName)
@:}
@:).ToListAsync();
@:}
diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
index 1877b132..43066dd5 100644
--- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
@@ -3,23 +3,23 @@
{
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
}
- var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();
- string pkFieldName = null;
- if(pkField != null && !string.IsNullOrEmpty(pkField.PropertyName))
- {
- pkFieldName = LowerFirstLetter(pkField.PropertyName);
- }
- Dictionary definedObjects = new Dictionary();
- bool haveLikeCdt = false;
- foreach (var column in Model.TableField){
- if (column.QueryWhether == "Y" && column.QueryType == "like"){
- haveLikeCdt = true;
- }
- }
+ var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();
+ string pkFieldName = null;
+ if(pkField != null && !string.IsNullOrEmpty(pkField.PropertyName))
+ {
+ pkFieldName = LowerFirstLetter(pkField.PropertyName);
+ }
+ Dictionary definedObjects = new Dictionary();
+ bool haveLikeCdt = false;
+ foreach (var column in Model.TableField){
+ if (column.QueryWhether == "Y" && column.QueryType == "like"){
+ haveLikeCdt = true;
+ }
+ }
}
-
-
+
+
@if(Model.QueryWhetherList.Count > 0){
@@ -38,8 +38,8 @@
} else if(@column.EffectType == "InputNumber") {
-
-
+
+
} else if(@column.EffectType == "fk") {
@@ -86,7 +86,7 @@
- 查询
+ 查询
重置
高级查询
隐藏
@@ -95,17 +95,17 @@
-
+
- 新增
+ 新增
- @foreach (var column in Model.TableField) {
- if(@column.WhetherTable == "Y") {
+ @foreach (var column in Model.TableField) {
+ if(@column.WhetherTable == "Y") {
if(@column.EffectType == "Upload") {
@:
@:
} else if(@column.EffectType == "ConstSelector") {
@:
- @:{{codeToName(row.@(@column.LowerPropertyName), '@(@column.DictTypeCode)')}}
+ @:{{codeToName(row.@(@column.LowerPropertyName), '@(@column.DictTypeCode)')}}
@:
- } else if(@column.EffectType == "Select") {
+ } else if(@column.EffectType == "Select") {
@:
- @: {{di('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
+ @: {{di('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
@:
- } else if(@column.EffectType == "EnumSelector") {
+ } else if(@column.EffectType == "EnumSelector") {
@:
- @: {{dv('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
+ @: {{dv('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
@:
- }
- }
- }
+ }
+ }
+ }
- @if(@Model.PrintType == "custom") {
+ @if(@Model.PrintType == "custom") {
-
+
- }
+ }
-
+
-
+
-
-
-
+
+
+