Merge pull request 'v2' (#1) from Admin.NET/Admin.NET.Pro:v2 into v2

Reviewed-on: http://101.43.53.74:3000/ir0nmax/Admin.NET.Pro/pulls/1
This commit is contained in:
薛原 2025-01-19 17:01:39 +08:00
commit ee9cfbd022
12 changed files with 80 additions and 80 deletions

View File

@ -69,11 +69,11 @@ public class DictAttribute : ValidationAttribute, ITransient
}
// 先尝试从 ValidationContext 的依赖注入容器中拿服务,拿不到或类型不匹配时,再从全局的 App 容器中获取
if (validationContext.GetService(typeof(SysDictTypeService)) is not SysDictTypeService sysDictDataService)
sysDictDataService = App.GetRequiredService<SysDictTypeService>();
if (validationContext.GetService(typeof(SysDictDataService)) is not SysDictDataService sysDictDataService)
sysDictDataService = App.GetRequiredService<SysDictDataService>();
// 获取字典值列表
var dictDataList = sysDictDataService.GetDataList(new GetDataDictTypeInput { Code = DictTypeCode }).GetAwaiter().GetResult();
var dictDataList = sysDictDataService.GetDataList(DictTypeCode).GetAwaiter().GetResult();
// 使用 HashSet 来提高查找效率
var dictHash = new HashSet<string>(dictDataList.Select(u => u.Code));

View File

@ -7,9 +7,9 @@
namespace Admin.NET.Core;
/// <summary>
/// 系统参数配置
/// 系统配置参数表
/// </summary>
[SugarTable(null, "系统参数配置表")]
[SugarTable(null, "系统配置参数表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc, IsUnique = true)]
@ -30,9 +30,9 @@ public partial class SysConfig : EntityBase
public string? Code { get; set; }
/// <summary>
/// 属性
/// 参数
/// </summary>
[SugarColumn(ColumnDescription = "属性值", Length = 512)]
[SugarColumn(ColumnDescription = "参数值", Length = 512)]
[MaxLength(512)]
public string? Value { get; set; }

View File

@ -7,9 +7,9 @@
namespace Admin.NET.Core.Service;
/// <summary>
/// 系统参数配置服务 🧩
/// 系统配置参数服务 🧩
/// </summary>
[ApiDescriptionSettings(Order = 440, Description = "参数配置")]
[ApiDescriptionSettings(Order = 440, Description = "配置参数")]
public class SysConfigService : IDynamicApiController, ITransient
{
private readonly UserManager _userManager;
@ -30,11 +30,11 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 获取参数配置分页列表 🔖
/// 获取配置参数分页列表 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("获取参数配置分页列表")]
[DisplayName("获取配置参数分页列表")]
public async Task<SqlSugarPagedList<ConfigOutput>> Page(PageConfigInput input)
{
var query = await GetConfigQueryable();
@ -48,10 +48,10 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 获取参数配置列表 🔖
/// 获取配置参数列表 🔖
/// </summary>
/// <returns></returns>
[DisplayName("获取参数配置列表")]
[DisplayName("获取配置参数列表")]
public async Task<List<ConfigOutput>> List(PageConfigInput input)
{
var query = await GetConfigQueryable();
@ -60,12 +60,12 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 增加参数配置 🔖
/// 增加配置参数 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("增加参数配置")]
[DisplayName("增加配置参数")]
public async Task AddConfig(AddConfigInput input)
{
if (input.SysFlag == YesNoEnum.Y && !_userManager.SuperAdmin) throw Oops.Oh(ErrorCodeEnum.D9002);
@ -75,12 +75,12 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 更新参数配置 🔖
/// 更新配置参数 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("更新参数配置")]
[DisplayName("更新配置参数")]
[UnitOfWork]
public async Task UpdateConfig(UpdateConfigInput input)
{
@ -148,12 +148,12 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 删除参数配置 🔖
/// 删除配置参数 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("删除参数配置")]
[DisplayName("删除配置参数")]
public async Task DeleteConfig(DeleteConfigInput input)
{
var config = await _sysConfigRep.GetByIdAsync(input.Id);
@ -167,12 +167,12 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 批量删除参数配置 🔖
/// 批量删除配置参数 🔖
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "BatchDelete"), HttpPost]
[DisplayName("批量删除参数配置")]
[DisplayName("批量删除配置参数")]
public async Task BatchDeleteConfig(List<long> ids)
{
foreach (var id in ids)
@ -189,18 +189,18 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 获取参数配置详情 🔖
/// 获取配置参数详情 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("获取参数配置详情")]
[DisplayName("获取配置参数详情")]
public async Task<SysConfig> GetDetail([FromQuery] ConfigInput input)
{
return await _sysConfigRep.GetByIdAsync(input.Id);
}
/// <summary>
/// 根据Code获取参数配置
/// 根据Code获取配置参数
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
@ -212,18 +212,18 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 根据Code获取参数配置值 🔖
/// 根据Code获取配置参数值 🔖
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[DisplayName("根据Code获取参数配置值")]
[DisplayName("根据Code获取配置参数值")]
public async Task<string> GetConfigValueByCode(string code)
{
return await GetConfigValueByCode<string>(code);
}
/// <summary>
/// 获取参数配置
/// 获取配置参数值
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
@ -245,7 +245,7 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 更新参数配置
/// 更新配置参数值
/// </summary>
/// <param name="code"></param>
/// <param name="value"></param>
@ -301,12 +301,12 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 批量更新参数配置值 🔖
/// 批量更新配置参数值 🔖
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "BatchUpdate"), HttpPost]
[DisplayName("批量更新参数配置值")]
[DisplayName("批量更新配置参数值")]
public async Task BatchUpdateConfig(List<BatchConfigInput> input)
{
foreach (var config in input)
@ -321,7 +321,7 @@ public class SysConfigService : IDynamicApiController, ITransient
}
/// <summary>
/// 获取参数配置查询器
/// 获取配置参数查询器
/// </summary>
/// <returns></returns>
[NonAction]

View File

@ -364,11 +364,9 @@ public class SysDatabaseService : IDynamicApiController, ITransient
if (pkInfo != null)
{
var seedDataTypes = App.EffectiveTypes
.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.GetInterfaces().Any(
i => i.HasImplementedRawGeneric(typeof(ISqlSugarEntitySeedData<>)) && i.GenericTypeArguments[0] == entityTypes[0]
)
)
.ToList();
.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.GetInterfaces()
.Any(i => i.HasImplementedRawGeneric(typeof(ISqlSugarEntitySeedData<>)) && i.GenericTypeArguments[0] == entityTypes[0])
).ToList();
// 可能会重名的种子数据不作为过滤项
string doNotFilterFullName1 = $"{input.Position}.SeedData.{input.SeedDataName}";
string doNotFilterFullName2 = $"{input.Position}.{input.SeedDataName}"; // Core中的命名空间没有SeedData

View File

@ -58,7 +58,6 @@ public class SysDictTypeService : IDynamicApiController, ITransient
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[UnitOfWork]
[DisplayName("获取字典类型-值列表")]
public async Task<List<SysDictData>> GetDataList([FromQuery] GetDataDictTypeInput input)
{

View File

@ -273,7 +273,10 @@ public class Startup : AppStartup
// 防止浏览器 MIME 类型嗅探,确保内容按照声明的类型处理
context.Response.Headers.Append("X-Content-Type-Options", "nosniff");
// 防止点击劫持,确保页面内容不被其他页面覆盖
context.Response.Headers.Append("X-Frame-Options", "DENY");
// DENY表示该页面不允许在 frame 中展示,即便是在相同域名的页面中嵌套也不允许
// SAMEORIGIN表示该页面可以在相同域名页面的 frame 中展示
// ALLOW-FROM uri表示该页面可以在指定来源的 frame 中展示
context.Response.Headers.Append("X-Frame-Options", "ALLOW-FROM " + App.GetConfig<string>("Urls", true));
// 启用 XSS 保护,防止跨站脚本注入
context.Response.Headers.Append("X-XSS-Protection", "1; mode=block");
// 控制在请求中发送的来源信息,减少潜在的隐私泄露

View File

@ -36,7 +36,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
return {
/**
*
* @summary 🔖
* @summary 🔖
* @param {AddConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -84,7 +84,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<number>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -132,7 +132,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<BatchConfigInput>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -180,7 +180,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary Code获取参数配置🔖
* @summary Code获取配置参数值 🔖
* @param {string} code
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -229,7 +229,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {DeleteConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -277,7 +277,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {number} id Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -372,7 +372,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -420,7 +420,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -516,7 +516,7 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {UpdateConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -573,7 +573,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
return {
/**
*
* @summary 🔖
* @summary 🔖
* @param {AddConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -587,7 +587,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<number>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -601,7 +601,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<BatchConfigInput>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -615,7 +615,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary Code获取参数配置🔖
* @summary Code获取配置参数值 🔖
* @param {string} code
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -629,7 +629,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {DeleteConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -643,7 +643,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {number} id Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -670,7 +670,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -684,7 +684,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -712,7 +712,7 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {UpdateConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -735,7 +735,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
return {
/**
*
* @summary 🔖
* @summary 🔖
* @param {AddConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -745,7 +745,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<number>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -755,7 +755,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<BatchConfigInput>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -765,7 +765,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary Code获取参数配置🔖
* @summary Code获取配置参数值 🔖
* @param {string} code
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -775,7 +775,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {DeleteConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -785,7 +785,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {number} id Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -804,7 +804,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -814,7 +814,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -834,7 +834,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
},
/**
*
* @summary 🔖
* @summary 🔖
* @param {UpdateConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -854,7 +854,7 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
export class SysConfigApi extends BaseAPI {
/**
*
* @summary 🔖
* @summary 🔖
* @param {AddConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -865,7 +865,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<number>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -876,7 +876,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {Array<BatchConfigInput>} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -887,7 +887,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary Code获取参数配置🔖
* @summary Code获取配置参数值 🔖
* @param {string} code
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -898,7 +898,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {DeleteConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -909,7 +909,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {number} id Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -930,7 +930,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -941,7 +941,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {PageConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -963,7 +963,7 @@ export class SysConfigApi extends BaseAPI {
}
/**
*
* @summary 🔖
* @summary 🔖
* @param {UpdateConfigInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}

View File

@ -102,7 +102,7 @@ export interface AddConfigInput {
code?: string | null;
/**
*
*
*
* @type {string}
* @memberof AddConfigInput

View File

@ -102,7 +102,7 @@ export interface ConfigOutput {
code?: string | null;
/**
*
*
*
* @type {string}
* @memberof ConfigOutput

View File

@ -14,7 +14,7 @@
import { YesNoEnum } from './yes-no-enum';
/**
*
*
*
* @export
* @interface SysConfig
@ -102,7 +102,7 @@ export interface SysConfig {
code?: string | null;
/**
*
*
*
* @type {string}
* @memberof SysConfig

View File

@ -102,7 +102,7 @@ export interface UpdateConfigInput {
code?: string | null;
/**
*
*
*
* @type {string}
* @memberof UpdateConfigInput

View File

@ -9,7 +9,7 @@
<el-card class="vh80" shadow="hover" header="" v-loading="state.loading">
<el-row :gutter="35">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb10">
<el-select v-model="state.swaggerUrl" placeholder="接口分组">
<el-select v-model="state.swaggerUrl" placeholder="接口分组" @change="queryTreeNode()">
<el-option v-for="(item, index) in state.apiGroupList" :key="index" :label="item.name" :value="item.url" />
</el-select>
</el-col>