ow
This commit is contained in:
1 parent
31fbe199c1
commit
1c0c83af5f
469 files changed
+62544
-5
No files matched your search
@@ -0,0 +1,132 @@
|
||||
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_group_permission_dependent")]
|
||||
public class SecurityGroupPermissionDependentEntity : EntityBase<SecurityGroupPermissionDependentEntityKey>
|
||||
{
|
||||
|
||||
public SecurityGroupPermissionDependentEntity()
|
||||
{
|
||||
}
|
||||
|
||||
[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("group_name")]
|
||||
public string GroupName { get; set; }
|
||||
[Column("permission_name")]
|
||||
public string PermissionName { get; set; }
|
||||
[Column("dependent_detail_name")]
|
||||
public string DependentDetailName { get; set; }
|
||||
[Column("view_indc")]
|
||||
public string ViewIndc { get; set; }
|
||||
[Column("create_indc")]
|
||||
public string CreateIndc { get; set; }
|
||||
[Column("amend_indc")]
|
||||
public string AmendIndc { get; set; }
|
||||
[Column("delete_indc")]
|
||||
public string DeleteIndc { 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 GROUP_NAME = "GroupName";
|
||||
public const string PERMISSION_NAME = "PermissionName";
|
||||
public const string DEPENDENT_DETAIL_NAME = "DependentDetailName";
|
||||
public const string VIEW_INDC = "ViewIndc";
|
||||
public const string CREATE_INDC = "CreateIndc";
|
||||
public const string AMEND_INDC = "AmendIndc";
|
||||
public const string DELETE_INDC = "DeleteIndc";
|
||||
|
||||
public const string DB_NAME_SECURITY_GROUP_PERMISSION_DEPENDENT = "security_group_permission_dependent";
|
||||
public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,group_name,permission_name,dependent_detail_name,view_indc,create_indc,amend_indc,delete_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_GROUP_NAME = "group_name";
|
||||
public const string DB_PERMISSION_NAME = "permission_name";
|
||||
public const string DB_DEPENDENT_DETAIL_NAME = "dependent_detail_name";
|
||||
public const string DB_VIEW_INDC = "view_indc";
|
||||
public const string DB_CREATE_INDC = "create_indc";
|
||||
public const string DB_AMEND_INDC = "amend_indc";
|
||||
public const string DB_DELETE_INDC = "delete_indc";
|
||||
|
||||
|
||||
public static SecurityGroupPermissionDependentEntity GetInstance()
|
||||
{
|
||||
return new SecurityGroupPermissionDependentEntity();
|
||||
}
|
||||
|
||||
public virtual void CopyFrom(SecurityGroupPermissionDependentEntity source)
|
||||
{
|
||||
CopyFrom(source, true);
|
||||
}
|
||||
|
||||
public virtual void CopyFrom(SecurityGroupPermissionDependentEntity 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.GroupName = source.GroupName;
|
||||
this.PermissionName = source.PermissionName;
|
||||
this.DependentDetailName = source.DependentDetailName;
|
||||
this.ViewIndc = source.ViewIndc;
|
||||
this.CreateIndc = source.CreateIndc;
|
||||
this.AmendIndc = source.AmendIndc;
|
||||
this.DeleteIndc = source.DeleteIndc;
|
||||
|
||||
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_SECURITY_GROUP_PERMISSION_DEPENDENT} with(nolock) ";
|
||||
}
|
||||
|
||||
public override string GetSelectCountFrom(string sqlWhere)
|
||||
{
|
||||
return $" select count(*) from { DB_NAME_SECURITY_GROUP_PERMISSION_DEPENDENT} 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_GROUP_NAME ;
|
||||
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_SECURITY_GROUP_PERMISSION_DEPENDENT} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
|
||||
}
|
||||
|
||||
public SecurityGroupPermissionDependentEntity Clone()
|
||||
{
|
||||
SecurityGroupPermissionDependentEntity result = new SecurityGroupPermissionDependentEntity();
|
||||
result.CopyFrom(this);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user