diff --git a/CloudBuilder/CloudBuilder.Master.Service/CloudBuilder.Master.Service.csproj b/CloudBuilder/CloudBuilder.Master.Service/CloudBuilder.Master.Service.csproj index f8a446e..078dc6c 100644 --- a/CloudBuilder/CloudBuilder.Master.Service/CloudBuilder.Master.Service.csproj +++ b/CloudBuilder/CloudBuilder.Master.Service/CloudBuilder.Master.Service.csproj @@ -38,6 +38,9 @@ ..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll + + ..\CloudBuilder.Master\bin\Debug\net8.0\CloudBuilder.Master.dll + ..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll diff --git a/CloudBuilder/CloudBuilder.Master.Service/FamilyPersonService.auto.cs b/CloudBuilder/CloudBuilder.Master.Service/FamilyPersonService.auto.cs new file mode 100644 index 0000000..8c9702b --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master.Service/FamilyPersonService.auto.cs @@ -0,0 +1,163 @@ + +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Data; +using CloudBuilder.Master.Entity; +using CloudBuilder.Master.Policy; +using CloudBuilder.Master.SearchCriteria; +using CloudBuilder.Security.Data; +using CloudBuilder.Security.Entity; +using CloudBuilder.Security.Policy; +using CloudBuilder.Security.Service; +using CloudBuilder.Security.Utility; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.DependencyInjection; +namespace CloudBuilder.Master.Service +{ + public class FamilyPersonService : IFamilyPersonService + { + private readonly IApplicationService service; + + private IRepository repository; + public FamilyPersonService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Find)] + public FamilyPersonEntity[] FindAll() + { + return repository.DetachedEntities.ToArray(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Find)] + public FamilyPersonData FindByKey(string key) + { + FamilyPersonData data = new FamilyPersonData(); + if (string.IsNullOrEmpty(key)) return data; + + FamilyPersonEntity fp = repository.DetachedEntities.Where(x => x.PersonId == key).FirstOrDefault(); + + if (fp == null) return data; + + data.FamilyPerson = new FamilyPersonDisplayData(fp); + + return data; + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Find)] + public FamilyPersonResultData FindBySearchCriteria(FamilyPersonSearchCriteria criteria) + { + FamilyPersonResultData data = new FamilyPersonResultData(); + FamilyPersonEntity[] list = null; + + int count = 0; + + string sqlWhere = null; + + if (criteria.Filter != null && criteria.Filter.Length > 0) + { + sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter); + } + + FamilyPersonEntity entity = FamilyPersonEntity.GetInstance(repository.GetDbContext().Database.ProviderName); + string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere); + + string err = null; + try + { + list = repository.FromSql(sql).ToArray(); + } + catch (System.Exception ex) + { + err = ex.Message; + } + + + if (list != null && list.Length > 0) + { + sql = entity.GetSelectCountFrom(sqlWhere); + count = Convert.ToInt32(repository.ExecuteScalar(sql)); + } + + data.Limit = criteria.limit; + data.Page = criteria.page; + data.Datas = list; + data.Total = count; + //data.Sql = sql; + data.ErrorMessage = err; + return data; + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Insert)] + [UnitOfWork] + public FamilyPersonData Insert(FamilyPersonData data) + { + FamilyPersonEntity d = repository.DetachedEntities.Where(x => x.PersonId == data.FamilyPerson.PersonId).FirstOrDefault(); + if (d != null) + { + throw new ValidatedException("记录已存在."); + } + + ValidateHelper.Validate(service, data.FamilyPerson, FamilyPersonEntity.DB_NAME_FAMILY_PERSON); + + d = new FamilyPersonEntity(); + ObjectCopyHelper.Copy(data.FamilyPerson, d); + + ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService()!; + + d.PersonId = securityGeneratorNumberService.GetNo(MasterPrefixPolicy.FAMILY_PERSON, MasterPrefixPolicy.FAMILY_PERSON_PERSON_ID, MasterPrefixPolicy.FAMILY_PERSON_PREFIX, YesNoPolicy.NO, MasterPrefixPolicy.FAMILY_PERSON_FORMAT); + + repository.InsertNow(d); + + + return FindByKey(d.PersonId); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Update)] + [UnitOfWork] + public FamilyPersonData Update(FamilyPersonData data) + { + FamilyPersonEntity d = repository.DetachedEntities.Where(x => x.PersonId == data.FamilyPerson.PersonId).FirstOrDefault(); + if (d == null) + { + throw new ValidatedException("记录不存在."); + } + + ValidateHelper.Validate(service, data.FamilyPerson, FamilyPersonEntity.DB_NAME_FAMILY_PERSON); + + ObjectCopyHelper.Copy(data.FamilyPerson, d); + + repository.UpdateNow(d); + + return FindByKey(data.FamilyPerson.PersonId); + } + + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent = repository.DetachedEntities.Where(x => x.PersonId == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyPerson, operate: Operate.Delete)] + [UnitOfWork] + public void Deletes(string[] keys) + { + foreach (string key in keys) + { + Delete(key); + } + } + } +} diff --git a/CloudBuilder/CloudBuilder.Master.Service/FamilyTreeService.auto.cs b/CloudBuilder/CloudBuilder.Master.Service/FamilyTreeService.auto.cs new file mode 100644 index 0000000..b4ba0d7 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master.Service/FamilyTreeService.auto.cs @@ -0,0 +1,113 @@ + +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Data; +using CloudBuilder.Master.Entity; +using CloudBuilder.Master.Policy; +using CloudBuilder.Master.SearchCriteria; +using Microsoft.AspNetCore.Authorization; +namespace CloudBuilder.Master.Service +{ + public class FamilyTreeService : IFamilyTreeService + { + private readonly IApplicationService service; + + private IRepository repository; + public FamilyTreeService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Find)] + public FamilyTreeData FindByKey(string key) + { + FamilyTreeData data = new FamilyTreeData(); + return data;// repository.DetachedEntities.Where(x => x.TreeId == key).FirstOrDefault()!; + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Find)] + public FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria criteria) + { + FamilyTreeResultData data = new FamilyTreeResultData(); + FamilyTreeEntity[] list = null; + + int count = 0; + + string sqlWhere = null; + + if (criteria.Filter != null && criteria.Filter.Length > 0) + { + sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter); + } + + FamilyTreeEntity entity = FamilyTreeEntity.GetInstance(repository.GetDbContext().Database.ProviderName); + string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere); + + string err = null; + try + { + list = repository.FromSql(sql).ToArray(); + } + catch (System.Exception ex) + { + err = ex.Message; + } + + + if (list != null && list.Length > 0) + { + sql = entity.GetSelectCountFrom(sqlWhere); + count = Convert.ToInt32(repository.ExecuteScalar(sql)); + } + + data.Limit = criteria.limit; + data.Page = criteria.page; + data.Datas = list; + data.Total = count; + //data.Sql = sql; + data.ErrorMessage = err; + return data; + } + + //[PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(FamilyTreeSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Insert)] + [UnitOfWork] + public FamilyTreeData Insert(FamilyTreeData data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Update)] + [UnitOfWork] + public FamilyTreeData Update(FamilyTreeData data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent= repository.DetachedEntities.Where(x => x.TreeId == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + + [PermissionOperate(name: MasterPermissionPolicy.FamilyTree, operate: Operate.Delete)] + [UnitOfWork] + public void Deletes(string[] keys) + { + foreach (string key in keys) + { + Delete(key); + } + } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/CloudBuilder.Master.csproj b/CloudBuilder/CloudBuilder.Master/CloudBuilder.Master.csproj index fb54993..3780109 100644 --- a/CloudBuilder/CloudBuilder.Master/CloudBuilder.Master.csproj +++ b/CloudBuilder/CloudBuilder.Master/CloudBuilder.Master.csproj @@ -28,10 +28,8 @@ - - diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonData.cs new file mode 100644 index 0000000..901a3ee --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonData.cs @@ -0,0 +1,15 @@ +using CloudBuilder.Core.Authorization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + [TypeScript] + public class FamilyPersonData + { + public FamilyPersonDisplayData? FamilyPerson { get; set; } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonDisplayData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonDisplayData.cs new file mode 100644 index 0000000..f2ec103 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonDisplayData.cs @@ -0,0 +1,27 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Master.Entity; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + /// + /// 排除实体类标记 + /// + [NotMapped] + [TypeScript] + public class FamilyPersonDisplayData : FamilyPersonEntity + { + public FamilyPersonDisplayData() + { + } + public FamilyPersonDisplayData(FamilyPersonEntity entity) + { + CopyFrom(entity); + } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonResultData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonResultData.cs new file mode 100644 index 0000000..c329e6f --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyPersonResultData.cs @@ -0,0 +1,17 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + [TypeScript] + public class FamilyPersonResultData : SearchCriteriaResultData + { + public FamilyPersonEntity[]? Datas { get; set; } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeData.cs new file mode 100644 index 0000000..5792854 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeData.cs @@ -0,0 +1,16 @@ +using CloudBuilder.Core.Authorization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + + [TypeScript] + public class FamilyTreeData + { + public FamilyTreeDisplayData? FamilyTree { get; set; } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeDisplayData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeDisplayData.cs new file mode 100644 index 0000000..a233786 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeDisplayData.cs @@ -0,0 +1,27 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Master.Entity; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + /// + /// 排除实体类标记 + /// + [NotMapped] + [TypeScript] + public class FamilyTreeDisplayData : FamilyPersonEntity + { + public FamilyTreeDisplayData() + { + } + public FamilyTreeDisplayData(FamilyPersonEntity entity) + { + CopyFrom(entity); + } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeResultData.cs b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeResultData.cs new file mode 100644 index 0000000..43e1639 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Data/FamilyTreeResultData.cs @@ -0,0 +1,17 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Data +{ + [TypeScript] + public class FamilyTreeResultData : SearchCriteriaResultData + { + public FamilyTreeEntity[]? Datas { get; set; } + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/CloudBuilderMasterRegistEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/CloudBuilderMasterRegistEntity.auto.cs new file mode 100644 index 0000000..fcbca47 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/CloudBuilderMasterRegistEntity.auto.cs @@ -0,0 +1,48 @@ + +using CloudBuilder.Core.DependencyInjection.EFCore; +using Microsoft.EntityFrameworkCore; +using System.Reflection; + +namespace CloudBuilder.Master.Entity +{ + public class CloudBuilderMasterRegistEntity : IMasterRegistEntityType + { + /// + ///注入模块内的所有实体类 + /// + /// + public void RegistEntity(ModelBuilder builder) + { + string _assemblyName = Assembly.GetExecutingAssembly().GetName().Name; + //注入所有Entity实体类 + AddEntityType(builder, _assemblyName); + //如果Entity实体类不是单一主键,要单独重写注入 + RegistKeys(builder); + } + + public void AddEntityType(ModelBuilder builder, string _assemblyName) + { + RegistEntityHelper.AddMasterEntityType(builder, _assemblyName); + } + + /// + ///如果存在多个主键的,要在RegistKeys方法注入 + ///builder.Entity().HasKey(c => new { c.TableName, c.FieldName }); + ///builder.Entity(eb => { eb.HasNoKey(); }); + /// + /// + public void RegistKeys(ModelBuilder builder) + { + //***BEGIN*** + +builder.Entity().HasKey(c => new {c.TreeId,c.PersonId,c.ChildrenId}); +builder.Entity().HasKey(c => new {c.TreeId,c.PersonId,c.SpouseId}); + + + + +//***END*** + } + } +} + diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonEntity.auto.cs new file mode 100644 index 0000000..06672b3 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonEntity.auto.cs @@ -0,0 +1,303 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.Master.Entity + { + [TypeScript] + [Table("family_person")] + public class FamilyPersonEntity : ViewEntityBase + { + + public FamilyPersonEntity() + { + } + + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Key] + [Column("person_id")] + public string PersonId { get; set; } + [Column("avatar_filename")] + public string? AvatarFilename { get; set; } + [Column("surname")] + public string Surname { get; set; } + [Column("genealogy_name")] + public string? GenealogyName { get; set; } + [Column("common_name")] + public string? CommonName { get; set; } + [Column("alias")] + public string? Alias { get; set; } + [Column("zi")] + public string? Zi { get; set; } + [Column("hao")] + public string? Hao { get; set; } + [Column("father_id")] + public string? FatherId { get; set; } + [Column("mother_name")] + public string? MotherName { get; set; } + [Column("birth_order")] + public string? BirthOrder { get; set; } + [Column("gender")] + public string? Gender { get; set; } + [Column("marital_status")] + public string? MaritalStatus { get; set; } + [Column("school")] + public string? School { get; set; } + [Column("major")] + public string? Major { get; set; } + [Column("education")] + public string? Education { get; set; } + [Column("graduation_status")] + public string? GraduationStatus { get; set; } + [Column("duty")] + public string? Duty { get; set; } + [Column("title")] + public string? Title { get; set; } + [Column("birth_text")] + public string? BirthText { get; set; } + [Column("birth_date")] + public Nullable BirthDate { get; set; } + [Column("death_text")] + public string? DeathText { get; set; } + [Column("death_date")] + public Nullable DeathDate { get; set; } + [Column("privacy")] + public string? Privacy { get; set; } + [Column("live_status")] + public string LiveStatus { get; set; } + [Column("introduction")] + public string? Introduction { get; set; } + [Column("is_bind_user")] + public string? IsBindUser { get; set; } + [Column("bind_user_id")] + public string? BindUserId { get; set; } + + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string PERSON_ID = "PersonId"; + public const string AVATAR_FILENAME = "AvatarFilename"; + public const string SURNAME = "Surname"; + public const string GENEALOGY_NAME = "GenealogyName"; + public const string COMMON_NAME = "CommonName"; + public const string ALIAS = "Alias"; + public const string ZI = "Zi"; + public const string HAO = "Hao"; + public const string FATHER_ID = "FatherId"; + public const string MOTHER_NAME = "MotherName"; + public const string BIRTH_ORDER = "BirthOrder"; + public const string GENDER = "Gender"; + public const string MARITAL_STATUS = "MaritalStatus"; + public const string SCHOOL = "School"; + public const string MAJOR = "Major"; + public const string EDUCATION = "Education"; + public const string GRADUATION_STATUS = "GraduationStatus"; + public const string DUTY = "Duty"; + public const string TITLE = "Title"; + public const string BIRTH_TEXT = "BirthText"; + public const string BIRTH_DATE = "BirthDate"; + public const string DEATH_TEXT = "DeathText"; + public const string DEATH_DATE = "DeathDate"; + public const string PRIVACY = "Privacy"; + public const string LIVE_STATUS = "LiveStatus"; + public const string INTRODUCTION = "Introduction"; + public const string IS_BIND_USER = "IsBindUser"; + public const string BIND_USER_ID = "BindUserId"; + + public const string DB_NAME_FAMILY_PERSON = "family_person"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,person_id,avatar_filename,surname,genealogy_name,common_name,alias,zi,hao,father_id,mother_name,birth_order,gender,marital_status,school,major,education,graduation_status,duty,title,birth_text,birth_date,death_text,death_date,privacy,live_status,introduction,is_bind_user,bind_user_id"; + + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_PERSON_ID = "person_id"; + public const string DB_AVATAR_FILENAME = "avatar_filename"; + public const string DB_SURNAME = "surname"; + public const string DB_GENEALOGY_NAME = "genealogy_name"; + public const string DB_COMMON_NAME = "common_name"; + public const string DB_ALIAS = "alias"; + public const string DB_ZI = "zi"; + public const string DB_HAO = "hao"; + public const string DB_FATHER_ID = "father_id"; + public const string DB_MOTHER_NAME = "mother_name"; + public const string DB_BIRTH_ORDER = "birth_order"; + public const string DB_GENDER = "gender"; + public const string DB_MARITAL_STATUS = "marital_status"; + public const string DB_SCHOOL = "school"; + public const string DB_MAJOR = "major"; + public const string DB_EDUCATION = "education"; + public const string DB_GRADUATION_STATUS = "graduation_status"; + public const string DB_DUTY = "duty"; + public const string DB_TITLE = "title"; + public const string DB_BIRTH_TEXT = "birth_text"; + public const string DB_BIRTH_DATE = "birth_date"; + public const string DB_DEATH_TEXT = "death_text"; + public const string DB_DEATH_DATE = "death_date"; + public const string DB_PRIVACY = "privacy"; + public const string DB_LIVE_STATUS = "live_status"; + public const string DB_INTRODUCTION = "introduction"; + public const string DB_IS_BIND_USER = "is_bind_user"; + public const string DB_BIND_USER_ID = "bind_user_id"; + + private string ProviderName { get; set; } + + public static FamilyPersonEntity GetInstance(string providerName) + { + return new FamilyPersonEntity() { ProviderName = providerName }; + } + + public virtual void CopyFrom(FamilyPersonEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(FamilyPersonEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.PersonId = source.PersonId; + this.AvatarFilename = source.AvatarFilename; + this.Surname = source.Surname; + this.GenealogyName = source.GenealogyName; + this.CommonName = source.CommonName; + this.Alias = source.Alias; + this.Zi = source.Zi; + this.Hao = source.Hao; + this.FatherId = source.FatherId; + this.MotherName = source.MotherName; + this.BirthOrder = source.BirthOrder; + this.Gender = source.Gender; + this.MaritalStatus = source.MaritalStatus; + this.School = source.School; + this.Major = source.Major; + this.Education = source.Education; + this.GraduationStatus = source.GraduationStatus; + this.Duty = source.Duty; + this.Title = source.Title; + this.BirthText = source.BirthText; + this.BirthDate = source.BirthDate; + this.DeathText = source.DeathText; + this.DeathDate = source.DeathDate; + this.Privacy = source.Privacy; + this.LiveStatus = source.LiveStatus; + this.Introduction = source.Introduction; + this.IsBindUser = source.IsBindUser; + this.BindUserId = source.BindUserId; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + if (ProviderName.Contains("MySql")) + { + return GetSelectFromByMySql(); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectFromByBySqlServer(); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + public string GetSelectFromByMySql() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_PERSON} with(nolock) "; + } + public string GetSelectFromByBySqlServer() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_PERSON} "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectCountFromByMySql(sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectCountFromBySqlServer(sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectCountFromByMySql(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_PERSON} where 1=1 {sqlWhere}"; + } + public string GetSelectCountFromBySqlServer(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_PERSON} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(int limit, int start, string orderby, string orderbytag, string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectTopFromByMySql(limit, start, orderby, orderbytag, sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectTopFromBySqlServer(limit, start, orderby, orderbytag, sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_PERSON_ID ; + int offset = limit * (start - 1); + return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_PERSON} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} "; + } + + public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_PERSON_ID ; + string top = limit > 0 ? $"top {limit}" : ""; + return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_PERSON} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public FamilyPersonEntity Clone() + { + FamilyPersonEntity result = new FamilyPersonEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonLogEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonLogEntity.auto.cs new file mode 100644 index 0000000..c9621a8 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyPersonLogEntity.auto.cs @@ -0,0 +1,194 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.Master.Entity + { + [TypeScript] + [Table("family_person_log")] + public class FamilyPersonLogEntity : ViewEntityBase + { + + public FamilyPersonLogEntity() + { + } + + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Column("log_id")] + public long LogId { get; set; } + [Column("person_id")] + public string PersonId { get; set; } + [Column("audit_code")] + public string AuditCode { get; set; } + [Column("event_actor")] + public string EventActor { get; set; } + [Column("old_value")] + public string? OldValue { get; set; } + [Column("new_value")] + public string? NewValue { get; set; } + + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string LOG_ID = "LogId"; + public const string PERSON_ID = "PersonId"; + public const string AUDIT_CODE = "AuditCode"; + public const string EVENT_ACTOR = "EventActor"; + public const string OLD_VALUE = "OldValue"; + public const string NEW_VALUE = "NewValue"; + + public const string DB_NAME_FAMILY_PERSON_LOG = "family_person_log"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,log_id,person_id,audit_code,event_actor,old_value,new_value"; + + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_LOG_ID = "log_id"; + public const string DB_PERSON_ID = "person_id"; + public const string DB_AUDIT_CODE = "audit_code"; + public const string DB_EVENT_ACTOR = "event_actor"; + public const string DB_OLD_VALUE = "old_value"; + public const string DB_NEW_VALUE = "new_value"; + + private string ProviderName { get; set; } + + public static FamilyPersonLogEntity GetInstance(string providerName) + { + return new FamilyPersonLogEntity() { ProviderName = providerName }; + } + + public virtual void CopyFrom(FamilyPersonLogEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(FamilyPersonLogEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.LogId = source.LogId; + this.PersonId = source.PersonId; + this.AuditCode = source.AuditCode; + this.EventActor = source.EventActor; + this.OldValue = source.OldValue; + this.NewValue = source.NewValue; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + if (ProviderName.Contains("MySql")) + { + return GetSelectFromByMySql(); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectFromByBySqlServer(); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + public string GetSelectFromByMySql() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_PERSON_LOG} with(nolock) "; + } + public string GetSelectFromByBySqlServer() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_PERSON_LOG} "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectCountFromByMySql(sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectCountFromBySqlServer(sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectCountFromByMySql(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_PERSON_LOG} where 1=1 {sqlWhere}"; + } + public string GetSelectCountFromBySqlServer(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_PERSON_LOG} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(int limit, int start, string orderby, string orderbytag, string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectTopFromByMySql(limit, start, orderby, orderbytag, sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectTopFromBySqlServer(limit, start, orderby, orderbytag, sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ; + int offset = limit * (start - 1); + return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_PERSON_LOG} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} "; + } + + public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_LOG_ID ; + string top = limit > 0 ? $"top {limit}" : ""; + return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_PERSON_LOG} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public FamilyPersonLogEntity Clone() + { + FamilyPersonLogEntity result = new FamilyPersonLogEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntity.auto.cs new file mode 100644 index 0000000..b33f50a --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntity.auto.cs @@ -0,0 +1,192 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.Master.Entity + { + [TypeScript] + [Table("family_tree_children_map")] + public class FamilyTreeChildrenMapEntity : EntityBase + { + + public FamilyTreeChildrenMapEntity() + { + } + + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Column("tree_id")] + public string TreeId { get; set; } + [Column("person_id")] + public string PersonId { get; set; } + [Column("spouse_id")] + public string SpouseId { get; set; } + [Column("children_id")] + public string ChildrenId { get; set; } + [Column("relation_type")] + public string? RelationType { get; set; } + [Column("remark")] + public string? Remark { get; set; } + + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string TREE_ID = "TreeId"; + public const string PERSON_ID = "PersonId"; + public const string SPOUSE_ID = "SpouseId"; + public const string CHILDREN_ID = "ChildrenId"; + public const string RELATION_TYPE = "RelationType"; + public const string REMARK = "Remark"; + + public const string DB_NAME_FAMILY_TREE_CHILDREN_MAP = "family_tree_children_map"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,tree_id,person_id,spouse_id,children_id,relation_type,remark"; + + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_TREE_ID = "tree_id"; + public const string DB_PERSON_ID = "person_id"; + public const string DB_SPOUSE_ID = "spouse_id"; + public const string DB_CHILDREN_ID = "children_id"; + public const string DB_RELATION_TYPE = "relation_type"; + public const string DB_REMARK = "remark"; + + private string ProviderName { get; set; } + + public static FamilyTreeChildrenMapEntity GetInstance(string providerName) + { + return new FamilyTreeChildrenMapEntity() { ProviderName = providerName }; + } + + public virtual void CopyFrom(FamilyTreeChildrenMapEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(FamilyTreeChildrenMapEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.TreeId = source.TreeId; + this.PersonId = source.PersonId; + this.SpouseId = source.SpouseId; + this.ChildrenId = source.ChildrenId; + this.RelationType = source.RelationType; + this.Remark = source.Remark; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + if (ProviderName.Contains("MySql")) + { + return GetSelectFromByMySql(); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectFromByBySqlServer(); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + public string GetSelectFromByMySql() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} with(nolock) "; + } + public string GetSelectFromByBySqlServer() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectCountFromByMySql(sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectCountFromBySqlServer(sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectCountFromByMySql(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} where 1=1 {sqlWhere}"; + } + public string GetSelectCountFromBySqlServer(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(int limit, int start, string orderby, string orderbytag, string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectTopFromByMySql(limit, start, orderby, orderbytag, sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectTopFromBySqlServer(limit, start, orderby, orderbytag, sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + int offset = limit * (start - 1); + return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} "; + } + + public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + string top = limit > 0 ? $"top {limit}" : ""; + return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_CHILDREN_MAP} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public FamilyTreeChildrenMapEntity Clone() + { + FamilyTreeChildrenMapEntity result = new FamilyTreeChildrenMapEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntityKey.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntityKey.auto.cs new file mode 100644 index 0000000..a6de04f --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeChildrenMapEntityKey.auto.cs @@ -0,0 +1,35 @@ + +using CloudBuilder.Core.Authorization; +namespace CloudBuilder.Master +{ + [TypeScript] + public class FamilyTreeChildrenMapEntityKey + { + public string TreeId { get; set; } + public string PersonId { get; set; } + public string ChildrenId { get; set; } + + public override bool Equals(object obj) + { + if (this == obj) return true; + + FamilyTreeChildrenMapEntityKey pkey = obj as FamilyTreeChildrenMapEntityKey; + if (pkey == null) return false; + + if (TreeId != pkey.TreeId) return false; + if (PersonId != pkey.PersonId) return false; + if (ChildrenId != pkey.ChildrenId) return false; + + return true; + } + + + public override string ToString() + { + string declareSql=""; + declareSql=declareSql+$"declare @__tkey_TreeId_0 varchar(50) select @__tkey_TreeId_0 ='{TreeId}'; " ; declareSql=declareSql+$"declare @__tkey_PersonId_1 varchar(50) select @__tkey_PersonId_1 ='{PersonId}'; " ; declareSql=declareSql+$"declare @__tkey_ChildrenId_2 varchar(50) select @__tkey_ChildrenId_2 ='{ChildrenId}'; " ; + return declareSql; + } + } + } + /* builder.Entity().HasKey(c => new { c.TreeId, c.PersonId, c.ChildrenId}); */ diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeEntity.auto.cs new file mode 100644 index 0000000..33aec8f --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeEntity.auto.cs @@ -0,0 +1,193 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.Master.Entity + { + [TypeScript] + [Table("family_tree")] + public class FamilyTreeEntity : ViewEntityBase + { + + public FamilyTreeEntity() + { + } + + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Key] + [Column("tree_id")] + public string TreeId { get; set; } + [Column("tree_name")] + public string TreeName { get; set; } + [Column("brief")] + public string? Brief { get; set; } + [Column("ancestor_person_id")] + public string AncestorPersonId { get; set; } + [Column("tree_cover_filename")] + public string TreeCoverFilename { get; set; } + [Column("public_indc")] + public string PublicIndc { get; set; } + + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string TREE_ID = "TreeId"; + public const string TREE_NAME = "TreeName"; + public const string BRIEF = "Brief"; + public const string ANCESTOR_PERSON_ID = "AncestorPersonId"; + public const string TREE_COVER_FILENAME = "TreeCoverFilename"; + public const string PUBLIC_INDC = "PublicIndc"; + + public const string DB_NAME_FAMILY_TREE = "family_tree"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,tree_id,tree_name,brief,ancestor_person_id,tree_cover_filename,public_indc"; + + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_TREE_ID = "tree_id"; + public const string DB_TREE_NAME = "tree_name"; + public const string DB_BRIEF = "brief"; + public const string DB_ANCESTOR_PERSON_ID = "ancestor_person_id"; + public const string DB_TREE_COVER_FILENAME = "tree_cover_filename"; + public const string DB_PUBLIC_INDC = "public_indc"; + + private string ProviderName { get; set; } + + public static FamilyTreeEntity GetInstance(string providerName) + { + return new FamilyTreeEntity() { ProviderName = providerName }; + } + + public virtual void CopyFrom(FamilyTreeEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(FamilyTreeEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.TreeId = source.TreeId; + this.TreeName = source.TreeName; + this.Brief = source.Brief; + this.AncestorPersonId = source.AncestorPersonId; + this.TreeCoverFilename = source.TreeCoverFilename; + this.PublicIndc = source.PublicIndc; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + if (ProviderName.Contains("MySql")) + { + return GetSelectFromByMySql(); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectFromByBySqlServer(); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + public string GetSelectFromByMySql() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE} with(nolock) "; + } + public string GetSelectFromByBySqlServer() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE} "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectCountFromByMySql(sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectCountFromBySqlServer(sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectCountFromByMySql(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE} where 1=1 {sqlWhere}"; + } + public string GetSelectCountFromBySqlServer(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(int limit, int start, string orderby, string orderbytag, string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectTopFromByMySql(limit, start, orderby, orderbytag, sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectTopFromBySqlServer(limit, start, orderby, orderbytag, sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + int offset = limit * (start - 1); + return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} "; + } + + public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + string top = limit > 0 ? $"top {limit}" : ""; + return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public FamilyTreeEntity Clone() + { + FamilyTreeEntity result = new FamilyTreeEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntity.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntity.auto.cs new file mode 100644 index 0000000..878d0ab --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntity.auto.cs @@ -0,0 +1,212 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.Master.Entity + { + [TypeScript] + [Table("family_tree_spouse_map")] + public class FamilyTreeSpouseMapEntity : EntityBase + { + + public FamilyTreeSpouseMapEntity() + { + } + + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Column("tree_id")] + public string TreeId { get; set; } + [Column("person_id")] + public string PersonId { get; set; } + [Column("spouse_id")] + public string SpouseId { get; set; } + [Column("marry_date_text")] + public string? MarryDateText { get; set; } + [Column("marry_date")] + public Nullable MarryDate { get; set; } + [Column("divorce_date_text")] + public string? DivorceDateText { get; set; } + [Column("divorce_date")] + public Nullable DivorceDate { get; set; } + [Column("marry_type")] + public string? MarryType { get; set; } + [Column("is_current")] + public string? IsCurrent { get; set; } + [Column("remark")] + public string? Remark { get; set; } + + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string TREE_ID = "TreeId"; + public const string PERSON_ID = "PersonId"; + public const string SPOUSE_ID = "SpouseId"; + public const string MARRY_DATE_TEXT = "MarryDateText"; + public const string MARRY_DATE = "MarryDate"; + public const string DIVORCE_DATE_TEXT = "DivorceDateText"; + public const string DIVORCE_DATE = "DivorceDate"; + public const string MARRY_TYPE = "MarryType"; + public const string IS_CURRENT = "IsCurrent"; + public const string REMARK = "Remark"; + + public const string DB_NAME_FAMILY_TREE_SPOUSE_MAP = "family_tree_spouse_map"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,tree_id,person_id,spouse_id,marry_date_text,marry_date,divorce_date_text,divorce_date,marry_type,is_current,remark"; + + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_TREE_ID = "tree_id"; + public const string DB_PERSON_ID = "person_id"; + public const string DB_SPOUSE_ID = "spouse_id"; + public const string DB_MARRY_DATE_TEXT = "marry_date_text"; + public const string DB_MARRY_DATE = "marry_date"; + public const string DB_DIVORCE_DATE_TEXT = "divorce_date_text"; + public const string DB_DIVORCE_DATE = "divorce_date"; + public const string DB_MARRY_TYPE = "marry_type"; + public const string DB_IS_CURRENT = "is_current"; + public const string DB_REMARK = "remark"; + + private string ProviderName { get; set; } + + public static FamilyTreeSpouseMapEntity GetInstance(string providerName) + { + return new FamilyTreeSpouseMapEntity() { ProviderName = providerName }; + } + + public virtual void CopyFrom(FamilyTreeSpouseMapEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(FamilyTreeSpouseMapEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.TreeId = source.TreeId; + this.PersonId = source.PersonId; + this.SpouseId = source.SpouseId; + this.MarryDateText = source.MarryDateText; + this.MarryDate = source.MarryDate; + this.DivorceDateText = source.DivorceDateText; + this.DivorceDate = source.DivorceDate; + this.MarryType = source.MarryType; + this.IsCurrent = source.IsCurrent; + this.Remark = source.Remark; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + if (ProviderName.Contains("MySql")) + { + return GetSelectFromByMySql(); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectFromByBySqlServer(); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + public string GetSelectFromByMySql() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} with(nolock) "; + } + public string GetSelectFromByBySqlServer() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectCountFromByMySql(sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectCountFromBySqlServer(sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectCountFromByMySql(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} where 1=1 {sqlWhere}"; + } + public string GetSelectCountFromBySqlServer(string sqlWhere) + { + return $" select count(*) from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(int limit, int start, string orderby, string orderbytag, string sqlWhere) + { + if (ProviderName.Contains("MySql")) + { + return GetSelectTopFromByMySql(limit, start, orderby, orderbytag, sqlWhere); + } + else if (ProviderName.Contains("SqlServer")) + { + return GetSelectTopFromBySqlServer(limit, start, orderby, orderbytag, sqlWhere); + } + else + { + throw new NotSupportedException($"不支持的数据库提供程序:{ProviderName}"); + } + } + + public string GetSelectTopFromByMySql(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + int offset = limit * (start - 1); + return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {limit} "; + } + + public string GetSelectTopFromBySqlServer(int limit, int start,string orderby,string orderbytag, string sqlWhere) + { + if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc"; + if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_TREE_ID ; + string top = limit > 0 ? $"top {limit}" : ""; + return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_FAMILY_TREE_SPOUSE_MAP} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public FamilyTreeSpouseMapEntity Clone() + { + FamilyTreeSpouseMapEntity result = new FamilyTreeSpouseMapEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntityKey.auto.cs b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntityKey.auto.cs new file mode 100644 index 0000000..eb76a80 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Entity/FamilyTreeSpouseMapEntityKey.auto.cs @@ -0,0 +1,35 @@ + +using CloudBuilder.Core.Authorization; +namespace CloudBuilder.Master +{ + [TypeScript] + public class FamilyTreeSpouseMapEntityKey + { + public string TreeId { get; set; } + public string PersonId { get; set; } + public string SpouseId { get; set; } + + public override bool Equals(object obj) + { + if (this == obj) return true; + + FamilyTreeSpouseMapEntityKey pkey = obj as FamilyTreeSpouseMapEntityKey; + if (pkey == null) return false; + + if (TreeId != pkey.TreeId) return false; + if (PersonId != pkey.PersonId) return false; + if (SpouseId != pkey.SpouseId) return false; + + return true; + } + + + public override string ToString() + { + string declareSql=""; + declareSql=declareSql+$"declare @__tkey_TreeId_0 varchar(50) select @__tkey_TreeId_0 ='{TreeId}'; " ; declareSql=declareSql+$"declare @__tkey_PersonId_1 varchar(50) select @__tkey_PersonId_1 ='{PersonId}'; " ; declareSql=declareSql+$"declare @__tkey_SpouseId_2 varchar(50) select @__tkey_SpouseId_2 ='{SpouseId}'; " ; + return declareSql; + } + } + } + /* builder.Entity().HasKey(c => new { c.TreeId, c.PersonId, c.SpouseId}); */ diff --git a/CloudBuilder/CloudBuilder.Master/Policy/MasterPermissionPolicy.auto.cs b/CloudBuilder/CloudBuilder.Master/Policy/MasterPermissionPolicy.auto.cs new file mode 100644 index 0000000..b503e00 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Policy/MasterPermissionPolicy.auto.cs @@ -0,0 +1,12 @@ + +namespace CloudBuilder.Master.Policy +{ + public partial class MasterPermissionPolicy + { + //***BEGIN*** + public const string FamilyTree = "FamilyTree"; + +public const string FamilyPerson = "FamilyPerson"; + //***END*** + } +} \ No newline at end of file diff --git a/CloudBuilder/CloudBuilder.Master/Policy/MasterPrefixPolicy.cs b/CloudBuilder/CloudBuilder.Master/Policy/MasterPrefixPolicy.cs new file mode 100644 index 0000000..04bcea3 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Policy/MasterPrefixPolicy.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.Master.Policy +{ + public class MasterPrefixPolicy + { + public const string FAMILY_PERSON = "FAMILY_PERSON"; + public const string FAMILY_PERSON_PERSON_ID = "PERSON_ID"; + public const string FAMILY_PERSON_PREFIX = "P"; + public const string FAMILY_PERSON_FORMAT = "0000000"; + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyPersonSearchCriteria.auto.cs b/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyPersonSearchCriteria.auto.cs new file mode 100644 index 0000000..a41cbd7 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyPersonSearchCriteria.auto.cs @@ -0,0 +1,11 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.Master.SearchCriteria +{ + [TypeScript] + public class FamilyPersonSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyTreeSearchCriteria.auto.cs b/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyTreeSearchCriteria.auto.cs new file mode 100644 index 0000000..53ea80f --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/SearchCriteria/FamilyTreeSearchCriteria.auto.cs @@ -0,0 +1,11 @@ + +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.Master.SearchCriteria +{ + [TypeScript] + public class FamilyTreeSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Service/IFamilyPersonService.auto.cs b/CloudBuilder/CloudBuilder.Master/Service/IFamilyPersonService.auto.cs new file mode 100644 index 0000000..1e33e0e --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Service/IFamilyPersonService.auto.cs @@ -0,0 +1,17 @@ + + +using CloudBuilder.Master.Entity; +using CloudBuilder.Master.SearchCriteria; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Data; + +namespace CloudBuilder.Master.Service +{ + public interface IFamilyPersonService :IServiceBase + { + FamilyPersonEntity[] FindAll(); + FamilyPersonResultData FindBySearchCriteria(FamilyPersonSearchCriteria tc); + dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria tc); + void Deletes(string[] keys); + } +} diff --git a/CloudBuilder/CloudBuilder.Master/Service/IFamilyTreeService.auto.cs b/CloudBuilder/CloudBuilder.Master/Service/IFamilyTreeService.auto.cs new file mode 100644 index 0000000..3bc7a7b --- /dev/null +++ b/CloudBuilder/CloudBuilder.Master/Service/IFamilyTreeService.auto.cs @@ -0,0 +1,16 @@ + + +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Data; +using CloudBuilder.Master.Entity; +using CloudBuilder.Master.SearchCriteria; + +namespace CloudBuilder.Master.Service +{ + public interface IFamilyTreeService :IServiceBase + { + FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria tc); + dynamic PrintBySearchCriteria(FamilyTreeSearchCriteria tc); + void Deletes(string[] keys); + } +} diff --git a/CloudBuilder/CloudBuilder.Request/Master/FamilyPersonRequest.auto.cs b/CloudBuilder/CloudBuilder.Request/Master/FamilyPersonRequest.auto.cs new file mode 100644 index 0000000..2a212bb --- /dev/null +++ b/CloudBuilder/CloudBuilder.Request/Master/FamilyPersonRequest.auto.cs @@ -0,0 +1,59 @@ + +using CloudBuilder.Core.DependencyInjection.Request; +using CloudBuilder.Core.Request; +using CloudBuilder.Core.Service; +using Microsoft.Extensions.DependencyInjection; +using CloudBuilder.Master.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.Master.Entity; + using CloudBuilder.Master.Data; + using System; + using CloudBuilder.Master.SearchCriteria; + +namespace CloudBuilder.Request.Master +{ + +public class FamilyPersonRequest : IRequest +{ + +private readonly IServiceRequest serviceRequest; +public FamilyPersonRequest(IServiceRequest serviceRequest) +{ +this.serviceRequest = serviceRequest; +} + + public FamilyPersonEntity[] FindAll() + { +return Task.Run(() => serviceRequest.PostAsJsonAsync ("/FamilyPerson/FindAll")).GetAwaiter().GetResult(); } + + public FamilyPersonData FindByKey(string key) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); } + + public FamilyPersonResultData FindBySearchCriteria(FamilyPersonSearchCriteria criteria) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); } + + public dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria criteria) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/PrintBySearchCriteria" , criteria)).GetAwaiter().GetResult(); } + + public FamilyPersonData Insert(FamilyPersonData data) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/Insert" , data)).GetAwaiter().GetResult(); } + + public FamilyPersonData Update(FamilyPersonData data) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/Update" , data)).GetAwaiter().GetResult(); } + + public void Delete(string key) + { + Task.Run(() => serviceRequest.PostAsync("/FamilyPerson/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); } + + public void Deletes(string[] keys) + { + Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyPerson/Deletes" , keys)).GetAwaiter().GetResult(); } + + +} +} \ No newline at end of file diff --git a/CloudBuilder/CloudBuilder.Request/Master/FamilyTreeRequest.auto.cs b/CloudBuilder/CloudBuilder.Request/Master/FamilyTreeRequest.auto.cs new file mode 100644 index 0000000..73b8118 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Request/Master/FamilyTreeRequest.auto.cs @@ -0,0 +1,51 @@ + +using CloudBuilder.Core.DependencyInjection.Request; +using CloudBuilder.Core.Request; +using CloudBuilder.Core.Service; +using Microsoft.Extensions.DependencyInjection; +using CloudBuilder.Master.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.Master.Entity; + using CloudBuilder.Master.Data; + using System; + using CloudBuilder.Master.SearchCriteria; + +namespace CloudBuilder.Request.Master +{ + +public class FamilyTreeRequest : IRequest +{ + +private readonly IServiceRequest serviceRequest; +public FamilyTreeRequest(IServiceRequest serviceRequest) +{ +this.serviceRequest = serviceRequest; +} + + public FamilyTreeData FindByKey(string key) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyTree/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); } + + public FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria criteria) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyTree/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); } + + public FamilyTreeData Insert(FamilyTreeData data) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyTree/Insert" , data)).GetAwaiter().GetResult(); } + + public FamilyTreeData Update(FamilyTreeData data) + { +return Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyTree/Update" , data)).GetAwaiter().GetResult(); } + + public void Delete(string key) + { + Task.Run(() => serviceRequest.PostAsync("/FamilyTree/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); } + + public void Deletes(string[] keys) + { + Task.Run(() => serviceRequest.PostAsJsonAsync("/FamilyTree/Deletes" , keys)).GetAwaiter().GetResult(); } + + +} +} \ No newline at end of file diff --git a/CloudBuilder/CloudBuilder.Security.Service/SecurityFunctionService.cs b/CloudBuilder/CloudBuilder.Security.Service/SecurityFunctionService.cs index 135b6f7..44b9e17 100644 --- a/CloudBuilder/CloudBuilder.Security.Service/SecurityFunctionService.cs +++ b/CloudBuilder/CloudBuilder.Security.Service/SecurityFunctionService.cs @@ -286,7 +286,7 @@ namespace CloudBuilder.Security.Service if (maps == null || maps.Length == 0) return; int i = 1; - foreach (SecurityFunctionMapViewEntity map in maps.ToArray()) + foreach (SecurityFunctionMapViewEntity map in maps.OrderBy(x=>x.Orderby).ToArray()) { repositoryMap.InsertNow(new SecurityFunctionMapEntity() { diff --git a/CloudBuilder/CloudBuilder.Security.Service/SecurityGeneratorNumberService.cs b/CloudBuilder/CloudBuilder.Security.Service/SecurityGeneratorNumberService.cs index 22a50ff..6a578db 100644 --- a/CloudBuilder/CloudBuilder.Security.Service/SecurityGeneratorNumberService.cs +++ b/CloudBuilder/CloudBuilder.Security.Service/SecurityGeneratorNumberService.cs @@ -9,6 +9,8 @@ using CloudBuilder.Security.Policy; using CloudBuilder.Security.SearchCriteria; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using System; namespace CloudBuilder.Security.Service { public class SecurityGeneratorNumberService : ISecurityGeneratorNumberService @@ -16,9 +18,12 @@ namespace CloudBuilder.Security.Service private readonly IApplicationService service; private IRepository repository; + private readonly YesNoPolicy yesNoPolicy; + public SecurityGeneratorNumberService(IApplicationService service) { this.service = service; + yesNoPolicy = service.ServiceProvider.GetRequiredKeyedService(nameof(YesNoPolicy)); repository = service.GetRepository>(); } @@ -80,9 +85,9 @@ namespace CloudBuilder.Security.Service Dictionary> mappings = new Dictionary>(); Dictionary validDic = new Dictionary(); - foreach (string v in YesNoPolicy.GetInstance().GetValues()) + foreach (string v in yesNoPolicy.GetValues()) { - validDic.Add(v, YesNoPolicy.GetInstance().ComposeMessage(v, service.Locale)); + validDic.Add(v, yesNoPolicy.ComposeMessage(v, service.Locale)); } mappings.Add(SecurityGeneratorNumberEntity.REFRESH_PERIOD, validDic); diff --git a/CloudBuilder/CloudBuilder.Security.Service/SecurityMasterService.cs b/CloudBuilder/CloudBuilder.Security.Service/SecurityMasterService.cs index ce7bb7d..d0f7c84 100644 --- a/CloudBuilder/CloudBuilder.Security.Service/SecurityMasterService.cs +++ b/CloudBuilder/CloudBuilder.Security.Service/SecurityMasterService.cs @@ -11,17 +11,19 @@ using CloudBuilder.Security.SearchCriteria; using CloudBuilder.Security.Utility; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; using System.Security.Permissions; namespace CloudBuilder.Security.Service { public class SecurityMasterService : ISecurityMasterService { private readonly IApplicationService service; - + private readonly YesNoPolicy yesNoPolicy; private IRepository repository; public SecurityMasterService(IApplicationService service) { this.service = service; + yesNoPolicy = service.ServiceProvider.GetRequiredKeyedService(nameof(YesNoPolicy)); repository = service.GetRepository>(); } @@ -94,9 +96,9 @@ namespace CloudBuilder.Security.Service Dictionary> mappings = new Dictionary>(); Dictionary validDic = new Dictionary(); - foreach (string v in YesNoPolicy.GetInstance().GetValues()) + foreach (string v in yesNoPolicy.GetValues()) { - validDic.Add(v, YesNoPolicy.GetInstance().ComposeMessage(v, service.Locale)); + validDic.Add(v, yesNoPolicy.ComposeMessage(v, service.Locale)); } mappings.Add(SecurityMasterEntity.VALID_INDC, validDic); diff --git a/CloudBuilder/CloudBuilder.Web.Entry.sln b/CloudBuilder/CloudBuilder.Web.Entry.sln index b1939a8..460a8f4 100644 --- a/CloudBuilder/CloudBuilder.Web.Entry.sln +++ b/CloudBuilder/CloudBuilder.Web.Entry.sln @@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Core", "CloudB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Security", "CloudBuilder.Security\CloudBuilder.Security.csproj", "{269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Master", "CloudBuilder.Master\CloudBuilder.Master.csproj", "{17F68378-CCE3-DC5F-DF86-5CC863387EAD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudBuilder.Master.Service", "CloudBuilder.Master.Service\CloudBuilder.Master.Service.csproj", "{3C68A983-8486-AC84-E73E-2843FF09AB5D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +37,14 @@ Global {269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Debug|Any CPU.Build.0 = Debug|Any CPU {269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Release|Any CPU.ActiveCfg = Release|Any CPU {269A5036-BAE9-FD61-1DD5-0EA93B79F0D7}.Release|Any CPU.Build.0 = Release|Any CPU + {17F68378-CCE3-DC5F-DF86-5CC863387EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17F68378-CCE3-DC5F-DF86-5CC863387EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17F68378-CCE3-DC5F-DF86-5CC863387EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17F68378-CCE3-DC5F-DF86-5CC863387EAD}.Release|Any CPU.Build.0 = Release|Any CPU + {3C68A983-8486-AC84-E73E-2843FF09AB5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C68A983-8486-AC84-E73E-2843FF09AB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C68A983-8486-AC84-E73E-2843FF09AB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C68A983-8486-AC84-E73E-2843FF09AB5D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CloudBuilder/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj b/CloudBuilder/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj index b700177..7de2a28 100644 --- a/CloudBuilder/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj +++ b/CloudBuilder/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj @@ -39,6 +39,12 @@ ..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll + + ..\CloudBuilder.Master\bin\Debug\net8.0\CloudBuilder.Master.dll + + + ..\CloudBuilder.Master.Service\bin\Debug\net8.0\CloudBuilder.Master.Service.dll + ..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll diff --git a/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyPersonController.auto.cs b/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyPersonController.auto.cs new file mode 100644 index 0000000..eb7a18a --- /dev/null +++ b/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyPersonController.auto.cs @@ -0,0 +1,195 @@ + +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.Policy; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Transactions; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.Master.Entity; + using CloudBuilder.Master.Data; + using System; + using CloudBuilder.Master.SearchCriteria; + +namespace CloudBuilder.Web.Entry.Controllers.Master +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class FamilyPersonController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IFamilyPersonService familyPersonService; + +public FamilyPersonController(IApplicationService service, IFamilyPersonService familyPersonService) +{ +this.service = service; +this.familyPersonService= familyPersonService; +} + + [PermissionOperate(name: "FamilyPerson", operate: "Find")] + [HttpPost] + public dynamic FindAll() + { + try + { + + var result = familyPersonService.FindAll(); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = familyPersonService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Find")] + [HttpPost] + public dynamic FindBySearchCriteria(FamilyPersonSearchCriteria criteria) + { + try + { + + var result = familyPersonService.FindBySearchCriteria(criteria); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Print")] + [HttpPost] + public dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria criteria) + { + try + { + + var result = familyPersonService.PrintBySearchCriteria(criteria); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(FamilyPersonData data) + { + try + { + + var result = familyPersonService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(FamilyPersonData data) + { + try + { + + var result = familyPersonService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + familyPersonService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyPerson", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Deletes(string[] keys){ + try + { + familyPersonService.Deletes(keys); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyTreeController.auto.cs b/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyTreeController.auto.cs new file mode 100644 index 0000000..ba71c08 --- /dev/null +++ b/CloudBuilder/CloudBuilder.Web.Entry/Controllers/Master/FamilyTreeController.auto.cs @@ -0,0 +1,155 @@ + +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.Policy; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Transactions; +using CloudBuilder.Core.Service; +using CloudBuilder.Master.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.Master.Entity; + using CloudBuilder.Master.Data; + using System; + using CloudBuilder.Master.SearchCriteria; + +namespace CloudBuilder.Web.Entry.Controllers.Master +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class FamilyTreeController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IFamilyTreeService familyTreeService; + +public FamilyTreeController(IApplicationService service, IFamilyTreeService familyTreeService) +{ +this.service = service; +this.familyTreeService= familyTreeService; +} + + [PermissionOperate(name: "FamilyTree", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = familyTreeService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyTree", operate: "Find")] + [HttpPost] + public dynamic FindBySearchCriteria(FamilyTreeSearchCriteria criteria) + { + try + { + + var result = familyTreeService.FindBySearchCriteria(criteria); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyTree", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(FamilyTreeData data) + { + try + { + + var result = familyTreeService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyTree", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(FamilyTreeData data) + { + try + { + + var result = familyTreeService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyTree", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + familyTreeService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "FamilyTree", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Deletes(string[] keys){ + try + { + familyTreeService.Deletes(keys); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder/CloudBuilderLauncher.exe.lnk b/CloudBuilder/CloudBuilderLauncher.exe.lnk index f0d7394..2f08332 100644 Binary files a/CloudBuilder/CloudBuilderLauncher.exe.lnk and b/CloudBuilder/CloudBuilderLauncher.exe.lnk differ diff --git a/CodeGenerator/CloudBuilder.CodeGenerator/Config/tool-init-config.xml b/CodeGenerator/CloudBuilder.CodeGenerator/Config/tool-init-config.xml index 553038b..e756b5c 100644 --- a/CodeGenerator/CloudBuilder.CodeGenerator/Config/tool-init-config.xml +++ b/CodeGenerator/CloudBuilder.CodeGenerator/Config/tool-init-config.xml @@ -102,7 +102,7 @@ TypeScriptService TypeScriptService.cshtml - D:\Docker\WebVue\src\service\Master + D:\Docker\WebVue\src\service\master CloudBuilder.Master.Service CloudBuilder.Web.Entry.Controllers.Master .ts diff --git a/CodeGenerator/CodeGenerator/Config/tool-init-config.xml b/CodeGenerator/CodeGenerator/Config/tool-init-config.xml index 553038b..e756b5c 100644 --- a/CodeGenerator/CodeGenerator/Config/tool-init-config.xml +++ b/CodeGenerator/CodeGenerator/Config/tool-init-config.xml @@ -102,7 +102,7 @@ TypeScriptService TypeScriptService.cshtml - D:\Docker\WebVue\src\service\Master + D:\Docker\WebVue\src\service\master CloudBuilder.Master.Service CloudBuilder.Web.Entry.Controllers.Master .ts diff --git a/WebVue/src/components/basic/ColumnModal.vue b/WebVue/src/components/basic/ColumnModal.vue index d1777d4..13946aa 100644 --- a/WebVue/src/components/basic/ColumnModal.vue +++ b/WebVue/src/components/basic/ColumnModal.vue @@ -4,7 +4,7 @@
- { emit("onSelectChange", selected.value); }; -const rowSelection = computed(() => { +const rowSelection = computed(() => { return { columnWidth: "4%", - type: rowSelectionType.value, + type: rowSelectionType.value as "radio" | "checkbox", selectedRowKeys: unref(selected), onChange: onSelectChange, }; diff --git a/WebVue/src/service/master/familyPersonService.ts b/WebVue/src/service/master/familyPersonService.ts new file mode 100644 index 0000000..86507c1 --- /dev/null +++ b/WebVue/src/service/master/familyPersonService.ts @@ -0,0 +1,93 @@ + +import { request,download } from "@/utils/request"; + import type { FamilyPersonEntity } from "@/data/auto/familyPersonEntity"; + import type { FamilyPersonData } from "@/data/auto/familyPersonData"; + import type { FamilyPersonSearchCriteria } from "@/data/auto/familyPersonSearchCriteria"; + import type { FamilyPersonResultData } from "@/data/auto/familyPersonResultData"; + +class FamilyPersonService{ + + async FindAll() { + return request( + { + url: "/FamilyPerson/FindAll", + method: "post", + } + ) + }; + + async FindByKey(data: string) { + return request( + { + url: "/FamilyPerson/FindByKey?key="+data, + method: "post", + data, + } + ) + }; + + async FindBySearchCriteria(data: FamilyPersonSearchCriteria) { + return request( + { + url: "/FamilyPerson/FindBySearchCriteria", + method: "post", + data, + } + ) + }; + + async PrintBySearchCriteria(data: FamilyPersonSearchCriteria) { + return download( + { + url: "/FamilyPerson/PrintBySearchCriteria", + method: "post", + data, + filename:'FamilyPerson' + } + ) + }; + + async Insert(data: FamilyPersonData) { + return request( + { + url: "/FamilyPerson/Insert", + method: "post", + data, + } + ) + }; + + async Update(data: FamilyPersonData) { + return request( + { + url: "/FamilyPerson/Update", + method: "post", + data, + } + ) + }; + + async Delete(data: string) { + return request( + { + url: "/FamilyPerson/Delete?key="+data, + method: "post", + data, + } + ) + }; + + async Deletes(data: String[]) { + return request( + { + url: "/FamilyPerson/Deletes", + method: "post", + data, + } + ) + }; + +} + +const familyPersonService= new FamilyPersonService(); +export default familyPersonService; \ No newline at end of file diff --git a/WebVue/src/service/master/familyTreeService.ts b/WebVue/src/service/master/familyTreeService.ts new file mode 100644 index 0000000..751f9aa --- /dev/null +++ b/WebVue/src/service/master/familyTreeService.ts @@ -0,0 +1,72 @@ + +import { request } from "@/utils/request"; + import type { FamilyTreeData } from "@/data/auto/familyTreeData"; + import type { FamilyTreeSearchCriteria } from "@/data/auto/familyTreeSearchCriteria"; + import type { FamilyTreeResultData } from "@/data/auto/familyTreeResultData"; + +class FamilyTreeService{ + + async FindByKey(data: string) { + return request( + { + url: "/FamilyTree/FindByKey?key="+data, + method: "post", + data, + } + ) + }; + + async FindBySearchCriteria(data: FamilyTreeSearchCriteria) { + return request( + { + url: "/FamilyTree/FindBySearchCriteria", + method: "post", + data, + } + ) + }; + + async Insert(data: FamilyTreeData) { + return request( + { + url: "/FamilyTree/Insert", + method: "post", + data, + } + ) + }; + + async Update(data: FamilyTreeData) { + return request( + { + url: "/FamilyTree/Update", + method: "post", + data, + } + ) + }; + + async Delete(data: string) { + return request( + { + url: "/FamilyTree/Delete?key="+data, + method: "post", + data, + } + ) + }; + + async Deletes(data: String[]) { + return request( + { + url: "/FamilyTree/Deletes", + method: "post", + data, + } + ) + }; + +} + +const familyTreeService= new FamilyTreeService(); +export default familyTreeService; \ No newline at end of file diff --git a/WebVue/src/service/security/yesNoPolicyService.ts b/WebVue/src/service/security/yesNoPolicyService.ts index d0c4aab..3bd3019 100644 --- a/WebVue/src/service/security/yesNoPolicyService.ts +++ b/WebVue/src/service/security/yesNoPolicyService.ts @@ -14,15 +14,6 @@ class YesNoPolicyService{ ) }; - async Copy() { - return request( - { - url: "/YesNoPolicy/Copy", - method: "get", - } - ) - }; - } const yesNoPolicyService= new YesNoPolicyService(); diff --git a/WebVue/src/utils/request.ts b/WebVue/src/utils/request.ts index dd30ecd..b43c821 100644 --- a/WebVue/src/utils/request.ts +++ b/WebVue/src/utils/request.ts @@ -231,6 +231,18 @@ export const download = async (d: { service .post(d.url, d.data) .then((res) => { + // 关键:先解析响应头,判断是不是json报错 + const contentType = res.headers["content-type"] || ""; + // 如果返回的是json,代表后端业务异常,不是excel文件 + if (contentType.includes("application/json")) { + // arraybuffer转字符串 + const text = new TextDecoder().decode(res.data); + const errObj = JSON.parse(text); + errorNotificationWithIcon(errObj.message || errObj.msg || "下载失败"); + return; // ❌直接return,不执行下载逻辑 + } + + // ✅正常excel文件,执行下载 const downloadUrl = window.URL.createObjectURL(new Blob([res.data])); const link = document.createElement("a"); link.href = downloadUrl; @@ -240,12 +252,17 @@ export const download = async (d: { ); document.body.appendChild(link); link.click(); + // 释放内存 + link.remove(); + window.URL.revokeObjectURL(downloadUrl); }) .catch((error) => { - errorNotificationWithIcon(error.message); + // 网络异常、超时才走到这里 + errorNotificationWithIcon(error.message ?? "网络异常,下载失败"); }); }; + const errorNotificationWithIcon = (message: string) => { notification.error({ message: t("request.notification.errorMessage"), diff --git a/WebVue/src/views/master/FamilyPersonEnquiry.vue b/WebVue/src/views/master/FamilyPersonEnquiry.vue new file mode 100644 index 0000000..ce7f04d --- /dev/null +++ b/WebVue/src/views/master/FamilyPersonEnquiry.vue @@ -0,0 +1,339 @@ + + diff --git a/WebVue/src/views/master/FamilyPersonOperation.vue b/WebVue/src/views/master/FamilyPersonOperation.vue new file mode 100644 index 0000000..8c61070 --- /dev/null +++ b/WebVue/src/views/master/FamilyPersonOperation.vue @@ -0,0 +1,960 @@ + + + diff --git a/WebVue/src/views/security/FunctionOperation.vue b/WebVue/src/views/security/FunctionOperation.vue index 744d174..ee6acd1 100644 --- a/WebVue/src/views/security/FunctionOperation.vue +++ b/WebVue/src/views/security/FunctionOperation.vue @@ -592,6 +592,7 @@ const upSon = (index: number) => { const item = data.value.SecurityFunctionMapSons.splice(index, 1)[0]; data.value.SecurityFunctionMapSons.splice(index - 1, 0, item); selectedSonIndex.value = index - 1; + refreshSonOrderby(); } }; @@ -600,9 +601,17 @@ const downSon = (index: number) => { const item = data.value.SecurityFunctionMapSons.splice(index, 1)[0]; data.value.SecurityFunctionMapSons.splice(index + 1, 0, item); selectedSonIndex.value = index + 1; + + refreshSonOrderby(); } }; +const refreshSonOrderby = () => { + data.value.SecurityFunctionMapSons.forEach((item, idx) => { + item.Orderby = idx + 1; // orderby从1开始,也可以用 idx + }); +}; + const deleteSon = (key: string) => { data.value.SecurityFunctionMapSons = data.value.SecurityFunctionMapSons.filter(item => item.SonFunctionName !== key); };