This commit is contained in:
owenchen committed 2026-08-19 14:11:17 +08:00
commit f05d2d215f
678 files changed
+73865

No files matched your search

@@ -0,0 +1,104 @@
using CloudBuilder.Core.Authorization;
using CloudBuilder.Core.DatabaseAccessor.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CloudBuilder.Security.Entity
{
[TypeScript]
[Table("security_function_map_view")]
public class SecurityFunctionMapViewEntity : ViewEntityBase
{
public SecurityFunctionMapViewEntity()
{
}
[Column("orderby")]
public int Orderby { get; set; }
[Column("parent_function_local_name")]
public string? ParentFunctionLocalName { get; set; }
[Column("parent_function_name")]
public string ParentFunctionName { get; set; }
[Column("son_function_local_name")]
public string? SonFunctionLocalName { get; set; }
[Column("son_function_name")]
public string SonFunctionName { get; set; }
[Column("son_page_name")]
public string? SonPageName { get; set; }
public const string ORDERBY = "Orderby";
public const string PARENT_FUNCTION_LOCAL_NAME = "ParentFunctionLocalName";
public const string PARENT_FUNCTION_NAME = "ParentFunctionName";
public const string SON_FUNCTION_LOCAL_NAME = "SonFunctionLocalName";
public const string SON_FUNCTION_NAME = "SonFunctionName";
public const string SON_PAGE_NAME = "SonPageName";
public const string DB_NAME_SECURITY_FUNCTION_MAP_VIEW = "security_function_map_view";
public const string DB_NAME_FIELDS="orderby,parent_function_local_name,parent_function_name,son_function_local_name,son_function_name,son_page_name";
public const string DB_ORDERBY = "orderby";
public const string DB_PARENT_FUNCTION_LOCAL_NAME = "parent_function_local_name";
public const string DB_PARENT_FUNCTION_NAME = "parent_function_name";
public const string DB_SON_FUNCTION_LOCAL_NAME = "son_function_local_name";
public const string DB_SON_FUNCTION_NAME = "son_function_name";
public const string DB_SON_PAGE_NAME = "son_page_name";
public static SecurityFunctionMapViewEntity GetInstance()
{
return new SecurityFunctionMapViewEntity();
}
public virtual void CopyFrom(SecurityFunctionMapViewEntity source)
{
CopyFrom(source, true);
}
public virtual void CopyFrom(SecurityFunctionMapViewEntity source, bool includeSystemFields)
{
if (source == null)
{
throw new NullReferenceException("Source entity is null.");
}
this.Orderby = source.Orderby;
this.ParentFunctionLocalName = source.ParentFunctionLocalName;
this.ParentFunctionName = source.ParentFunctionName;
this.SonFunctionLocalName = source.SonFunctionLocalName;
this.SonFunctionName = source.SonFunctionName;
this.SonPageName = source.SonPageName;
if (includeSystemFields)
{
}
}
public override string GetSelectFrom()
{
return $" select {DB_NAME_FIELDS} from { DB_NAME_SECURITY_FUNCTION_MAP_VIEW} ";
}
public override string GetSelectCountFrom(string sqlWhere)
{
return $" select count(*) from { DB_NAME_SECURITY_FUNCTION_MAP_VIEW} 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_ORDERBY ; int offset = limit * (start - 1);
return $" select {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_SECURITY_FUNCTION_MAP_VIEW} where 1=1 {sqlWhere} ) a where num> {offset} LIMIT {offset},{limit} ";
}
public SecurityFunctionMapViewEntity Clone()
{
SecurityFunctionMapViewEntity result = new SecurityFunctionMapViewEntity();
result.CopyFrom(this);
return result;
}
}
}