Browse Source

结果状态

bjmzak
wxd 2 years ago
parent
commit
c842e3b018
  1. 7
      src/Shentun.Peis.Application.Contracts/ResultStatuses/UpdateResultStatusDto.cs
  2. 2
      src/Shentun.Peis.Application/ResultStatuses/ResultStatusAppService.cs
  3. 29
      src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs
  4. 13429
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240314102501_init20240314002.Designer.cs
  5. 49
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240314102501_init20240314002.cs
  6. 22
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

7
src/Shentun.Peis.Application.Contracts/ResultStatuses/UpdateResultStatusDto.cs

@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.ResultStatuses
{
public class UpdateResultStatusDto
{
///// <summary>
///// 名称
///// </summary>
//public string DisplayName { get; set; } = null!;
/// <summary>
/// 数据录入提示
@ -41,6 +38,6 @@ namespace Shentun.Peis.ResultStatuses
/// </summary>
public int DataInputFontColor { get; set; }
}
}

2
src/Shentun.Peis.Application/ResultStatuses/ResultStatusAppService.cs

@ -61,7 +61,7 @@ namespace Shentun.Peis.ResultStatuses
{
var entity = await _repository.GetAsync(o => o.Id == Id);
var sourceEntity = ObjectMapper.Map<UpdateResultStatusDto, ResultStatus>(input);
await _manager.UpdateAsync(sourceEntity, entity);
_manager.UpdateAsync(sourceEntity, entity);
entity = await _repository.UpdateAsync(entity);
return ObjectMapper.Map<ResultStatus, ResultStatusDto>(entity);
}

29
src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs

@ -30,20 +30,13 @@ namespace Shentun.Peis.ResultStatuses
/// <param name="sourceEntity"></param>
/// <param name="targetEntity"></param>
/// <returns></returns>
public async Task UpdateAsync(
public void UpdateAsync(
ResultStatus sourceEntity,
ResultStatus targetEntity
)
{
Check.NotNullOrWhiteSpace(sourceEntity.DisplayName, nameof(sourceEntity.DisplayName));
if (sourceEntity.DisplayName != targetEntity.DisplayName)
{
await EntityHelper.CheckSameNameStringId<ResultStatus>(_repository, sourceEntity.DisplayName, targetEntity);
targetEntity.DisplayName = sourceEntity.DisplayName;
}
Verify(sourceEntity);
Verify(sourceEntity, targetEntity);
targetEntity.DataInputBackgroundColor = sourceEntity.DataInputBackgroundColor;
targetEntity.DataInputFontColor = sourceEntity.DataInputFontColor;
@ -55,24 +48,26 @@ namespace Shentun.Peis.ResultStatuses
}
public void Verify(ResultStatus entity)
public void Verify(ResultStatus sourceEntity, ResultStatus targetEntity)
{
if (!DataHelper.IsColorNumber(entity.DataInputBackgroundColor))
if (!string.IsNullOrEmpty(sourceEntity.DisplayName) && sourceEntity.DisplayName != targetEntity.DisplayName)
throw new UserFriendlyException($"名称不能修改");
if (!DataHelper.IsColorNumber(sourceEntity.DataInputBackgroundColor))
throw new UserFriendlyException($"数据录入报告单颜色代码格式不正确");
if (!DataHelper.IsColorNumber(entity.DataInputFontColor))
if (!DataHelper.IsColorNumber(sourceEntity.DataInputFontColor))
throw new UserFriendlyException($"数据录入字体颜色代码格式不正确");
if (!DataHelper.IsColorNumber(entity.ReportBackgroundColor))
if (!DataHelper.IsColorNumber(sourceEntity.ReportBackgroundColor))
throw new UserFriendlyException($"报告单背景颜色代码格式不正确");
if (!DataHelper.IsColorNumber(entity.ReportFontColor))
if (!DataHelper.IsColorNumber(sourceEntity.ReportFontColor))
throw new UserFriendlyException($"报告单字体颜色代码格式不正确");
}
/// <summary>
@ -99,6 +94,6 @@ namespace Shentun.Peis.ResultStatuses
}
}
}

13429
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240314102501_init20240314002.Designer.cs
File diff suppressed because it is too large
View File

49
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240314102501_init20240314002.cs

@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240314002 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "card_flag",
table: "card_register",
newName: "is_active");
migrationBuilder.AlterColumn<string>(
name: "display_name",
table: "result_status",
type: "character varying(20)",
maxLength: 20,
nullable: false,
defaultValue: "",
comment: "名称",
oldClrType: typeof(string),
oldType: "character varying(20)",
oldMaxLength: 20,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "is_active",
table: "card_register",
newName: "card_flag");
migrationBuilder.AlterColumn<string>(
name: "display_name",
table: "result_status",
type: "character varying(20)",
maxLength: 20,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(20)",
oldMaxLength: 20,
oldComment: "名称");
}
}
}

22
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -1189,14 +1189,6 @@ namespace Shentun.Peis.Migrations
.HasColumnType("numeric(10,2)")
.HasColumnName("card_balance");
b.Property<char>("CardFlag")
.ValueGeneratedOnAdd()
.HasMaxLength(1)
.HasColumnType("character(1)")
.HasColumnName("card_flag")
.HasDefaultValueSql("0")
.HasComment("使用标志");
b.Property<string>("CardNo")
.IsRequired()
.HasMaxLength(30)
@ -1256,6 +1248,14 @@ namespace Shentun.Peis.Migrations
.HasColumnName("id_no")
.HasComment("身份证号");
b.Property<char>("IsActive")
.ValueGeneratedOnAdd()
.HasMaxLength(1)
.HasColumnType("character(1)")
.HasColumnName("is_active")
.HasDefaultValueSql("0")
.HasComment("使用标志");
b.Property<DateTime?>("LastModificationTime")
.IsRequired()
.HasColumnType("timestamp without time zone")
@ -1293,7 +1293,7 @@ namespace Shentun.Peis.Migrations
b.HasIndex("CardTypeId");
b.HasIndex(new[] { "CardNo", "CardFlag" }, "ix_card_register")
b.HasIndex(new[] { "CardNo", "IsActive" }, "ix_card_register")
.IsUnique();
b.ToTable("card_register");
@ -8032,9 +8032,11 @@ namespace Shentun.Peis.Migrations
.HasComment("数据录入提示");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasColumnName("display_name");
.HasColumnName("display_name")
.HasComment("名称");
b.Property<int>("DisplayOrder")
.ValueGeneratedOnAdd()

Loading…
Cancel
Save