This commit is contained in:
owenchen committed 2026-05-19 10:58:32 +08:00
1 parent 90f26d0dfc
commit d795476b1f
40 files changed
+2590

No files matched your search

+133
View File
@@ -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<string>
{
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;
}
}
}
@@ -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<string>
{
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;
}
}
}
@@ -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<string>
{
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;
}
}
}
@@ -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<string>
{
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;
}
}
}
@@ -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<string>
{
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;
}
}
}
@@ -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<string>
{
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;
}
}
}
@@ -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;
}
}
}
@@ -0,0 +1,43 @@
using CloudBuilder.Core.DependencyInjection.EFCore;
using Microsoft.EntityFrameworkCore;
using System.Reflection;
namespace CloudBuilder.AI.Entity
{
public class CloudBuilderAIRegistEntity : 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<AiSentenceViewEntity>(eb => { eb.HasNoKey(); });
//***END***
}
}
}