mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-02-15 04:48:19 +08:00
修改用户分配角色操作界面
This commit is contained in:
49
CodeSmith/Repository.cst
Normal file
49
CodeSmith/Repository.cst
Normal file
@@ -0,0 +1,49 @@
|
||||
<%--
|
||||
Name: 数据访问
|
||||
Author: yubaolee
|
||||
Description:
|
||||
--%>
|
||||
<%@ CodeTemplate Language="C#" Encoding="utf-8" TargetLanguage="C#" Debug="False" Description="数据访问" %>
|
||||
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
|
||||
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
|
||||
<%@ Assembly Name="SchemaExplorer" %>
|
||||
<%@ Import Namespace="SchemaExplorer" %>
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.Repository
|
||||
{
|
||||
public class <%=ModuleName%>Repository :BaseRepository<<%=ModuleName%>>, I<%=ModuleName%>Repository
|
||||
{
|
||||
|
||||
public IEnumerable<<%=ModuleName%>> Load<%=ModuleName%>s(int pageindex, int pagesize)
|
||||
{
|
||||
return Context.Categories.OrderBy(u => u.Id).Skip((pageindex - 1) * pagesize).Take(pagesize);
|
||||
}
|
||||
|
||||
public IEnumerable<<%=ModuleName%>> LoadInOrgs(params int[] orgId)
|
||||
{
|
||||
var result = from <%=ModuleName.ToLower()%> in Context.<%=ModuleName%>s where orgId.Contains(<%=ModuleName.ToLower()%>.Id)
|
||||
select <%=ModuleName.ToLower()%>;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public int Get<%=ModuleName%>CntInOrgs(params int[] orgIds)
|
||||
{
|
||||
return LoadInOrgs(orgIds).Count();
|
||||
}
|
||||
|
||||
public IEnumerable<<%=ModuleName%>> LoadInOrgs(int pageindex, int pagesize, params int[] orgIds)
|
||||
{
|
||||
return LoadInOrgs(orgIds).OrderBy(u =>u.Id).Skip((pageindex -1)*pagesize).Take(pagesize);
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
Delete(u =>u.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user