mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-08-01 01:36:00 +08:00
1
This commit is contained in:
@ -1,10 +1,15 @@
|
||||
using NetAdmin.Domain.Attributes;
|
||||
using NetAdmin.Domain.DbMaps.Dependency;
|
||||
using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
namespace NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 代码模板表
|
||||
/// </summary>
|
||||
[Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_CodeTemplate))]
|
||||
public record Sys_CodeTemplate : VersionEntity, IFieldSort, IFieldSummary, IFieldEnabled, IFieldOwner
|
||||
public record Sys_CodeTemplate : VersionEntity, IFieldSummary, IFieldOwner, IFieldSort, IFieldEnabled
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
@ -15,34 +20,6 @@ public record Sys_CodeTemplate : VersionEntity, IFieldSort, IFieldSummary, IFiel
|
||||
[JsonIgnore]
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
/// <example>Male</example>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual Genders? Gender { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一编码
|
||||
/// </summary>
|
||||
/// <example>123456</example>
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
/// <example>老王</example>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 归属用户
|
||||
/// </summary>
|
||||
@ -86,4 +63,32 @@ public record Sys_CodeTemplate : VersionEntity, IFieldSort, IFieldSummary, IFiel
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Summary { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 代码模板编号
|
||||
/// </summary>
|
||||
/// <example>123456</example>
|
||||
[Column(IsIdentity = false, IsPrimary = true, Position = 1)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
[Snowflake]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
/// <example>老王</example>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
/// <example>Male</example>
|
||||
[Column]
|
||||
[CsvIgnore]
|
||||
[JsonIgnore]
|
||||
public virtual Genders? Gender { get; init; }
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
|
||||
/// <summary>
|
||||
@ -8,9 +11,13 @@ public record CreateCodeTemplateReq : Sys_CodeTemplate
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
public override bool Enabled { get; init; } = true;
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Gender" />
|
||||
/// <inheritdoc cref="IFieldSort.Sort" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override Genders? Gender { get; init; }
|
||||
public override long Sort { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldSummary.Summary" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Summary { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
@ -20,11 +27,8 @@ public record CreateCodeTemplateReq : Sys_CodeTemplate
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldSort.Sort" />
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Gender" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Sort { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldSummary.Summary" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Summary { get; init; }
|
||||
[EnumDataType(typeof(Genders))]
|
||||
public override Genders? Gender { get; init; }
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,3 +1,6 @@
|
||||
using NetAdmin.Domain.DbMaps.Dependency;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
|
||||
/// <summary>
|
||||
@ -5,7 +8,7 @@ namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
/// </summary>
|
||||
public sealed record QueryCodeTemplateReq : Sys_CodeTemplate
|
||||
{
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Id" />
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
using NetAdmin.Domain.DbMaps.Dependency;
|
||||
using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
@ -7,10 +10,18 @@ namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
/// </summary>
|
||||
public record QueryCodeTemplateRsp : Sys_CodeTemplate
|
||||
{
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedTime.CreatedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedTime.ModifiedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override DateTime? ModifiedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedUser.CreatedUserId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override long? CreatedUserId { get; init; }
|
||||
@ -19,22 +30,6 @@ public record QueryCodeTemplateRsp : Sys_CodeTemplate
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Gender" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override Genders? Gender { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedTime.ModifiedTime" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override DateTime? ModifiedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldModifiedUser.ModifiedUserId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override long? ModifiedUserId { get; init; }
|
||||
@ -43,10 +38,6 @@ public record QueryCodeTemplateRsp : Sys_CodeTemplate
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string ModifiedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Name" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Owner" />
|
||||
public new virtual QueryUserRsp Owner { get; init; }
|
||||
|
||||
@ -69,4 +60,16 @@ public record QueryCodeTemplateRsp : Sys_CodeTemplate
|
||||
/// <inheritdoc cref="IFieldVersion.Version" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Version { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Name" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Name { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Gender" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override Genders? Gender { get; init; }
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using NetAdmin.Domain.DbMaps.Dependency.Fields;
|
||||
|
||||
namespace NetAdmin.Domain.Dto.Sys.CodeTemplate;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:设置代码模板启用状态
|
||||
/// </summary>
|
||||
public sealed record SetCodeTemplateEnabledReq : Sys_CodeTemplate
|
||||
{
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_CodeTemplate.Id" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Id { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldVersion.Version" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Version { get; init; }
|
||||
}
|
@ -9,4 +9,10 @@ public interface ICodeTemplateModule : ICrudModule<CreateCodeTemplateReq, QueryC
|
||||
, EditCodeTemplateReq // 编辑类型
|
||||
, QueryCodeTemplateReq, QueryCodeTemplateRsp // 查询类型
|
||||
, DelReq // 删除类型
|
||||
>;
|
||||
>
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置代码模板启用状态
|
||||
/// </summary>
|
||||
Task<int> SetEnabledAsync(SetCodeTemplateEnabledReq req);
|
||||
}
|
@ -113,6 +113,13 @@ public sealed class CodeTemplateService(BasicRepository<Sys_CodeTemplate, long>
|
||||
return ret.Adapt<IEnumerable<QueryCodeTemplateRsp>>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<int> SetEnabledAsync(SetCodeTemplateEnabledReq req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
return UpdateAsync(req, [nameof(req.Enabled)]);
|
||||
}
|
||||
|
||||
private ISelect<Sys_CodeTemplate> QueryInternal(QueryReq<QueryCodeTemplateReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
|
@ -65,4 +65,10 @@ public sealed class CodeTemplateCache(IDistributedCache cache, ICodeTemplateServ
|
||||
{
|
||||
return Service.QueryAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<int> SetEnabledAsync(SetCodeTemplateEnabledReq req)
|
||||
{
|
||||
return Service.SetEnabledAsync(req);
|
||||
}
|
||||
}
|
@ -95,4 +95,12 @@ public sealed class CodeTemplateController(ICodeTemplateCache cache)
|
||||
{
|
||||
return Cache.QueryAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置代码模板启用状态
|
||||
/// </summary>
|
||||
public Task<int> SetEnabledAsync(SetCodeTemplateEnabledReq req)
|
||||
{
|
||||
return Cache.SetEnabledAsync(req);
|
||||
}
|
||||
}
|
@ -92,4 +92,15 @@ export default {
|
||||
return await http.post(this.url, data, config)
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置代码模板启用状态
|
||||
*/
|
||||
setEnabled: {
|
||||
url: `${config.API_URL}/api/sys/code.template/set.enabled`,
|
||||
name: `设置代码模板启用状态`,
|
||||
post: async function (data = {}, config = {}) {
|
||||
return await http.post(this.url, data, config)
|
||||
},
|
||||
},
|
||||
}
|
@ -7,29 +7,33 @@
|
||||
extra: [`createdTime`],
|
||||
width: 170,
|
||||
show: [`list`, `view`],
|
||||
searchable: `eq`,
|
||||
searchable: true,
|
||||
},
|
||||
name: {
|
||||
label: $t(`名字`),
|
||||
width: 150,
|
||||
show: [`list`, `view`, `add`, `edit`],
|
||||
label: $t(`名称`),
|
||||
rule: {
|
||||
required: true,
|
||||
},
|
||||
searchable: `eq`,
|
||||
show: [`list`, `view`, `add`, `edit`],
|
||||
searchable: true,
|
||||
operator: `contains`,
|
||||
},
|
||||
gender: {
|
||||
label: $t(`性别`),
|
||||
is: `na-col-indicator`,
|
||||
enum: `genders`,
|
||||
width: 100,
|
||||
width: 200,
|
||||
align: `center`,
|
||||
rule: {
|
||||
required: true,
|
||||
},
|
||||
countBy: true,
|
||||
show: [`list`, `view`, `add`, `edit`],
|
||||
},
|
||||
sort: {
|
||||
label: $t(`排序`),
|
||||
align: `right`,
|
||||
thousands: true,
|
||||
width: 100,
|
||||
show: [`list`, `view`, `add`, `edit`],
|
||||
rule: {
|
||||
@ -43,7 +47,8 @@
|
||||
summary: {
|
||||
label: $t(`备注`),
|
||||
show: [`list`, `view`, `add`, `edit`],
|
||||
searchable: `contains`,
|
||||
searchable: true,
|
||||
operator: `contains`,
|
||||
},
|
||||
enabled: {
|
||||
label: $t(`启用`),
|
||||
@ -62,33 +67,31 @@
|
||||
show: [`view`],
|
||||
},
|
||||
}"
|
||||
:operations="[`add`, `del`, `edit`]"
|
||||
:search-controls="[
|
||||
{
|
||||
type: `input`,
|
||||
field: [`root`, `keywords`],
|
||||
placeholder: $t(`消息编号 / 消息主题 / 消息内容`),
|
||||
style: `width:25rem`,
|
||||
},
|
||||
]"
|
||||
:select-filters="[
|
||||
{
|
||||
title: $t(`是否启用`),
|
||||
key: `Enabled`,
|
||||
enumName: `Enabled`,
|
||||
isBoolean: [
|
||||
{ label: $t(`启用`), value: true },
|
||||
{ label: $t(`禁用`), value: false },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: $t(`性别`),
|
||||
key: `Gender`,
|
||||
enumName: `genders`,
|
||||
},
|
||||
]"
|
||||
:summary="$t(`代码模板`)"
|
||||
:operations="operations"
|
||||
:summary="$t(`页面模板`)"
|
||||
entity-name="sys_codetemplate" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
created() {
|
||||
if (this.$GLOBAL.hasApiPermission(`api/sys/code.template/get`)) {
|
||||
this.operations.push(`view`)
|
||||
}
|
||||
if (this.$GLOBAL.hasApiPermission(`api/sys/code.template/edit`)) {
|
||||
this.operations.push(`edit`)
|
||||
}
|
||||
if (this.$GLOBAL.hasApiPermission(`api/sys/code.template/create`)) {
|
||||
this.operations.push(`add`)
|
||||
}
|
||||
if (this.$GLOBAL.hasApiPermission(`api/sys/code.template/delete`)) {
|
||||
this.operations.push(`del`)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
operations: [],
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped />
|
Reference in New Issue
Block a user