diff --git a/.gitignore b/.gitignore index a02065b..403e529 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,8 @@ /CloudBuilderLauncher/bin /CloudBuilderLauncher/obj /.vs +/CloudBuilder.AI/.vs +/CloudBuilder.AI/bin +/CloudBuilder.AI/obj +/CloudBuilder.AI.Service/bin +/CloudBuilder.AI.Service/obj diff --git a/CloudBuilder.AI.Service/AiBookPersonService.auto.cs b/CloudBuilder.AI.Service/AiBookPersonService.auto.cs new file mode 100644 index 0000000..61d558a --- /dev/null +++ b/CloudBuilder.AI.Service/AiBookPersonService.auto.cs @@ -0,0 +1,61 @@ +using CloudBuilder.Core.DatabaseAccessor.Entity; +using Microsoft.AspNetCore.Authorization; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +namespace CloudBuilder.AI.Service +{ + public class AiBookPersonService : IAiBookPersonService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiBookPersonService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Find)] + public AiBookPersonEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + + //[PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Find)] + public dynamic FindBySearchCriteria(AiBookPersonSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiBookPersonSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Insert)] + [UnitOfWork] + public AiBookPersonEntity Insert(AiBookPersonEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Update)] + [UnitOfWork] + public AiBookPersonEntity Update(AiBookPersonEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiBookPerson, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent= repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + } +} diff --git a/CloudBuilder.AI.Service/AiBookService.auto.cs b/CloudBuilder.AI.Service/AiBookService.auto.cs new file mode 100644 index 0000000..d5b8b78 --- /dev/null +++ b/CloudBuilder.AI.Service/AiBookService.auto.cs @@ -0,0 +1,87 @@ +using CloudBuilder.AI.Data; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using CloudBuilder.Core.Service; +using CloudBuilder.Security.Entity; +using Microsoft.AspNetCore.Authorization; +namespace CloudBuilder.AI.Service +{ + public class AiBookService : IAiBookService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiBookService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] + public AiBookEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] + public AiBookEntity FindByTitle(string title) + { + return repository.DetachedEntities.Where(x => x.Title == title).FirstOrDefault()!; + } + + //[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] + public dynamic FindBySearchCriteria(AiBookSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiBookSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)] + [UnitOfWork] + public AiBookEntity Insert(AiBookEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Insert)] + [UnitOfWork] + public void Insert(AiBookData data) + { + AiBookEntity entity = repository.DetachedEntities.Where(x => x.Title == data.AiBook.Title).FirstOrDefault(); + if (entity != null) + { + throw new ValidatedException("记录已存在."); + } + + repository.InsertNow(data.AiBook); + + IRepository repositoryAiChapterEntity = repository.GetRepository>(); + repositoryAiChapterEntity.InsertNow(data.AiChapters); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)] + [UnitOfWork] + public AiBookEntity Update(AiBookEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent = repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + + + } +} diff --git a/CloudBuilder.AI.Service/AiChapterPersonService.auto.cs b/CloudBuilder.AI.Service/AiChapterPersonService.auto.cs new file mode 100644 index 0000000..7cd9334 --- /dev/null +++ b/CloudBuilder.AI.Service/AiChapterPersonService.auto.cs @@ -0,0 +1,61 @@ +using CloudBuilder.Core.DatabaseAccessor.Entity; +using Microsoft.AspNetCore.Authorization; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +namespace CloudBuilder.AI.Service +{ + public class AiChapterPersonService : IAiChapterPersonService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiChapterPersonService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Find)] + public AiChapterPersonEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + + //[PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Find)] + public dynamic FindBySearchCriteria(AiChapterPersonSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiChapterPersonSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Insert)] + [UnitOfWork] + public AiChapterPersonEntity Insert(AiChapterPersonEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Update)] + [UnitOfWork] + public AiChapterPersonEntity Update(AiChapterPersonEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiChapterPerson, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent= repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + } +} diff --git a/CloudBuilder.AI.Service/AiChapterService.auto.cs b/CloudBuilder.AI.Service/AiChapterService.auto.cs new file mode 100644 index 0000000..c793599 --- /dev/null +++ b/CloudBuilder.AI.Service/AiChapterService.auto.cs @@ -0,0 +1,72 @@ +using CloudBuilder.Core.DatabaseAccessor.Entity; +using Microsoft.AspNetCore.Authorization; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +namespace CloudBuilder.AI.Service +{ + public class AiChapterService : IAiChapterService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiChapterService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Find)] + public AiChapterEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Find)] + public AiChapterEntity[] FindByTitle(string title) + { + + IRepository repositoryAiBookEntity = repository.GetRepository>(); + AiBookEntity aiBookEntity = repositoryAiBookEntity.DetachedEntities.Where(x => x.Title == title).FirstOrDefault()!; + if (aiBookEntity == null) return null; + + return repository.DetachedEntities.Where(x => x.BookGuid == aiBookEntity.Guid).ToArray(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Find)] + public dynamic FindBySearchCriteria(AiChapterSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiChapterSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Insert)] + [UnitOfWork] + public AiChapterEntity Insert(AiChapterEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Update)] + [UnitOfWork] + public AiChapterEntity Update(AiChapterEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiChapter, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent = repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + } +} diff --git a/CloudBuilder.AI.Service/AiParagraphService.auto.cs b/CloudBuilder.AI.Service/AiParagraphService.auto.cs new file mode 100644 index 0000000..4e3945c --- /dev/null +++ b/CloudBuilder.AI.Service/AiParagraphService.auto.cs @@ -0,0 +1,68 @@ +using CloudBuilder.Core.DatabaseAccessor.Entity; +using Microsoft.AspNetCore.Authorization; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +namespace CloudBuilder.AI.Service +{ + public class AiParagraphService : IAiParagraphService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiParagraphService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Find)] + public AiParagraphEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + + //[PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Find)] + public dynamic FindBySearchCriteria(AiParagraphSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + //[PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiParagraphSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Insert)] + [UnitOfWork] + public AiParagraphEntity Insert(AiParagraphEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Insert)] + [UnitOfWork] + public void Inserts(AiParagraphEntity[] datas) + { + repository.InsertNow(datas); + } + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Update)] + [UnitOfWork] + public AiParagraphEntity Update(AiParagraphEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent= repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + } +} diff --git a/CloudBuilder.AI.Service/AiSentenceService.auto.cs b/CloudBuilder.AI.Service/AiSentenceService.auto.cs new file mode 100644 index 0000000..7252b82 --- /dev/null +++ b/CloudBuilder.AI.Service/AiSentenceService.auto.cs @@ -0,0 +1,111 @@ +using CloudBuilder.AI.Data; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.Policy; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using CloudBuilder.Core.Service; +using CloudBuilder.Security.Data; +using CloudBuilder.Security.Entity; +using Microsoft.AspNetCore.Authorization; +namespace CloudBuilder.AI.Service +{ + public class AiSentenceService : IAiSentenceService + { + private readonly IApplicationService service; + + private IRepository repository; + public AiSentenceService(IApplicationService service) + { + this.service = service; + repository = service.GetRepository>(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Find)] + public AiSentenceEntity FindByKey(string key) + { + return repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + } + + [PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Find)] + public AiSentenceViewEntityResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria) + { + AiSentenceViewEntityResultData data = new AiSentenceViewEntityResultData(); + AiSentenceViewEntity[] list = null; + IRepository repositoryAiSentenceViewEntity = repository.GetRepository>(); + + int count = 0; + + string sqlWhere = null; + + if (criteria.Filter != null && criteria.Filter.Length > 0) + { + sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter); + } + + AiSentenceViewEntity entity = AiSentenceViewEntity.GetInstance(); + string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere); + + string err = null; + try + { + list = repositoryAiSentenceViewEntity.FromSql(sql).ToArray(); + } + catch (System.Exception ex) + { + err = ex.Message; + } + + + if (list != null && list.Length > 0) + { + sql = entity.GetSelectCountFrom(sqlWhere); + count = (int)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: AIPermissionPolicy.AiSentence, operate: Operate.Print)] + public dynamic PrintBySearchCriteria(AiSentenceSearchCriteria criteria) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Insert)] + [UnitOfWork] + public AiSentenceEntity Insert(AiSentenceEntity data) + { + throw new NotImplementedException(); + } + + [PermissionOperate(name: AIPermissionPolicy.AiParagraph, operate: Operate.Insert)] + [UnitOfWork] + public void Inserts(AiSentenceEntity[] datas) + { + repository.InsertNow(datas); + } + + [PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Update)] + [UnitOfWork] + public AiSentenceEntity Update(AiSentenceEntity data) + { + throw new NotImplementedException(); + } + + + [PermissionOperate(name: AIPermissionPolicy.AiSentence, operate: Operate.Delete)] + [UnitOfWork] + public void Delete(string key) + { + var ent= repository.DetachedEntities.Where(x => x.Guid == key).FirstOrDefault()!; + if (ent != null) { repository.DeleteNow(ent); } + } + } +} diff --git a/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj b/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj new file mode 100644 index 0000000..11dd5b4 --- /dev/null +++ b/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj @@ -0,0 +1,47 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\CloudBuilder.AI\bin\Debug\net8.0\CloudBuilder.AI.dll + + + ..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll + + + ..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll + + + + + + + diff --git a/CloudBuilder.AI/CloudBuilder.AI.csproj b/CloudBuilder.AI/CloudBuilder.AI.csproj new file mode 100644 index 0000000..3438821 --- /dev/null +++ b/CloudBuilder.AI/CloudBuilder.AI.csproj @@ -0,0 +1,52 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll + + + ..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll + + + + + + + + + + + diff --git a/CloudBuilder.AI/Data/AiBookData.cs b/CloudBuilder.AI/Data/AiBookData.cs new file mode 100644 index 0000000..f81ed44 --- /dev/null +++ b/CloudBuilder.AI/Data/AiBookData.cs @@ -0,0 +1,19 @@ +using CloudBuilder.AI.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.AI.Data +{ + public class AiBookData + { + public AiBookData() { } + public AiBookEntity AiBook { get; set; } + public AiChapterEntity[]? AiChapters { get; set; } + public AiBookPersonEntity[]? AiBookPersons { get; set; } + public AiParagraphEntity[]? AiParagraphs { get; set; } + public AiSentenceEntity[]? AiSentences { get; set; } + } +} diff --git a/CloudBuilder.AI/Data/AiSentenceViewEntityResultData.cs b/CloudBuilder.AI/Data/AiSentenceViewEntityResultData.cs new file mode 100644 index 0000000..e7254db --- /dev/null +++ b/CloudBuilder.AI/Data/AiSentenceViewEntityResultData.cs @@ -0,0 +1,18 @@ +using CloudBuilder.AI.Entity; +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +using CloudBuilder.Security.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.AI.Data +{ + [TypeScript] + public class AiSentenceViewEntityResultData : SearchCriteriaResultData + { + public AiSentenceViewEntity[]? Datas { get; set; } + } +} diff --git a/CloudBuilder.AI/Entity/AiBookEntity.auto.cs b/CloudBuilder.AI/Entity/AiBookEntity.auto.cs new file mode 100644 index 0000000..0fa3871 --- /dev/null +++ b/CloudBuilder.AI/Entity/AiBookEntity.auto.cs @@ -0,0 +1,133 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_book")] + public class AiBookEntity : EntityBase + { + + public AiBookEntity() + { + } + + [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("guid")] + public string Guid { get; set; } + [Column("title")] + public string Title { get; set; } + [Column("author")] + public string? Author { get; set; } + [Column("description")] + public string? Description { get; set; } + [Column("book_type")] + public string? BookType { get; set; } + [Column("file_path")] + public string? FilePath { get; set; } + [Column("status")] + public string Status { 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 GUID = "Guid"; + public const string TITLE = "Title"; + public const string AUTHOR = "Author"; + public const string DESCRIPTION = "Description"; + public const string BOOK_TYPE = "BookType"; + public const string FILE_PATH = "FilePath"; + public const string STATUS = "Status"; + + public const string DB_NAME_AI_BOOK = "ai_book"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,title,author,description,book_type,file_path,status"; + + 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_GUID = "guid"; + public const string DB_TITLE = "title"; + public const string DB_AUTHOR = "author"; + public const string DB_DESCRIPTION = "description"; + public const string DB_BOOK_TYPE = "book_type"; + public const string DB_FILE_PATH = "file_path"; + public const string DB_STATUS = "status"; + + + public static AiBookEntity GetInstance() + { + return new AiBookEntity(); + } + + public virtual void CopyFrom(AiBookEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiBookEntity 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.Guid = source.Guid; + this.Title = source.Title; + this.Author = source.Author; + this.Description = source.Description; + this.BookType = source.BookType; + this.FilePath = source.FilePath; + this.Status = source.Status; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_BOOK} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_BOOK} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_BOOK} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiBookEntity Clone() + { + AiBookEntity result = new AiBookEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiBookPersonEntity.auto.cs b/CloudBuilder.AI/Entity/AiBookPersonEntity.auto.cs new file mode 100644 index 0000000..79bdd6f --- /dev/null +++ b/CloudBuilder.AI/Entity/AiBookPersonEntity.auto.cs @@ -0,0 +1,138 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_book_person")] + public class AiBookPersonEntity : EntityBase + { + + public AiBookPersonEntity() + { + } + + [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("guid")] + public string Guid { get; set; } + [Column("book_guid")] + public string BookGuid { get; set; } + [Column("person_name")] + public string PersonName { get; set; } + [Column("actor_name")] + public string? ActorName { get; set; } + [Column("gender")] + public string? Gender { get; set; } + [Column("sentiment")] + public string? Sentiment { get; set; } + [Column("sound_file_path")] + public string? SoundFilePath { get; set; } + [Column("status")] + public string? Status { 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 GUID = "Guid"; + public const string BOOK_GUID = "BookGuid"; + public const string PERSON_NAME = "PersonName"; + public const string ACTOR_NAME = "ActorName"; + public const string GENDER = "Gender"; + public const string SENTIMENT = "Sentiment"; + public const string SOUND_FILE_PATH = "SoundFilePath"; + public const string STATUS = "Status"; + + public const string DB_NAME_AI_BOOK_PERSON = "ai_book_person"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,book_guid,person_name,actor_name,gender,sentiment,sound_file_path,status"; + + 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_GUID = "guid"; + public const string DB_BOOK_GUID = "book_guid"; + public const string DB_PERSON_NAME = "person_name"; + public const string DB_ACTOR_NAME = "actor_name"; + public const string DB_GENDER = "gender"; + public const string DB_SENTIMENT = "sentiment"; + public const string DB_SOUND_FILE_PATH = "sound_file_path"; + public const string DB_STATUS = "status"; + + + public static AiBookPersonEntity GetInstance() + { + return new AiBookPersonEntity(); + } + + public virtual void CopyFrom(AiBookPersonEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiBookPersonEntity 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.Guid = source.Guid; + this.BookGuid = source.BookGuid; + this.PersonName = source.PersonName; + this.ActorName = source.ActorName; + this.Gender = source.Gender; + this.Sentiment = source.Sentiment; + this.SoundFilePath = source.SoundFilePath; + this.Status = source.Status; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_BOOK_PERSON} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_BOOK_PERSON} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_BOOK_PERSON} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiBookPersonEntity Clone() + { + AiBookPersonEntity result = new AiBookPersonEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiChapterEntity.auto.cs b/CloudBuilder.AI/Entity/AiChapterEntity.auto.cs new file mode 100644 index 0000000..e8dbe48 --- /dev/null +++ b/CloudBuilder.AI/Entity/AiChapterEntity.auto.cs @@ -0,0 +1,128 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_chapter")] + public class AiChapterEntity : EntityBase + { + + public AiChapterEntity() + { + } + + [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("guid")] + public string Guid { get; set; } + [Column("book_guid")] + public string BookGuid { get; set; } + [Column("chapter_index")] + public int ChapterIndex { get; set; } + [Column("title")] + public string Title { get; set; } + [Column("content")] + public string Content { get; set; } + [Column("status")] + public string Status { 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 GUID = "Guid"; + public const string BOOK_GUID = "BookGuid"; + public const string CHAPTER_INDEX = "ChapterIndex"; + public const string TITLE = "Title"; + public const string CONTENT = "Content"; + public const string STATUS = "Status"; + + public const string DB_NAME_AI_CHAPTER = "ai_chapter"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,book_guid,chapter_index,title,content,status"; + + 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_GUID = "guid"; + public const string DB_BOOK_GUID = "book_guid"; + public const string DB_CHAPTER_INDEX = "chapter_index"; + public const string DB_TITLE = "title"; + public const string DB_CONTENT = "content"; + public const string DB_STATUS = "status"; + + + public static AiChapterEntity GetInstance() + { + return new AiChapterEntity(); + } + + public virtual void CopyFrom(AiChapterEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiChapterEntity 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.Guid = source.Guid; + this.BookGuid = source.BookGuid; + this.ChapterIndex = source.ChapterIndex; + this.Title = source.Title; + this.Content = source.Content; + this.Status = source.Status; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_CHAPTER} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_CHAPTER} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_CHAPTER} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiChapterEntity Clone() + { + AiChapterEntity result = new AiChapterEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs b/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs new file mode 100644 index 0000000..28567df --- /dev/null +++ b/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs @@ -0,0 +1,118 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_chapter_person")] + public class AiChapterPersonEntity : EntityBase + { + + public AiChapterPersonEntity() + { + } + + [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("guid")] + public string Guid { get; set; } + [Column("chapter_guid")] + public string ChapterGuid { get; set; } + [Column("person_name")] + public string PersonName { get; set; } + [Column("person_mapping")] + public string PersonMapping { 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 GUID = "Guid"; + public const string CHAPTER_GUID = "ChapterGuid"; + public const string PERSON_NAME = "PersonName"; + public const string PERSON_MAPPING = "PersonMapping"; + + public const string DB_NAME_AI_CHAPTER_PERSON = "ai_chapter_person"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,chapter_guid,person_name,person_mapping"; + + 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_GUID = "guid"; + public const string DB_CHAPTER_GUID = "chapter_guid"; + public const string DB_PERSON_NAME = "person_name"; + public const string DB_PERSON_MAPPING = "person_mapping"; + + + public static AiChapterPersonEntity GetInstance() + { + return new AiChapterPersonEntity(); + } + + public virtual void CopyFrom(AiChapterPersonEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiChapterPersonEntity 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.Guid = source.Guid; + this.ChapterGuid = source.ChapterGuid; + this.PersonName = source.PersonName; + this.PersonMapping = source.PersonMapping; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_CHAPTER_PERSON} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_CHAPTER_PERSON} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_CHAPTER_PERSON} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiChapterPersonEntity Clone() + { + AiChapterPersonEntity result = new AiChapterPersonEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiParagraphEntity.auto.cs b/CloudBuilder.AI/Entity/AiParagraphEntity.auto.cs new file mode 100644 index 0000000..74ec9b0 --- /dev/null +++ b/CloudBuilder.AI/Entity/AiParagraphEntity.auto.cs @@ -0,0 +1,123 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_paragraph")] + public class AiParagraphEntity : EntityBase + { + + public AiParagraphEntity() + { + } + + [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("guid")] + public string Guid { get; set; } + [Column("chapter_guid")] + public string ChapterGuid { get; set; } + [Column("paragraph_index")] + public int ParagraphIndex { get; set; } + [Column("content")] + public string Content { get; set; } + [Column("dialogue_indc")] + public string? DialogueIndc { 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 GUID = "Guid"; + public const string CHAPTER_GUID = "ChapterGuid"; + public const string PARAGRAPH_INDEX = "ParagraphIndex"; + public const string CONTENT = "Content"; + public const string DIALOGUE_INDC = "DialogueIndc"; + + public const string DB_NAME_AI_PARAGRAPH = "ai_paragraph"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,chapter_guid,paragraph_index,content,dialogue_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_GUID = "guid"; + public const string DB_CHAPTER_GUID = "chapter_guid"; + public const string DB_PARAGRAPH_INDEX = "paragraph_index"; + public const string DB_CONTENT = "content"; + public const string DB_DIALOGUE_INDC = "dialogue_indc"; + + + public static AiParagraphEntity GetInstance() + { + return new AiParagraphEntity(); + } + + public virtual void CopyFrom(AiParagraphEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiParagraphEntity 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.Guid = source.Guid; + this.ChapterGuid = source.ChapterGuid; + this.ParagraphIndex = source.ParagraphIndex; + this.Content = source.Content; + this.DialogueIndc = source.DialogueIndc; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_PARAGRAPH} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_PARAGRAPH} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_PARAGRAPH} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiParagraphEntity Clone() + { + AiParagraphEntity result = new AiParagraphEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiSentenceEntity.auto.cs b/CloudBuilder.AI/Entity/AiSentenceEntity.auto.cs new file mode 100644 index 0000000..ab6fe33 --- /dev/null +++ b/CloudBuilder.AI/Entity/AiSentenceEntity.auto.cs @@ -0,0 +1,143 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_sentence")] + public class AiSentenceEntity : EntityBase + { + + public AiSentenceEntity() + { + } + + [Column("person_name")] + public string? PersonName { get; set; } + [Column("gender")] + public string? Gender { get; set; } + [Column("sentiment")] + public string? Sentiment { get; set; } + [Column("content")] + public string Content { get; set; } + [Column("status")] + public string? Status { get; set; } + [Column("updated_datetime")] + public DateTime UpdatedDatetime { get; set; } + [Column("updated_by")] + public string UpdatedBy { get; set; } + [Key] + [Column("guid")] + public string Guid { get; set; } + [Column("paragraph_guid")] + public string ParagraphGuid { get; set; } + [Column("sentence_index")] + public int SentenceIndex { get; set; } + [Column("dialogue_indc")] + public string DialogueIndc { get; set; } + [Column("created_datetime")] + public DateTime CreatedDatetime { get; set; } + [Column("created_by")] + public string CreatedBy { get; set; } + + public const string PERSON_NAME = "PersonName"; + public const string GENDER = "Gender"; + public const string SENTIMENT = "Sentiment"; + public const string CONTENT = "Content"; + public const string STATUS = "Status"; + public const string UPDATED_DATETIME = "UpdatedDatetime"; + public const string UPDATED_BY = "UpdatedBy"; + public const string GUID = "Guid"; + public const string PARAGRAPH_GUID = "ParagraphGuid"; + public const string SENTENCE_INDEX = "SentenceIndex"; + public const string DIALOGUE_INDC = "DialogueIndc"; + public const string CREATED_DATETIME = "CreatedDatetime"; + public const string CREATED_BY = "CreatedBy"; + + public const string DB_NAME_AI_SENTENCE = "ai_sentence"; + public const string DB_NAME_FIELDS="person_name,gender,sentiment,content,status,updated_datetime,updated_by,guid,paragraph_guid,sentence_index,dialogue_indc,created_datetime,created_by"; + + public const string DB_PERSON_NAME = "person_name"; + public const string DB_GENDER = "gender"; + public const string DB_SENTIMENT = "sentiment"; + public const string DB_CONTENT = "content"; + public const string DB_STATUS = "status"; + public const string DB_UPDATED_DATETIME = "updated_datetime"; + public const string DB_UPDATED_BY = "updated_by"; + public const string DB_GUID = "guid"; + public const string DB_PARAGRAPH_GUID = "paragraph_guid"; + public const string DB_SENTENCE_INDEX = "sentence_index"; + public const string DB_DIALOGUE_INDC = "dialogue_indc"; + public const string DB_CREATED_DATETIME = "created_datetime"; + public const string DB_CREATED_BY = "created_by"; + + + public static AiSentenceEntity GetInstance() + { + return new AiSentenceEntity(); + } + + public virtual void CopyFrom(AiSentenceEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiSentenceEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.PersonName = source.PersonName; + this.Gender = source.Gender; + this.Sentiment = source.Sentiment; + this.Content = source.Content; + this.Status = source.Status; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.Guid = source.Guid; + this.ParagraphGuid = source.ParagraphGuid; + this.SentenceIndex = source.SentenceIndex; + this.DialogueIndc = source.DialogueIndc; + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + + if (includeSystemFields) + { + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_SENTENCE} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_SENTENCE} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_GUID ; + 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_AI_SENTENCE} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiSentenceEntity Clone() + { + AiSentenceEntity result = new AiSentenceEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/AiSentenceViewEntity.auto.cs b/CloudBuilder.AI/Entity/AiSentenceViewEntity.auto.cs new file mode 100644 index 0000000..c7781c8 --- /dev/null +++ b/CloudBuilder.AI/Entity/AiSentenceViewEntity.auto.cs @@ -0,0 +1,152 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.DatabaseAccessor.Entity; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace CloudBuilder.AI.Entity + { + [TypeScript] + [Table("ai_sentence_view")] + public class AiSentenceViewEntity : ViewEntityBase + { + + public AiSentenceViewEntity() + { + } + + [Column("chapter_guid")] + public string? ChapterGuid { get; set; } + [Column("paragraph_index")] + public int ParagraphIndex { get; set; } + [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("sentiment")] + public string? Sentiment { get; set; } + [Column("content")] + public string Content { get; set; } + [Column("status")] + public string? Status { get; set; } + [Column("guid")] + public string Guid { get; set; } + [Column("paragraph_guid")] + public string ParagraphGuid { get; set; } + [Column("sentence_index")] + public int SentenceIndex { get; set; } + [Column("dialogue_indc")] + public string DialogueIndc { get; set; } + [Column("person_name")] + public string? PersonName { get; set; } + [Column("gender")] + public string? Gender { get; set; } + + public const string CHAPTER_GUID = "ChapterGuid"; + public const string PARAGRAPH_INDEX = "ParagraphIndex"; + 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 SENTIMENT = "Sentiment"; + public const string CONTENT = "Content"; + public const string STATUS = "Status"; + public const string GUID = "Guid"; + public const string PARAGRAPH_GUID = "ParagraphGuid"; + public const string SENTENCE_INDEX = "SentenceIndex"; + public const string DIALOGUE_INDC = "DialogueIndc"; + public const string PERSON_NAME = "PersonName"; + public const string GENDER = "Gender"; + + public const string DB_NAME_AI_SENTENCE_VIEW = "ai_sentence_view"; + public const string DB_NAME_FIELDS="chapter_guid,paragraph_index,created_datetime,created_by,updated_datetime,updated_by,sentiment,content,status,guid,paragraph_guid,sentence_index,dialogue_indc,person_name,gender"; + + public const string DB_CHAPTER_GUID = "chapter_guid"; + public const string DB_PARAGRAPH_INDEX = "paragraph_index"; + 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_SENTIMENT = "sentiment"; + public const string DB_CONTENT = "content"; + public const string DB_STATUS = "status"; + public const string DB_GUID = "guid"; + public const string DB_PARAGRAPH_GUID = "paragraph_guid"; + public const string DB_SENTENCE_INDEX = "sentence_index"; + public const string DB_DIALOGUE_INDC = "dialogue_indc"; + public const string DB_PERSON_NAME = "person_name"; + public const string DB_GENDER = "gender"; + + + public static AiSentenceViewEntity GetInstance() + { + return new AiSentenceViewEntity(); + } + + public virtual void CopyFrom(AiSentenceViewEntity source) + { + CopyFrom(source, true); + } + + public virtual void CopyFrom(AiSentenceViewEntity source, bool includeSystemFields) + { + if (source == null) + { + throw new NullReferenceException("Source entity is null."); + } + + this.ChapterGuid = source.ChapterGuid; + this.ParagraphIndex = source.ParagraphIndex; + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + this.Sentiment = source.Sentiment; + this.Content = source.Content; + this.Status = source.Status; + this.Guid = source.Guid; + this.ParagraphGuid = source.ParagraphGuid; + this.SentenceIndex = source.SentenceIndex; + this.DialogueIndc = source.DialogueIndc; + this.PersonName = source.PersonName; + this.Gender = source.Gender; + + if (includeSystemFields) + { + this.CreatedDatetime = source.CreatedDatetime; + this.CreatedBy = source.CreatedBy; + this.UpdatedDatetime = source.UpdatedDatetime; + this.UpdatedBy = source.UpdatedBy; + } + } + + public override string GetSelectFrom() + { + return $" select {DB_NAME_FIELDS} from { DB_NAME_AI_SENTENCE_VIEW} with(nolock) "; + } + + public override string GetSelectCountFrom(string sqlWhere) + { + return $" select count(*) from { DB_NAME_AI_SENTENCE_VIEW} with(nolock) where 1=1 {sqlWhere}"; + } + + public override string GetSelectTopFrom(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_CHAPTER_GUID ; 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_AI_SENTENCE_VIEW} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}"; + } + + public AiSentenceViewEntity Clone() + { + AiSentenceViewEntity result = new AiSentenceViewEntity(); + result.CopyFrom(this); + + return result; + } + + } +} diff --git a/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs b/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs new file mode 100644 index 0000000..b51740a --- /dev/null +++ b/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs @@ -0,0 +1,43 @@ +using CloudBuilder.Core.DependencyInjection.EFCore; +using Microsoft.EntityFrameworkCore; +using System.Reflection; + +namespace CloudBuilder.AI.Entity +{ + public class CloudBuilderAIRegistEntity : IMasterRegistEntityType + { + /// + ///注入模块内的所有实体类 + /// + /// + public void RegistEntity(ModelBuilder builder) + { + string _assemblyName = Assembly.GetExecutingAssembly().GetName().Name; + //注入所有Entity实体类 + AddEntityType(builder, _assemblyName); + //如果Entity实体类不是单一主键,要单独重写注入 + RegistKeys(builder); + } + + public void AddEntityType(ModelBuilder builder, string _assemblyName) + { + RegistEntityHelper.AddMasterEntityType(builder, _assemblyName); + } + + /// + ///如果存在多个主键的,要在RegistKeys方法注入 + ///builder.Entity().HasKey(c => new { c.TableName, c.FieldName }); + ///builder.Entity(eb => { eb.HasNoKey(); }); + /// + /// + public void RegistKeys(ModelBuilder builder) + { + //***BEGIN*** + + + builder.Entity(eb => { eb.HasNoKey(); }); + //***END*** + } + } +} + diff --git a/CloudBuilder.AI/Policy/AIPermissionPolicy.auto.cs b/CloudBuilder.AI/Policy/AIPermissionPolicy.auto.cs new file mode 100644 index 0000000..9c40448 --- /dev/null +++ b/CloudBuilder.AI/Policy/AIPermissionPolicy.auto.cs @@ -0,0 +1,16 @@ +namespace CloudBuilder.AI.Policy +{ + public partial class AIPermissionPolicy + { + //***BEGIN*** + public const string AiCharacter = "AiCharacter"; + public const string AiSentence = "AiSentence"; + public const string AiWord = "AiWord"; + public const string AiBook = "AiBook"; + public const string AiBookPerson = "AiBookPerson"; + public const string AiChapter = "AiChapter"; + public const string AiChapterPerson = "AiChapterPerson"; + public const string AiParagraph = "AiParagraph"; + //***END*** + } +} \ No newline at end of file diff --git a/CloudBuilder.AI/Policy/BookStatusPolicy.cs b/CloudBuilder.AI/Policy/BookStatusPolicy.cs new file mode 100644 index 0000000..ab8d2f2 --- /dev/null +++ b/CloudBuilder.AI/Policy/BookStatusPolicy.cs @@ -0,0 +1,28 @@ +using CloudBuilder.Core.DependencyInjection.Policy; +using CloudBuilder.Core.DependencyInjection.Request; +using CloudBuilder.Core.Policy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.AI.Policy +{ + public class BookStatusPolicy : LocalePolicy, IPolicy + { + public const string SUBMIT = "S";//待提交 + + + private readonly IContext context; + private readonly ILocaleMessageManager localeMessageManager; + + public BookStatusPolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager) + { + this.context = context; + this.localeMessageManager = localeMessageManager; + + this.Name = typeof(BookStatusPolicy).Name; + } + } +} diff --git a/CloudBuilder.AI/Policy/ChapterStatusPolicy.cs b/CloudBuilder.AI/Policy/ChapterStatusPolicy.cs new file mode 100644 index 0000000..18c887f --- /dev/null +++ b/CloudBuilder.AI/Policy/ChapterStatusPolicy.cs @@ -0,0 +1,29 @@ +using CloudBuilder.Core.DependencyInjection.Policy; +using CloudBuilder.Core.DependencyInjection.Request; +using CloudBuilder.Core.Policy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudBuilder.AI.Policy +{ + + public class ChapterStatusPolicy : LocalePolicy, IPolicy + { + public const string PROCESS = "P";//处理中 + + + private readonly IContext context; + private readonly ILocaleMessageManager localeMessageManager; + + public ChapterStatusPolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager) + { + this.context = context; + this.localeMessageManager = localeMessageManager; + + this.Name = typeof(BookStatusPolicy).Name; + } + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiBookPersonSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiBookPersonSearchCriteria.auto.cs new file mode 100644 index 0000000..9478038 --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiBookPersonSearchCriteria.auto.cs @@ -0,0 +1,10 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiBookPersonSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiBookSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiBookSearchCriteria.auto.cs new file mode 100644 index 0000000..0046d19 --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiBookSearchCriteria.auto.cs @@ -0,0 +1,10 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiBookSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiChapterPersonSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiChapterPersonSearchCriteria.auto.cs new file mode 100644 index 0000000..65a321f --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiChapterPersonSearchCriteria.auto.cs @@ -0,0 +1,10 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiChapterPersonSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiChapterSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiChapterSearchCriteria.auto.cs new file mode 100644 index 0000000..5813456 --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiChapterSearchCriteria.auto.cs @@ -0,0 +1,10 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiChapterSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiParagraphSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiParagraphSearchCriteria.auto.cs new file mode 100644 index 0000000..8eade85 --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiParagraphSearchCriteria.auto.cs @@ -0,0 +1,10 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiParagraphSearchCriteria: AbstractSearchCriteria + { + + } +} diff --git a/CloudBuilder.AI/SearchCriteria/AiSentenceSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/AiSentenceSearchCriteria.auto.cs new file mode 100644 index 0000000..7ab4629 --- /dev/null +++ b/CloudBuilder.AI/SearchCriteria/AiSentenceSearchCriteria.auto.cs @@ -0,0 +1,9 @@ +using CloudBuilder.Core.Authorization; +using CloudBuilder.Core.Service; +namespace CloudBuilder.AI.SearchCriteria +{ + [TypeScript] + public class AiSentenceSearchCriteria: AbstractSearchCriteria + { + } +} diff --git a/CloudBuilder.AI/Service/IAiBookPersonService.auto.cs b/CloudBuilder.AI/Service/IAiBookPersonService.auto.cs new file mode 100644 index 0000000..efee107 --- /dev/null +++ b/CloudBuilder.AI/Service/IAiBookPersonService.auto.cs @@ -0,0 +1,11 @@ + +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiBookPersonService :IServiceBase + { + } +} diff --git a/CloudBuilder.AI/Service/IAiBookService.auto.cs b/CloudBuilder.AI/Service/IAiBookService.auto.cs new file mode 100644 index 0000000..0be268e --- /dev/null +++ b/CloudBuilder.AI/Service/IAiBookService.auto.cs @@ -0,0 +1,14 @@ + +using CloudBuilder.AI.Data; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiBookService : IServiceBase + { + AiBookEntity FindByTitle(string title); + void Insert(AiBookData data); + } +} diff --git a/CloudBuilder.AI/Service/IAiChapterPersonService.auto.cs b/CloudBuilder.AI/Service/IAiChapterPersonService.auto.cs new file mode 100644 index 0000000..733a290 --- /dev/null +++ b/CloudBuilder.AI/Service/IAiChapterPersonService.auto.cs @@ -0,0 +1,11 @@ + +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiChapterPersonService :IServiceBase + { + } +} diff --git a/CloudBuilder.AI/Service/IAiChapterService.auto.cs b/CloudBuilder.AI/Service/IAiChapterService.auto.cs new file mode 100644 index 0000000..a2bd4db --- /dev/null +++ b/CloudBuilder.AI/Service/IAiChapterService.auto.cs @@ -0,0 +1,12 @@ + +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiChapterService :IServiceBase + { + AiChapterEntity[] FindByTitle(string title); + } +} diff --git a/CloudBuilder.AI/Service/IAiParagraphService.auto.cs b/CloudBuilder.AI/Service/IAiParagraphService.auto.cs new file mode 100644 index 0000000..df39329 --- /dev/null +++ b/CloudBuilder.AI/Service/IAiParagraphService.auto.cs @@ -0,0 +1,13 @@ + +using CloudBuilder.AI.Data; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiParagraphService :IServiceBase + { + void Inserts(AiParagraphEntity[] datas); + } +} diff --git a/CloudBuilder.AI/Service/IAiSentenceService.auto.cs b/CloudBuilder.AI/Service/IAiSentenceService.auto.cs new file mode 100644 index 0000000..0c25a21 --- /dev/null +++ b/CloudBuilder.AI/Service/IAiSentenceService.auto.cs @@ -0,0 +1,14 @@ + +using CloudBuilder.AI.Data; +using CloudBuilder.AI.Entity; +using CloudBuilder.AI.SearchCriteria; +using CloudBuilder.Core.Service; + +namespace CloudBuilder.AI.Service +{ + public interface IAiSentenceService :IServiceBase + { + AiSentenceViewEntityResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria); + void Inserts(AiSentenceEntity[] datas); + } +} diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs new file mode 100644 index 0000000..868fe84 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs @@ -0,0 +1,154 @@ + +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.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + using CloudBuilder.AI.Data; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiBookController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiBookService aiBookService; + +public AiBookController(IApplicationService service, IAiBookService aiBookService) +{ +this.service = service; +this.aiBookService= aiBookService; +} + + [PermissionOperate(name: "AiBook", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiBookService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Find")] + [HttpPost] + public dynamic FindByTitle(string title) + { + try + { + + var result = aiBookService.FindByTitle(title); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiBookEntity data) + { + try + { + + var result = aiBookService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiBookData data){ + try + { + aiBookService.Insert(data); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiBookEntity data) + { + try + { + + var result = aiBookService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiBookService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiBookPersonController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookPersonController.auto.cs new file mode 100644 index 0000000..5ba4242 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookPersonController.auto.cs @@ -0,0 +1,113 @@ + +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.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiBookPersonController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiBookPersonService aiBookPersonService; + +public AiBookPersonController(IApplicationService service, IAiBookPersonService aiBookPersonService) +{ +this.service = service; +this.aiBookPersonService= aiBookPersonService; +} + + [PermissionOperate(name: "AiBookPerson", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiBookPersonService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBookPerson", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiBookPersonEntity data) + { + try + { + + var result = aiBookPersonService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBookPerson", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiBookPersonEntity data) + { + try + { + + var result = aiBookPersonService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBookPerson", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiBookPersonService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterController.auto.cs new file mode 100644 index 0000000..67efb48 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterController.auto.cs @@ -0,0 +1,134 @@ + +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.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + using CloudBuilder.AI.Data; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiChapterController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiChapterService aiChapterService; + +public AiChapterController(IApplicationService service, IAiChapterService aiChapterService) +{ +this.service = service; +this.aiChapterService= aiChapterService; +} + + [PermissionOperate(name: "AiChapter", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiChapterService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiBook", operate: "Find")] + [HttpPost] + public dynamic FindByTitle(string title) + { + try + { + + var result = aiChapterService.FindByTitle(title); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapter", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiChapterEntity data) + { + try + { + + var result = aiChapterService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapter", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiChapterEntity data) + { + try + { + + var result = aiChapterService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapter", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiChapterService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterPersonController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterPersonController.auto.cs new file mode 100644 index 0000000..f70c850 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiChapterPersonController.auto.cs @@ -0,0 +1,114 @@ + +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.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + using CloudBuilder.AI.Data; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiChapterPersonController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiChapterPersonService aiChapterPersonService; + +public AiChapterPersonController(IApplicationService service, IAiChapterPersonService aiChapterPersonService) +{ +this.service = service; +this.aiChapterPersonService= aiChapterPersonService; +} + + [PermissionOperate(name: "AiChapterPerson", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiChapterPersonService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapterPerson", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiChapterPersonEntity data) + { + try + { + + var result = aiChapterPersonService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapterPerson", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiChapterPersonEntity data) + { + try + { + + var result = aiChapterPersonService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiChapterPerson", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiChapterPersonService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiParagraphController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiParagraphController.auto.cs new file mode 100644 index 0000000..7c96580 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiParagraphController.auto.cs @@ -0,0 +1,134 @@ + +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.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + using CloudBuilder.AI.Data; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiParagraphController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiParagraphService aiParagraphService; + +public AiParagraphController(IApplicationService service, IAiParagraphService aiParagraphService) +{ +this.service = service; +this.aiParagraphService= aiParagraphService; +} + + [PermissionOperate(name: "AiParagraph", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiParagraphService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiParagraph", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiParagraphEntity data) + { + try + { + + var result = aiParagraphService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiParagraph", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Inserts(AiParagraphEntity[] datas){ + try + { + aiParagraphService.Inserts(datas); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiParagraph", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiParagraphEntity data) + { + try + { + + var result = aiParagraphService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiParagraph", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiParagraphService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiSentenceController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiSentenceController.auto.cs new file mode 100644 index 0000000..53a6a14 --- /dev/null +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiSentenceController.auto.cs @@ -0,0 +1,155 @@ + +using CloudBuilder.Core.DatabaseAccessor; +using CloudBuilder.Core.Policy; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Transactions; +using CloudBuilder.Core.Service; +using CloudBuilder.AI.Service; + using CloudBuilder.Core.DatabaseAccessor.Entity; + using CloudBuilder.AI.Entity; + using System; + using CloudBuilder.AI.Data; + using CloudBuilder.AI.SearchCriteria; + +namespace CloudBuilder.Web.Entry.Controllers.Ai +{ +[Authorize(AuthorizePolicy.PERMISSION)] +[ApiController] +[Route("[controller]/[action]")] +public class AiSentenceController : ControllerBase +{ +private readonly IApplicationService service; +private readonly IAiSentenceService aiSentenceService; + +public AiSentenceController(IApplicationService service, IAiSentenceService aiSentenceService) +{ +this.service = service; +this.aiSentenceService= aiSentenceService; +} + + [PermissionOperate(name: "AiSentence", operate: "Find")] + [HttpPost] + public dynamic FindByKey(string key) + { + try + { + + var result = aiSentenceService.FindByKey(key); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiSentence", operate: "Find")] + [HttpPost] + public dynamic FindBySearchCriteria(AiSentenceSearchCriteria criteria) + { + try + { + + var result = aiSentenceService.FindBySearchCriteria(criteria); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiSentence", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Insert(AiSentenceEntity data) + { + try + { + + var result = aiSentenceService.Insert(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiParagraph", operate: "Insert")] + [HttpPost] + [UnitOfWork] + public dynamic Inserts(AiSentenceEntity[] datas){ + try + { + aiSentenceService.Inserts(datas); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiSentence", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic Update(AiSentenceEntity data) + { + try + { + + var result = aiSentenceService.Update(data); + return result; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + [PermissionOperate(name: "AiSentence", operate: "Delete")] + [HttpPost] + [UnitOfWork] + public dynamic Delete(string key){ + try + { + aiSentenceService.Delete(key); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + +} +} \ No newline at end of file