ow
This commit is contained in:
1 parent
c253805122
commit
7df55a11bf
46 files changed
+3689
-27
No files matched your search
@@ -38,6 +38,9 @@
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Master">
|
||||
<HintPath>..\CloudBuilder.Master\bin\Debug\net8.0\CloudBuilder.Master.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Security">
|
||||
<HintPath>..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -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<FamilyPersonEntity> repository;
|
||||
public FamilyPersonService(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
repository = service.GetRepository<IRepository<FamilyPersonEntity>>();
|
||||
}
|
||||
|
||||
[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<ISecurityGeneratorNumberService>()!;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeEntity> repository;
|
||||
public FamilyTreeService(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
repository = service.GetRepository<IRepository<FamilyTreeEntity>>();
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Data\" />
|
||||
<Folder Include="Entity\" />
|
||||
<Folder Include="Linkup\" />
|
||||
<Folder Include="Policy\" />
|
||||
<Folder Include="Publisher\" />
|
||||
<Folder Include="SearchCriteria\" />
|
||||
<Folder Include="Service\" />
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 排除实体类标记
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[TypeScript]
|
||||
public class FamilyPersonDisplayData : FamilyPersonEntity
|
||||
{
|
||||
public FamilyPersonDisplayData()
|
||||
{
|
||||
}
|
||||
public FamilyPersonDisplayData(FamilyPersonEntity entity)
|
||||
{
|
||||
CopyFrom(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 排除实体类标记
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[TypeScript]
|
||||
public class FamilyTreeDisplayData : FamilyPersonEntity
|
||||
{
|
||||
public FamilyTreeDisplayData()
|
||||
{
|
||||
}
|
||||
public FamilyTreeDisplayData(FamilyPersonEntity entity)
|
||||
{
|
||||
CopyFrom(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
using CloudBuilder.Core.DependencyInjection.EFCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Reflection;
|
||||
|
||||
namespace CloudBuilder.Master.Entity
|
||||
{
|
||||
public class CloudBuilderMasterRegistEntity : IMasterRegistEntityType<ModelBuilder>
|
||||
{
|
||||
///<summary>
|
||||
///注入模块内的所有实体类
|
||||
///</summary>
|
||||
///<param name="builder"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///如果存在多个主键的,要在RegistKeys方法注入
|
||||
///builder.Entity<xxxxxxEntity>().HasKey(c => new { c.TableName, c.FieldName });
|
||||
///builder.Entity<xxxxxxEntity>(eb => { eb.HasNoKey(); });
|
||||
///</summary>
|
||||
///<param name="builder"></param>
|
||||
public void RegistKeys(ModelBuilder builder)
|
||||
{
|
||||
//***BEGIN***
|
||||
|
||||
builder.Entity<FamilyTreeChildrenMapEntity>().HasKey(c => new {c.TreeId,c.PersonId,c.ChildrenId});
|
||||
builder.Entity<FamilyTreeSpouseMapEntity>().HasKey(c => new {c.TreeId,c.PersonId,c.SpouseId});
|
||||
|
||||
|
||||
|
||||
|
||||
//***END***
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<DateTime> BirthDate { get; set; }
|
||||
[Column("death_text")]
|
||||
public string? DeathText { get; set; }
|
||||
[Column("death_date")]
|
||||
public Nullable<DateTime> 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeChildrenMapEntityKey>
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeChildrenMapEntity>().HasKey(c => new { c.TreeId, c.PersonId, c.ChildrenId}); */
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeSpouseMapEntityKey>
|
||||
{
|
||||
|
||||
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<DateTime> MarryDate { get; set; }
|
||||
[Column("divorce_date_text")]
|
||||
public string? DivorceDateText { get; set; }
|
||||
[Column("divorce_date")]
|
||||
public Nullable<DateTime> 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeSpouseMapEntity>().HasKey(c => new { c.TreeId, c.PersonId, c.SpouseId}); */
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
namespace CloudBuilder.Master.Policy
|
||||
{
|
||||
public partial class MasterPermissionPolicy
|
||||
{
|
||||
//***BEGIN***
|
||||
public const string FamilyTree = "FamilyTree";
|
||||
|
||||
public const string FamilyPerson = "FamilyPerson";
|
||||
//***END***
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
using CloudBuilder.Core.Authorization;
|
||||
using CloudBuilder.Core.Service;
|
||||
namespace CloudBuilder.Master.SearchCriteria
|
||||
{
|
||||
[TypeScript]
|
||||
public class FamilyPersonSearchCriteria: AbstractSearchCriteria
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
using CloudBuilder.Core.Authorization;
|
||||
using CloudBuilder.Core.Service;
|
||||
namespace CloudBuilder.Master.SearchCriteria
|
||||
{
|
||||
[TypeScript]
|
||||
public class FamilyTreeSearchCriteria: AbstractSearchCriteria
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyPersonData, string ,FamilyPersonSearchCriteria>
|
||||
{
|
||||
FamilyPersonEntity[] FindAll();
|
||||
FamilyPersonResultData FindBySearchCriteria(FamilyPersonSearchCriteria tc);
|
||||
dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria tc);
|
||||
void Deletes(string[] keys);
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeData, string ,FamilyTreeSearchCriteria>
|
||||
{
|
||||
FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria tc);
|
||||
dynamic PrintBySearchCriteria(FamilyTreeSearchCriteria tc);
|
||||
void Deletes(string[] keys);
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyPersonEntity[]> ("/FamilyPerson/FindAll")).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyPersonData FindByKey(string key)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyPersonData>("/FamilyPerson/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyPersonResultData FindBySearchCriteria(FamilyPersonSearchCriteria criteria)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyPersonSearchCriteria,FamilyPersonResultData>("/FamilyPerson/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
|
||||
|
||||
public dynamic PrintBySearchCriteria(FamilyPersonSearchCriteria criteria)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyPersonSearchCriteria,dynamic>("/FamilyPerson/PrintBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyPersonData Insert(FamilyPersonData data)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyPersonData,FamilyPersonData>("/FamilyPerson/Insert" , data)).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyPersonData Update(FamilyPersonData data)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyPersonData,FamilyPersonData>("/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<string[],dynamic>("/FamilyPerson/Deletes" , keys)).GetAwaiter().GetResult(); }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<FamilyTreeData>("/FamilyTree/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyTreeResultData FindBySearchCriteria(FamilyTreeSearchCriteria criteria)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyTreeSearchCriteria,FamilyTreeResultData>("/FamilyTree/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyTreeData Insert(FamilyTreeData data)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyTreeData,FamilyTreeData>("/FamilyTree/Insert" , data)).GetAwaiter().GetResult(); }
|
||||
|
||||
public FamilyTreeData Update(FamilyTreeData data)
|
||||
{
|
||||
return Task.Run(() => serviceRequest.PostAsJsonAsync<FamilyTreeData,FamilyTreeData>("/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<string[],dynamic>("/FamilyTree/Deletes" , keys)).GetAwaiter().GetResult(); }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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<SecurityGeneratorNumberEntity> repository;
|
||||
private readonly YesNoPolicy yesNoPolicy;
|
||||
|
||||
public SecurityGeneratorNumberService(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
yesNoPolicy = service.ServiceProvider.GetRequiredKeyedService<YesNoPolicy>(nameof(YesNoPolicy));
|
||||
repository = service.GetRepository<IRepository<SecurityGeneratorNumberEntity>>();
|
||||
}
|
||||
|
||||
@@ -80,9 +85,9 @@ namespace CloudBuilder.Security.Service
|
||||
|
||||
Dictionary<string, Dictionary<string, object>> mappings = new Dictionary<string, Dictionary<string, object>>();
|
||||
Dictionary<string, object> validDic = new Dictionary<string, object>();
|
||||
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);
|
||||
|
||||
|
||||
@@ -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<SecurityMasterEntity> repository;
|
||||
public SecurityMasterService(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
yesNoPolicy = service.ServiceProvider.GetRequiredKeyedService<YesNoPolicy>(nameof(YesNoPolicy));
|
||||
repository = service.GetRepository<IRepository<SecurityMasterEntity>>();
|
||||
}
|
||||
|
||||
@@ -94,9 +96,9 @@ namespace CloudBuilder.Security.Service
|
||||
|
||||
Dictionary<string, Dictionary<string, object>> mappings = new Dictionary<string, Dictionary<string, object>>();
|
||||
Dictionary<string, object> validDic = new Dictionary<string, object>();
|
||||
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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Master">
|
||||
<HintPath>..\CloudBuilder.Master\bin\Debug\net8.0\CloudBuilder.Master.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Master.Service">
|
||||
<HintPath>..\CloudBuilder.Master.Service\bin\Debug\net8.0\CloudBuilder.Master.Service.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Security">
|
||||
<HintPath>..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
+195
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -102,7 +102,7 @@
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScriptService</TemplateType>
|
||||
<TemplateFileName>TypeScriptService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\Docker\WebVue\src\service\Master</OutFilePath>
|
||||
<OutFilePath>D:\Docker\WebVue\src\service\master</OutFilePath>
|
||||
<Assembly>CloudBuilder.Master.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Master</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScriptService</TemplateType>
|
||||
<TemplateFileName>TypeScriptService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\Docker\WebVue\src\service\Master</OutFilePath>
|
||||
<OutFilePath>D:\Docker\WebVue\src\service\master</OutFilePath>
|
||||
<Assembly>CloudBuilder.Master.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Master</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<br />
|
||||
<a-row :wrap="false">
|
||||
<a-col :lg="24">
|
||||
<a-input flex="none" readonly value="视图" class="site-input-split" style="
|
||||
<a-input flex="none" readonly value="当前视图" class="site-input-split" style="
|
||||
width: 80px;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 5pt 5pt;
|
||||
|
||||
@@ -60,6 +60,10 @@ const emit = defineEmits<EmitsType>();
|
||||
const sortable = ref<Sortable | null>(null);
|
||||
|
||||
onMounted(() => {
|
||||
let i: number = 0;
|
||||
props.list.forEach((element: Column) => {
|
||||
element.sequence = i++;
|
||||
});
|
||||
initDraggable();
|
||||
});
|
||||
|
||||
@@ -82,13 +86,13 @@ const initDraggable = () => {
|
||||
onUpdate(e: any) {
|
||||
if (e.oldIndex !== undefined && e.newIndex !== undefined) {
|
||||
// 删除拖拽的元素
|
||||
const list = [...props.list];
|
||||
let list = [...props.list];
|
||||
const item = list.splice(e.oldIndex, 1)[0];
|
||||
// 把删除的元素放到新的位置
|
||||
list.splice(e.newIndex, 0, item);
|
||||
let i: number = 0;
|
||||
list.forEach((element: Column) => {
|
||||
element.sequence = i++;
|
||||
list = list.map((element: Column) => {
|
||||
return { ...element, sequence: i++ };
|
||||
});
|
||||
emit('update:list', list);
|
||||
emit('onChangeList', list);
|
||||
|
||||
@@ -115,7 +115,7 @@ import {
|
||||
} from "vue";
|
||||
import { usePagination, type PaginationQueryResult } from "vue-request";
|
||||
import type { TablePaginationConfig, TableProps } from "ant-design-vue";
|
||||
import type { ATable } from "ant-design-vue";
|
||||
import { Table as ATable } from 'ant-design-vue';
|
||||
import searchCriteria from "@/components/basic/SearchCriteria.vue";
|
||||
import { SearchFilter } from "@/data/auto/searchFilter";
|
||||
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
||||
@@ -387,10 +387,10 @@ const onSelectChange = (changableRowKeys: any[]) => {
|
||||
emit("onSelectChange", selected.value);
|
||||
};
|
||||
|
||||
const rowSelection = computed(() => {
|
||||
const rowSelection = computed<TableProps["rowSelection"]>(() => {
|
||||
return {
|
||||
columnWidth: "4%",
|
||||
type: rowSelectionType.value,
|
||||
type: rowSelectionType.value as "radio" | "checkbox",
|
||||
selectedRowKeys: unref(selected),
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
|
||||
@@ -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<FamilyPersonEntity[]>(
|
||||
{
|
||||
url: "/FamilyPerson/FindAll",
|
||||
method: "post",
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async FindByKey(data: string) {
|
||||
return request<FamilyPersonData>(
|
||||
{
|
||||
url: "/FamilyPerson/FindByKey?key="+data,
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async FindBySearchCriteria(data: FamilyPersonSearchCriteria) {
|
||||
return request<FamilyPersonResultData>(
|
||||
{
|
||||
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<FamilyPersonData>(
|
||||
{
|
||||
url: "/FamilyPerson/Insert",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Update(data: FamilyPersonData) {
|
||||
return request<FamilyPersonData>(
|
||||
{
|
||||
url: "/FamilyPerson/Update",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Delete(data: string) {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/FamilyPerson/Delete?key="+data,
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Deletes(data: String[]) {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/FamilyPerson/Deletes",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const familyPersonService= new FamilyPersonService();
|
||||
export default familyPersonService;
|
||||
@@ -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<FamilyTreeData>(
|
||||
{
|
||||
url: "/FamilyTree/FindByKey?key="+data,
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async FindBySearchCriteria(data: FamilyTreeSearchCriteria) {
|
||||
return request<FamilyTreeResultData>(
|
||||
{
|
||||
url: "/FamilyTree/FindBySearchCriteria",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Insert(data: FamilyTreeData) {
|
||||
return request<FamilyTreeData>(
|
||||
{
|
||||
url: "/FamilyTree/Insert",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Update(data: FamilyTreeData) {
|
||||
return request<FamilyTreeData>(
|
||||
{
|
||||
url: "/FamilyTree/Update",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Delete(data: string) {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/FamilyTree/Delete?key="+data,
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async Deletes(data: String[]) {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/FamilyTree/Deletes",
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const familyTreeService= new FamilyTreeService();
|
||||
export default familyTreeService;
|
||||
@@ -14,15 +14,6 @@ class YesNoPolicyService{
|
||||
)
|
||||
};
|
||||
|
||||
async Copy() {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/YesNoPolicy/Copy",
|
||||
method: "get",
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const yesNoPolicyService= new YesNoPolicyService();
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -0,0 +1,339 @@
|
||||
<template>
|
||||
<search @on-submit="onSubmit" @on-print="onPrint" @on-reset="onReset" @use-pagination="onPagination"
|
||||
:is-modal="isModal" :loading="loading" :pagination="result" :rowSelectionType="selectionType"
|
||||
@on-row-dblclick="onRowDblclick" @on-select-change="onSelectChange">
|
||||
<template #control>
|
||||
<a-button type="primary" v-if="canCreate && !isModal" :icon="h(FileAddOutlined)"
|
||||
@click.prevent="onCreate">新增</a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<div v-if="!isModal" class="page-footer">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="24" :sm="24">
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" v-if="canView" :icon="h(FileTextOutlined)"
|
||||
:disabled="!(keys && keys.length ==1)" @click.prevent="onView">查看</a-button>
|
||||
<a-button type="primary" v-if="canAmend" :icon="h(EditOutlined)"
|
||||
:disabled="!(keys && keys.length ==1)" @click.prevent="onAmend">修改</a-button>
|
||||
<a-popconfirm title="确定是否删除这条记录?" ok-text="是" cancel-text="否" @confirm="onDelete">
|
||||
<a-button type="primary" danger :icon="h(DeleteOutlined)" v-if="canDelete"
|
||||
:disabled="!(keys && keys.length > 0)">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
</search>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, inject, defineComponent, onMounted, ref, unref, provide, h } from "vue";
|
||||
import { BindOption } from "@/data/custom/bindOption";
|
||||
import { SelectOption } from "@/data/auto/selectOption";
|
||||
import search from "@/components/basic/Search.vue";
|
||||
import { DeleteOutlined, EditOutlined, FileAddOutlined, FileTextOutlined } from "@ant-design/icons-vue";
|
||||
|
||||
import { FamilyPersonResultData } from "@/data/auto/familyPersonResultData";
|
||||
import { FamilyPersonEntity } from "@/data/auto/familyPersonEntity";
|
||||
import { SearchFilter } from "@/data/auto/searchFilter"
|
||||
import familyPersonService from "@/service/master/familyPersonService";
|
||||
import { FamilyPersonSearchCriteria } from "@/data/auto/familyPersonSearchCriteria";
|
||||
|
||||
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
||||
import { PermissionContext, usePermissionContext } from "@/hooks/PermissionContext"
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import { useBindOption } from "@/hooks/useBindOption";
|
||||
import { SearchFilterOperatorPolicy } from "@/data/custom/searchFilterOperatorPolicy"
|
||||
import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy"
|
||||
import { notification } from "ant-design-vue";
|
||||
import { GridColumnInfo } from "@/data/auto/gridColumnInfo"
|
||||
import { useGridColumnInfo } from "@/hooks/gridColumnInfo"
|
||||
import { title } from "process";
|
||||
import { useOrderedChildren } from "@/hooks/use-ordered-children";
|
||||
import { SearchCriteriaContext } from "@/injections";
|
||||
import { enquiryMethodKey, searchCriteriaManagerKey, operationToEnquiryMethodKey, OperationToEnquiryModelOption, layoutProviderMethodKey } from "@/injections";
|
||||
//page from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
//================inject================
|
||||
const actorOperationMethod = inject(operationToEnquiryMethodKey);
|
||||
const modelOption = actorOperationMethod?.getOperationToEnquiryModelOption() as OperationToEnquiryModelOption;
|
||||
|
||||
const isModal = ref(modelOption ? modelOption.isModalPermission : false);
|
||||
const selectionType = ref(modelOption ? modelOption.selectionTypePermission : 'checkbox');
|
||||
const initBindOptions = ref((modelOption ? modelOption.initBindOptionsPermission : []) as BindOption[]);
|
||||
|
||||
//报表名称(layout)
|
||||
const layoutProviderMethod = inject(layoutProviderMethodKey);
|
||||
|
||||
//================inject================
|
||||
|
||||
const emit = defineEmits(['onRowDblclick']);
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const canView = ref<boolean>(false);
|
||||
const canAmend = ref<boolean>(false);
|
||||
const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
width: '5%',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
sequence: 0,
|
||||
hidden: 'N',
|
||||
format: ''
|
||||
},
|
||||
{
|
||||
title: "姓氏",
|
||||
dataIndex: FamilyPersonEntity.SURNAME,
|
||||
sorter: true,
|
||||
width: '15%',
|
||||
sequence: 1,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "谱名",
|
||||
dataIndex: FamilyPersonEntity.GENEALOGY_NAME,
|
||||
sorter: true,
|
||||
width: '15%',
|
||||
sequence: 2,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "常用名",
|
||||
dataIndex: FamilyPersonEntity.COMMON_NAME,
|
||||
sorter: true,
|
||||
width: '20%',
|
||||
sequence: 2,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "创建日期",
|
||||
dataIndex: FamilyPersonEntity.CREATED_DATETIME,
|
||||
sorter: true,
|
||||
width: '20%',
|
||||
sequence: 2,
|
||||
hidden: 'N'
|
||||
},
|
||||
]);
|
||||
|
||||
const viewOption = {
|
||||
Value: 'default',
|
||||
SelectOptions: [{ BindValue: 'default', DisplayName: "默认" }],
|
||||
Columns: [{ BindValue: 'default', BindColumn: columns }]
|
||||
};
|
||||
|
||||
const bindOptions = ref<BindOption[]>([]);
|
||||
|
||||
const datas = ref<FamilyPersonEntity[]>([]);
|
||||
const pagingParams = ref<PagingParams>({ pageSize: 20, page: 1 });
|
||||
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
|
||||
|
||||
const data = ref<FamilyPersonResultData>(new FamilyPersonResultData());
|
||||
|
||||
const isSearched = ref<boolean>(false);
|
||||
const currentSearchCriteria = ref<FamilyPersonSearchCriteria>(new FamilyPersonSearchCriteria());
|
||||
|
||||
const keys = ref<FamilyPersonEntity[]>([]);
|
||||
|
||||
const {
|
||||
children: items,
|
||||
addChild: addItem,
|
||||
removeChild: removeItem,
|
||||
} = useOrderedChildren<SearchCriteriaContext>();
|
||||
//================provide================
|
||||
//初始化查询条件UI(search)
|
||||
provide(enquiryMethodKey, {
|
||||
getLayoutSetting: () => { return { controlLeft: 16, controlRight: 8, space: true, soltLeft: 24, soltRight: 24 }; },
|
||||
getBindOptions: () => { return unref(bindOptions); },
|
||||
getViewOption: () => { return unref(viewOption); },
|
||||
getDatas: () => { return datas; },
|
||||
});
|
||||
|
||||
provide(
|
||||
searchCriteriaManagerKey,
|
||||
reactive({
|
||||
items,
|
||||
addItem,
|
||||
removeItem,
|
||||
})
|
||||
);
|
||||
|
||||
//================provide================
|
||||
|
||||
defineExpose({
|
||||
keys,
|
||||
initBindOptions,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
let pContext: PermissionContext = usePermissionContext();
|
||||
canView.value = pContext.canView(route.meta.permission as string);
|
||||
canAmend.value = pContext.canAmend(route.meta.permission as string);
|
||||
canDelete.value = pContext.canDelete(route.meta.permission as string);
|
||||
canCreate.value = pContext.canCreate(route.meta.permission as string);
|
||||
initBindOption();
|
||||
onSearch();
|
||||
})
|
||||
|
||||
const onSelectChange = ((selected: FamilyPersonEntity[]) => {
|
||||
keys.value = selected;
|
||||
})
|
||||
|
||||
const onRowDblclick = ((e: any, record: FamilyPersonEntity) => {
|
||||
if (isModal.value) {
|
||||
emit('onRowDblclick', record);
|
||||
}
|
||||
else {
|
||||
router.push({ name: "FamilyPersonOperation", params: { id: record.PersonId, mode: 'view' } });
|
||||
}
|
||||
})
|
||||
|
||||
const onReset = (() => {
|
||||
keys.value = [];
|
||||
result.value.Total = 0;
|
||||
})
|
||||
|
||||
const onView = (() => {
|
||||
if (keys.value.length == 0) return;
|
||||
router.push({ name: "FamilyPersonOperation", params: { id: keys.value[0].PersonId, mode: 'view' } });
|
||||
})
|
||||
|
||||
const onCreate = (() => {
|
||||
router.push({ name: "FamilyPersonOperation", params: { id: '', mode: 'create' } });
|
||||
})
|
||||
|
||||
const onAmend = (() => {
|
||||
if (keys.value.length == 0) return;
|
||||
router.push({ name: "FamilyPersonOperation", params: { id: keys.value[0].PersonId, mode: 'amend' } });
|
||||
})
|
||||
|
||||
const onDelete = (async () => {
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
await familyPersonService.Delete(keys.value[i].PersonId);
|
||||
}
|
||||
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '记录删除成功',
|
||||
placement: "topRight",
|
||||
});
|
||||
onReload();
|
||||
})
|
||||
|
||||
const setBindOptionValue = ((bindValue: string, value: string, value1: string, values: string[], disabled: boolean) => {
|
||||
let bindOption: BindOption = bindOptions.value.filter(x => x.BindValue == bindValue)[0];
|
||||
if (!bindOption) return;
|
||||
bindOption.Value = value;
|
||||
bindOption.Value1 = value1;
|
||||
bindOption.Values = values;
|
||||
bindOption.disabled = disabled;
|
||||
})
|
||||
|
||||
//初始化查询条件
|
||||
const initBindOption = (async () => {
|
||||
let ubo = useBindOption();
|
||||
let bindOption: BindOption = ubo.getBindOption(FamilyPersonEntity.DB_SURNAME, '姓氏', SearchFilterTypePolicy.TEXT, SearchFilterOperatorPolicy.CONTAIN);
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
bindOption = ubo.getBindOption(FamilyPersonEntity.DB_GENEALOGY_NAME, '谱名', SearchFilterTypePolicy.TEXT, SearchFilterOperatorPolicy.CONTAIN);
|
||||
bindOption.lg = 10;
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
bindOption = ubo.getBindOption(FamilyPersonEntity.DB_CREATED_DATETIME, '创建日期', SearchFilterTypePolicy.DATE, SearchFilterOperatorPolicy.DATE_BETWEEN);
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
bindOption = ubo.getBindOption(FamilyPersonEntity.DB_COMMON_NAME, '常用名', SearchFilterTypePolicy.TEXT, SearchFilterOperatorPolicy.CONTAIN);
|
||||
bindOption.lg = 10;
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
initBindOptions.value.forEach(element => {
|
||||
setBindOptionValue(element.BindValue, element.Value, element.Value1, element.Values, element.disabled);
|
||||
});
|
||||
})
|
||||
|
||||
//table from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
result.value.Page = pagingParams.value.page ?? 1;
|
||||
result.value.Limit = pagingParams.value.pageSize;
|
||||
|
||||
const onSubmit = (async (filters: SearchFilter[]) => {
|
||||
|
||||
let c: FamilyPersonSearchCriteria = new FamilyPersonSearchCriteria();
|
||||
|
||||
isSearched.value = true;
|
||||
c.Filter = filters;
|
||||
c.limit = pagingParams.value.pageSize;
|
||||
c.page = pagingParams.value.page ?? 1;
|
||||
c.GridColumns = [];
|
||||
currentSearchCriteria.value = c;
|
||||
await findBySearchCriteria(c);
|
||||
})
|
||||
|
||||
const onSearch = (async () => {
|
||||
onSubmit(items.value[0].getFilter());
|
||||
})
|
||||
|
||||
const onPrint = (async () => {
|
||||
let c: FamilyPersonSearchCriteria = new FamilyPersonSearchCriteria();
|
||||
|
||||
c.Filter = items.value[0].getFilter();
|
||||
|
||||
c.limit = pagingParams.value.pageSize;
|
||||
c.page = pagingParams.value.page ?? 1;
|
||||
c.GridColumns = useGridColumnInfo().getGridColumnInfo(unref(columns));
|
||||
c.ReportName = layoutProviderMethod?.getLayoutProvider().layoutTitle!;
|
||||
try {
|
||||
let sss = await familyPersonService.PrintBySearchCriteria(c);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const findBySearchCriteria = (async (c: FamilyPersonSearchCriteria) => {
|
||||
try {
|
||||
data.value = await familyPersonService.FindBySearchCriteria(c);
|
||||
result.value.Total = data.value.Total;
|
||||
result.value.Page = data.value.Page;
|
||||
result.value.Limit = data.value.Limit;
|
||||
datas.value = data.value.Datas;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
|
||||
const onPagination = (async (params: PagingParams) => {
|
||||
|
||||
if (!isSearched.value) return;
|
||||
let c: FamilyPersonSearchCriteria = new FamilyPersonSearchCriteria();
|
||||
|
||||
c.Filter = items.value[0].getFilter();
|
||||
|
||||
c.limit = params.pageSize;
|
||||
c.page = params.page ?? 1;
|
||||
if (params.sortField)
|
||||
c.orderby = params.sortField!;
|
||||
if (params.sortOrder)
|
||||
c.orderbytag = params.sortOrder?.toString().substring(0, 4)!;
|
||||
c.GridColumns = [];
|
||||
currentSearchCriteria.value = c;
|
||||
await findBySearchCriteria(c);
|
||||
});
|
||||
|
||||
const onReload = (async () => {
|
||||
await findBySearchCriteria(unref(currentSearchCriteria));
|
||||
})
|
||||
//table end-----------------------------------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@@ -0,0 +1,960 @@
|
||||
<template>
|
||||
<a-spin size="large" :spinning="loading">
|
||||
<div class="page-container">
|
||||
<div class="page-header">
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :lg="8" :sm="24">
|
||||
<a-row :wrap="false">
|
||||
<a-col flex="none">
|
||||
<div style="padding: 0">
|
||||
<a-input
|
||||
flex="none"
|
||||
readonly
|
||||
value="族员编号"
|
||||
class="site-input-split"
|
||||
style="
|
||||
width: 160px;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 5pt 5pt;
|
||||
border-bottom-left-radius: 5pt 5pt;
|
||||
pointer-events: none;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col flex="auto">
|
||||
<a-input-search
|
||||
:disabled="isEdit"
|
||||
v-model:value="personId"
|
||||
flex="auto"
|
||||
@search="onModalSearch"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :lg="12" :sm="24">
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="isEdit"
|
||||
:icon="h(FileSearchOutlined)"
|
||||
@click.prevent="onSearch"
|
||||
>查询</a-button
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="isEdit"
|
||||
:icon="h(ClearOutlined)"
|
||||
@click.prevent="onReset"
|
||||
>重置</a-button
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
:disabled="isEdit"
|
||||
:icon="h(FileAddOutlined)"
|
||||
@click.prevent="onCreate"
|
||||
>新增</a-button
|
||||
>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<div class="page-main" :style="{ height: resultH }">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<!-- 左侧头像/快捷栏 -->
|
||||
<a-col :lg="5" :sm="24">
|
||||
<a-row :wrap="false" justify="center">
|
||||
<a-col
|
||||
:flex="'auto'"
|
||||
style="text-align: center; position: relative"
|
||||
>
|
||||
<a-avatar :size="120" :src="data.FamilyPerson.AvatarFilename">
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<div class="avatar-change-mask" v-if="isEdit">点击更换</div>
|
||||
<a-button
|
||||
v-if="isEdit && data.FamilyPerson.AvatarFilename"
|
||||
class="avatar-close"
|
||||
type="text"
|
||||
:icon="h(CloseOutlined)"
|
||||
size="small"
|
||||
@click.prevent="data.FamilyPerson.AvatarFilename = ''"
|
||||
></a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 12px">
|
||||
<a-col :span="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'50px'" class="side-label">编号</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="50"
|
||||
readonly="true"
|
||||
v-model:value="data.FamilyPerson.PersonId"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'50px'" class="side-label">性别</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-select
|
||||
v-model:value="data.FamilyPerson.Gender"
|
||||
:disabled="!isEdit"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="o in yesNoPolicy"
|
||||
:value="o.BindValue"
|
||||
>{{ o.DisplayName }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'50px'" class="side-label">婚姻</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-select
|
||||
v-model:value="data.FamilyPerson.MaritalStatus"
|
||||
:disabled="!isEdit"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="o in yesNoPolicy"
|
||||
:value="o.BindValue"
|
||||
>{{ o.DisplayName }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'50px'" class="side-label">行第</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="32"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.BirthOrder"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
|
||||
<!-- 右侧表单 -->
|
||||
<a-col :lg="19" :sm="24">
|
||||
<a-row :gutter="[8, 8]">
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">姓氏</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
required
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Surname"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">谱名</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
required
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.GenealogyName"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">常用名</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.CommonName"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">别名</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Alias"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">字</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Zi"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">号</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Hao"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">父亲编号</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="50"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.FatherId"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<!-- 关键::gutter="0" 关闭行的栅格间隙 -->
|
||||
<a-row :wrap="false" align="middle" :gutter="0">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">母亲姓名</div>
|
||||
</a-col>
|
||||
<!-- 去掉这里的 margin‑left!改用 padding-left 在标签div留内边距 -->
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="100"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.MotherName"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">学校</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="256"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.School"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">专业</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="256"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Major"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">学历</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="128"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Education"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">毕业</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-select
|
||||
v-model:value="data.FamilyPerson.GraduationStatus"
|
||||
:disabled="!isEdit"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="o in yesNoPolicy"
|
||||
:value="o.BindValue"
|
||||
>{{ o.DisplayName }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="12">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">职务</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="256"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Duty"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">头衔</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="256"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Title"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="12">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">生于</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="128"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.BirthText"
|
||||
style="border-radius: 0"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :flex="'none'">
|
||||
<a-date-picker
|
||||
:disabled="!isEdit"
|
||||
v-model:value="birthDate"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">离世</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="128"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.DeathText"
|
||||
style="border-radius: 0"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col :flex="'none'">
|
||||
<a-date-picker
|
||||
:disabled="!isEdit"
|
||||
v-model:value="deathDate"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="12">
|
||||
<a-row :wrap="false" align="top" :gutter="0">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag-textarea">简介</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-textarea
|
||||
:auto-size="{ minRows: 10, maxRows: 15 }"
|
||||
:maxlength="3000"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.Introduction"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">公开</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-select
|
||||
v-model:value="data.FamilyPerson.Privacy"
|
||||
:disabled="!isEdit"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="o in yesNoPolicy"
|
||||
:value="o.BindValue"
|
||||
>{{ o.DisplayName }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'80px'">
|
||||
<div class="field-tag">状态</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-select
|
||||
v-model:value="data.FamilyPerson.LiveStatus"
|
||||
:disabled="!isEdit"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="o in yesNoPolicy"
|
||||
:value="o.BindValue"
|
||||
>{{ o.DisplayName }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[8, 8]" style="margin-top: 8px">
|
||||
<a-col :span="6">
|
||||
<a-button
|
||||
block
|
||||
type="primary"
|
||||
ghost
|
||||
:disabled="!isEdit"
|
||||
@click.prevent="
|
||||
data.FamilyPerson.IsBindUser =
|
||||
data.FamilyPerson.IsBindUser === 'Y' ? 'N' : 'Y'
|
||||
"
|
||||
>
|
||||
{{
|
||||
data.FamilyPerson.IsBindUser === "Y" ? "已绑定" : "绑定用户"
|
||||
}}
|
||||
</a-button>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :flex="'70px'">
|
||||
<div class="field-tag">绑定用户ID</div>
|
||||
</a-col>
|
||||
<a-col :flex="'auto'">
|
||||
<a-input
|
||||
:maxlength="50"
|
||||
:readonly="!isEdit"
|
||||
v-model:value="data.FamilyPerson.BindUserId"
|
||||
style="border-radius: 0 2px 2px 0"
|
||||
/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-divider
|
||||
orientation="left"
|
||||
orientation-margin="0px"
|
||||
dashed
|
||||
style="background-color: silver"
|
||||
>
|
||||
</a-divider>
|
||||
</div>
|
||||
<div class="page-footer">
|
||||
<div style="">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="24" :sm="24">
|
||||
<div>
|
||||
<a-row v-if="isEdit" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-popconfirm
|
||||
v-if="data.FamilyPerson.CreatedBy"
|
||||
title="确定是否取消修改?"
|
||||
ok-text="是"
|
||||
cancel-text="否"
|
||||
@confirm="onCancel"
|
||||
>
|
||||
<a-button type="primary" ghost :icon="h(UndoOutlined)"
|
||||
>取消</a-button
|
||||
>
|
||||
</a-popconfirm>
|
||||
<a-button
|
||||
v-if="!data.FamilyPerson.CreatedBy"
|
||||
type="primary"
|
||||
ghost
|
||||
:icon="h(UndoOutlined)"
|
||||
@click.prevent="onCancel"
|
||||
>取消</a-button
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
ghost
|
||||
:icon="h(SaveOutlined)"
|
||||
@click.prevent="onSave"
|
||||
>保存</a-button
|
||||
>
|
||||
</a-space>
|
||||
</a-row>
|
||||
<a-row v-else :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-if="canAmend"
|
||||
:icon="h(EditOutlined)"
|
||||
:disabled="!hasData"
|
||||
@click.prevent="onAmend"
|
||||
>修改</a-button
|
||||
>
|
||||
<a-popconfirm
|
||||
:disabled="!hasData"
|
||||
title="确定是否删除这条记录?"
|
||||
ok-text="是"
|
||||
cancel-text="否"
|
||||
@confirm="onDelete"
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
danger
|
||||
:icon="h(DeleteOutlined)"
|
||||
:disabled="!hasData"
|
||||
v-if="canDelete"
|
||||
>删除</a-button
|
||||
>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<dragModal
|
||||
v-model:open="modelOption.isModalPermission"
|
||||
width="80%"
|
||||
title="人员查询"
|
||||
:mask-closable="false"
|
||||
:fullscreen="width < 640"
|
||||
@ok="handleSelect"
|
||||
>
|
||||
<FamilyPersonEnquiry
|
||||
ref="enquiry"
|
||||
@on-row-dblclick="handleSelect"
|
||||
></FamilyPersonEnquiry>
|
||||
</dragModal>
|
||||
</a-spin>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, unref, onBeforeMount, inject, provide, h, onMounted } from "vue";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
ClearOutlined,
|
||||
FileSearchOutlined,
|
||||
FileAddOutlined,
|
||||
UndoOutlined,
|
||||
SaveOutlined,
|
||||
PlusSquareTwoTone,
|
||||
DownSquareTwoTone,
|
||||
UpSquareTwoTone,
|
||||
UserOutlined,
|
||||
CloseOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
import {
|
||||
PermissionContext,
|
||||
usePermissionContext,
|
||||
} from "@/hooks/PermissionContext";
|
||||
import dragModal from "@/components/basic/DragModal.vue";
|
||||
import FamilyPersonEnquiry from "./FamilyPersonEnquiry.vue";
|
||||
import { FamilyPersonData } from "@/data/auto/familyPersonData";
|
||||
import FamilyPersonService from "@/service/master/familyPersonService";
|
||||
import { useYesNoPolicy } from "@/hooks/useYesNoPolicy";
|
||||
import { SelectOption } from "@/data/auto/selectOption";
|
||||
import { useWindowSize } from "@vueuse/core";
|
||||
import { FamilyPersonEntity } from "@/data/auto/familyPersonEntity";
|
||||
import { BindOption } from "@/data/custom/bindOption";
|
||||
import { nextTick } from "process";
|
||||
import dayjs from "dayjs";
|
||||
import type { Dayjs } from "dayjs";
|
||||
import {
|
||||
operationToEnquiryMethodKey,
|
||||
OperationToEnquiryModelOption,
|
||||
} from "@/injections";
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const { width, height } = useWindowSize();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const personId = ref<string>(route.params.id as string);
|
||||
const mode = ref<string>(route.params.mode as string);
|
||||
|
||||
const isEdit = ref<boolean>(false);
|
||||
const canAmend = ref<boolean>(false);
|
||||
const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
|
||||
const showModalType = ref<number>(0);
|
||||
|
||||
const data = ref<FamilyPersonData>(new FamilyPersonData());
|
||||
const hasData = ref<boolean>(false);
|
||||
|
||||
const yesNoPolicy = ref<SelectOption[]>([]);
|
||||
const birthDate = ref<Dayjs | null>(null);
|
||||
const deathDate = ref<Dayjs | null>(null);
|
||||
const resultH = ref("");
|
||||
const oldPersonId = ref<string>(personId.value);
|
||||
|
||||
interface FamilyPersonEnquiry {
|
||||
keys: FamilyPersonEntity[];
|
||||
setBindOptionValue(
|
||||
bindValue: string,
|
||||
value: string,
|
||||
value1: string,
|
||||
values: string[],
|
||||
): void;
|
||||
}
|
||||
|
||||
const enquiry = ref<FamilyPersonEnquiry | null>(null);
|
||||
|
||||
//================provide================
|
||||
const modelOption = ref<OperationToEnquiryModelOption>(
|
||||
new OperationToEnquiryModelOption(),
|
||||
);
|
||||
modelOption.value.isModalPermission = false;
|
||||
modelOption.value.selectionTypePermission = "radio";
|
||||
modelOption.value.initBindOptionsPermission = [];
|
||||
|
||||
const getOperationToEnquiryModelOption = () => {
|
||||
return modelOption.value;
|
||||
};
|
||||
provide(operationToEnquiryMethodKey, {
|
||||
getOperationToEnquiryModelOption,
|
||||
});
|
||||
|
||||
//================provide================
|
||||
|
||||
onBeforeMount(async () => {
|
||||
yesNoPolicy.value = await useYesNoPolicy().getSelectOption(false);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
let pContext: PermissionContext = usePermissionContext();
|
||||
canAmend.value = pContext.canAmend(route.meta.permission as string);
|
||||
canDelete.value = pContext.canDelete(route.meta.permission as string);
|
||||
canCreate.value = pContext.canCreate(route.meta.permission as string);
|
||||
computResultTableHeight();
|
||||
|
||||
if (personId.value && personId.value.trim().length > 0) {
|
||||
onSearch();
|
||||
}
|
||||
if (mode.value && mode.value == "create") {
|
||||
onCreate();
|
||||
isEdit.value = true;
|
||||
} else if (mode.value && mode.value == "amend") {
|
||||
isEdit.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
const computResultTableHeight = () => {
|
||||
if (width.value > 640) {
|
||||
resultH.value = "calc(100vh - 220px )";
|
||||
} else {
|
||||
resultH.value = "calc(100vh - 250px )";
|
||||
}
|
||||
};
|
||||
|
||||
const onModalSearch = () => {
|
||||
modelOption.value.isModalPermission = true;
|
||||
modelOption.value.selectionTypePermission = "radio";
|
||||
showModalType.value = 0;
|
||||
};
|
||||
|
||||
const onSearch = async () => {
|
||||
if (!personId.value || personId.value.trim().length == 0) {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请输入族员编号",
|
||||
placement: "topRight",
|
||||
});
|
||||
hasData.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
data.value = await FamilyPersonService.FindByKey(personId.value.trim());
|
||||
|
||||
if (data.value.FamilyPerson == null) {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "记录不存在",
|
||||
placement: "topRight",
|
||||
});
|
||||
data.value = new FamilyPersonData();
|
||||
hasData.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
birthDate.value = data.value.FamilyPerson.BirthDate
|
||||
? dayjs(data.value.FamilyPerson.BirthDate)
|
||||
: null;
|
||||
deathDate.value = data.value.FamilyPerson.DeathDate
|
||||
? dayjs(data.value.FamilyPerson.DeathDate)
|
||||
: null;
|
||||
hasData.value = true;
|
||||
};
|
||||
|
||||
const onReset = () => {
|
||||
data.value = new FamilyPersonData();
|
||||
|
||||
personId.value = "";
|
||||
birthDate.value = null;
|
||||
deathDate.value = null;
|
||||
hasData.value = false;
|
||||
};
|
||||
|
||||
const onCreate = () => {
|
||||
onReset();
|
||||
isEdit.value = true;
|
||||
};
|
||||
|
||||
const onAmend = () => {
|
||||
isEdit.value = true;
|
||||
oldPersonId.value = unref(data.value.FamilyPerson.PersonId);
|
||||
};
|
||||
|
||||
const onSave = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
data.value.FamilyPerson.BirthDate = birthDate.value
|
||||
? birthDate.value.toDate()
|
||||
: null!;
|
||||
data.value.FamilyPerson.DeathDate = deathDate.value
|
||||
? deathDate.value.toDate()
|
||||
: null!;
|
||||
|
||||
if (data.value.FamilyPerson?.CreatedBy)
|
||||
data.value = await FamilyPersonService.Update(data.value);
|
||||
else {
|
||||
data.value = await FamilyPersonService.Insert(data.value);
|
||||
}
|
||||
|
||||
personId.value = data.value.FamilyPerson.PersonId;
|
||||
|
||||
loading.value = false;
|
||||
hasData.value = true;
|
||||
isEdit.value = false;
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const onCancel = () => {
|
||||
onReset();
|
||||
if (oldPersonId.value && oldPersonId.value.length > 0) {
|
||||
personId.value = oldPersonId.value;
|
||||
onSearch();
|
||||
}
|
||||
isEdit.value = false;
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
await FamilyPersonService.Delete(data.value.FamilyPerson.PersonId);
|
||||
|
||||
onReset();
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelect = async () => {
|
||||
if (enquiry.value) {
|
||||
if (enquiry.value.keys.length > 0) {
|
||||
//查询弹出
|
||||
if (showModalType.value == 0) {
|
||||
personId.value = enquiry.value.keys[0].PersonId;
|
||||
|
||||
onSearch();
|
||||
}
|
||||
modelOption.value.isModalPermission = false;
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "请选择一条记录",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
.page-container {
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 8px;
|
||||
padding-right: 12px;
|
||||
border-bottom: 1px solid silver;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.page-header .ant-input-search .ant-input {
|
||||
border-radius: 0;
|
||||
border-left: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.page-main {
|
||||
overflow-y: auto;
|
||||
padding-top: 24px;
|
||||
padding-bottom: 4px;
|
||||
padding-right: 32px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.page-footer {
|
||||
z-index: 999;
|
||||
padding-left: 8px;
|
||||
padding-right: 18px;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 8px;
|
||||
border-top: 1px solid silver;
|
||||
}
|
||||
|
||||
.field-tag {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-right: none;
|
||||
border-radius: 2px 0 0 2px;
|
||||
height: 32px;
|
||||
line-height: 30px;
|
||||
padding: 0 4px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.field-tag-textarea {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-right: none;
|
||||
border-radius: 2px 0 0 2px;
|
||||
box-sizing: border-box;
|
||||
min-height: 32px;
|
||||
max-height: 32px; /* 固定标签高度,只显示顶部一小块 */
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 8px 10px 0 10px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.side-label {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
line-height: 32px;
|
||||
padding-right: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.avatar-change-mask {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 120px;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.avatar-close {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: calc(50% - 68px);
|
||||
}
|
||||
</style>
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user