mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-18 09:44:28 +08:00
1 完成用户部门权限分配处理,可以为用户分配可见部门,如果没有任何可见部门,则只能查看自己有关的数据;
2 完善进出库实例; 3 添加CodeSmith生成EF DbContext Entity Mapping;
This commit is contained in:
55
OpenAuth.Repository/Models/Mapping/StockMap.cs
Normal file
55
OpenAuth.Repository/Models/Mapping/StockMap.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public partial class StockMap
|
||||
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<OpenAuth.Domain.Stock>
|
||||
{
|
||||
public StockMap()
|
||||
{
|
||||
// table
|
||||
ToTable("Stock", "dbo");
|
||||
|
||||
// keys
|
||||
HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
Property(t => t.Id)
|
||||
.HasColumnName("Id")
|
||||
.IsRequired();
|
||||
Property(t => t.Name)
|
||||
.HasColumnName("Name")
|
||||
.HasMaxLength(500)
|
||||
.IsRequired();
|
||||
Property(t => t.Number)
|
||||
.HasColumnName("Number")
|
||||
.IsRequired();
|
||||
Property(t => t.Price)
|
||||
.HasColumnName("Price")
|
||||
.HasPrecision(10, 1)
|
||||
.IsRequired();
|
||||
Property(t => t.Status)
|
||||
.HasColumnName("Status")
|
||||
.IsRequired();
|
||||
Property(t => t.User)
|
||||
.HasColumnName("User")
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
Property(t => t.Time)
|
||||
.HasColumnName("Time")
|
||||
.IsRequired();
|
||||
|
||||
// Relationships
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,7 +16,7 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
this.Property(t => t.Phone_)
|
||||
this.Property(t => t.Phone)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
this.Property(t => t.QQ)
|
||||
this.Property(t => t.Qq)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
@@ -68,13 +68,13 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
this.ToTable("UserExt");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.Email).HasColumnName("Email");
|
||||
this.Property(t => t.Phone_).HasColumnName("Phone_");
|
||||
this.Property(t => t.Phone).HasColumnName("Phone_");
|
||||
this.Property(t => t.Mobile).HasColumnName("Mobile");
|
||||
this.Property(t => t.Address).HasColumnName("Address");
|
||||
this.Property(t => t.Zip).HasColumnName("Zip");
|
||||
this.Property(t => t.Birthday).HasColumnName("Birthday");
|
||||
this.Property(t => t.IdCard).HasColumnName("IdCard");
|
||||
this.Property(t => t.QQ).HasColumnName("QQ");
|
||||
this.Property(t => t.Qq).HasColumnName("QQ");
|
||||
this.Property(t => t.DynamicField).HasColumnName("DynamicField");
|
||||
this.Property(t => t.ByteArrayId).HasColumnName("ByteArrayId");
|
||||
this.Property(t => t.Remark).HasColumnName("Remark");
|
||||
|
@@ -31,6 +31,8 @@ namespace OpenAuth.Repository.Models
|
||||
public DbSet<UserCfg> UserCfgs { get; set; }
|
||||
public DbSet<UserExt> UserExts { get; set; }
|
||||
|
||||
public DbSet<Stock> Stocks { get; set; }
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Configurations.Add(new CategoryMap());
|
||||
@@ -46,6 +48,8 @@ namespace OpenAuth.Repository.Models
|
||||
modelBuilder.Configurations.Add(new UserMap());
|
||||
modelBuilder.Configurations.Add(new UserCfgMap());
|
||||
modelBuilder.Configurations.Add(new UserExtMap());
|
||||
|
||||
modelBuilder.Configurations.Add(new StockMap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -66,6 +66,7 @@
|
||||
<Compile Include="Models\Mapping\RelevanceMap.cs" />
|
||||
<Compile Include="Models\Mapping\ResourceMap.cs" />
|
||||
<Compile Include="Models\Mapping\RoleMap.cs" />
|
||||
<Compile Include="Models\Mapping\StockMap.cs" />
|
||||
<Compile Include="Models\Mapping\UserCfgMap.cs" />
|
||||
<Compile Include="Models\Mapping\UserExtMap.cs" />
|
||||
<Compile Include="Models\Mapping\UserMap.cs" />
|
||||
@@ -76,6 +77,7 @@
|
||||
<Compile Include="ResourceRepository.cs" />
|
||||
<Compile Include="RoleRepository.cs" />
|
||||
<Compile Include="CategoryRepository.cs" />
|
||||
<Compile Include="StockRepository.cs" />
|
||||
<Compile Include="UserRepository.cs" />
|
||||
<Compile Include="RelevanceRepository.cs" />
|
||||
</ItemGroup>
|
||||
@@ -103,7 +105,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
39
OpenAuth.Repository/StockRepository.cs
Normal file
39
OpenAuth.Repository/StockRepository.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.Repository
|
||||
{
|
||||
public class StockRepository :BaseRepository<Stock>, IStockRepository
|
||||
{
|
||||
|
||||
public IEnumerable<Stock> LoadStocks(int pageindex, int pagesize)
|
||||
{
|
||||
return Context.Stocks.OrderBy(u => u.Id).Skip((pageindex - 1) * pagesize).Take(pagesize);
|
||||
}
|
||||
|
||||
public IEnumerable<Stock> LoadInOrgs(params int[] orgId)
|
||||
{
|
||||
var result = from stock in Context.Stocks where orgId.Contains(stock.Id)
|
||||
select stock;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public int GetStockCntInOrgs(params int[] orgIds)
|
||||
{
|
||||
return LoadInOrgs(orgIds).Count();
|
||||
}
|
||||
|
||||
public IEnumerable<Stock> 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