@ -35,6 +35,7 @@ using NPOI.SS.Formula.Functions;
using System.Xml.Linq ;
using System.Xml.Linq ;
using NPOI.HPSF ;
using NPOI.HPSF ;
using IBKLinker_Minio.Common ;
using IBKLinker_Minio.Common ;
using NPOI.POIFS.Crypt.Dsig ;
namespace IBKLinker_Minio.Controller.MinioController
namespace IBKLinker_Minio.Controller.MinioController
{
{
@ -166,12 +167,12 @@ namespace IBKLinker_Minio.Controller.MinioController
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
{
string sql = string . Empty ;
string sql = string . Empty ;
IList < MinioAuthority > result = new List < MinioAuthority > ( ) ;
//IList<MinioAuthority> result = new List<MinioAuthority>() ;
if ( minioAuthority . LimitsAuthorityId > 0 )
if ( ! string . IsNullOrEmpty ( minioAuthority . LimitsAuthorityId ) )
{
{
sql + = " and LIMITS_AUTHORITY_ID ='" + minioAuthority . LimitsAuthorityId + "'" ;
sql + = " and LIMITS_AUTHORITY_ID ='" + minioAuthority . LimitsAuthorityId + "'" ;
}
}
request . data = db . Query < Minio Authority> ( "select * from MINIO_AUTHORITY where 1=1 " + sql + " ORDER BY ID ") ;
request . data = db . Query < AuthorityModel > ( "select a. *,.Role_Name as RoleName from MINIO_AUTHORITY a left join MINIO_ROLE_PERMISSION b on a. LimitsAuthorityId=b.ID where 1=1 " + sql + " ORDER BY PK ") ;
request . code = "0" ;
request . code = "0" ;
}
}
}
}
@ -480,14 +481,22 @@ namespace IBKLinker_Minio.Controller.MinioController
/// </summary>
/// </summary>
/// <param name="minioRolePermission">minio角色权限表</param>
/// <param name="minioRolePermission">minio角色权限表</param>
[HttpPost, Route("AddRolePermission")]
[HttpPost, Route("AddRolePermission")]
public RequestEntity AddRolePermission ( MinioRolePermission minioRolePermission )
public RequestEntity AddRolePermission ( MinioRolePermission minioRolePermission , List < MinioAuthority > ds )
{
{
RequestEntity request = new RequestEntity ( ) ;
RequestEntity request = new RequestEntity ( ) ;
try
try
{
{
minioRolePermission . Id = Guid . NewGuid ( ) . ToString ( ) ;
minioRolePermission . LimitsAuthorityId = Guid . NewGuid ( ) . ToString ( ) ;
foreach ( var item in ds )
{
item . LimitsAuthorityId = minioRolePermission . LimitsAuthorityId ;
item . CreatorTime = DateTime . Now ;
}
///创建数据库连接上下文对象
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
{
db . BeginTransaction ( ) ;
///拿到表自增长的值赋值给自增长主键pk
///拿到表自增长的值赋值给自增长主键pk
minioRolePermission . Pk = getPk ( "S_MINIO_ROLE_PERMISSION" , "MINIO_ROLE_PERMISSION" ) ;
minioRolePermission . Pk = getPk ( "S_MINIO_ROLE_PERMISSION" , "MINIO_ROLE_PERMISSION" ) ;
///给创建时间赋值
///给创建时间赋值
@ -495,6 +504,8 @@ namespace IBKLinker_Minio.Controller.MinioController
///把需要添加的数据同步到数据库
///把需要添加的数据同步到数据库
db . Insert < MinioRolePermission > ( minioRolePermission ) ;
db . Insert < MinioRolePermission > ( minioRolePermission ) ;
db . Insert < MinioAuthority > ( ds ) ;
db . Commit ( ) ;
request . code = "0" ;
request . code = "0" ;
}
}
}
}
@ -510,11 +521,22 @@ namespace IBKLinker_Minio.Controller.MinioController
/// </summary>
/// </summary>
/// <param name="data">修改数据</param>
/// <param name="data">修改数据</param>
[HttpPost, Route("UpdateRolePermission")]
[HttpPost, Route("UpdateRolePermission")]
public RequestEntity UpdateRolePermission ( MinioRolePermission data )
public RequestEntity UpdateRolePermission ( MinioRolePermission data ,List < MinioAuthority > ds )
{
{
RequestEntity request = new RequestEntity ( ) ;
RequestEntity request = new RequestEntity ( ) ;
try
try
{
{
//data.Id=Guid.NewGuid().ToString();
if ( string . IsNullOrEmpty ( data . LimitsAuthorityId ) )
{
data . LimitsAuthorityId = Guid . NewGuid ( ) . ToString ( ) ;
}
foreach ( var item in ds )
{
item . LimitsAuthorityId = data . LimitsAuthorityId ;
item . CreatorTime = DateTime . Now ;
}
///创建数据库连接上下文对象
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
{
@ -523,8 +545,11 @@ namespace IBKLinker_Minio.Controller.MinioController
///启动事务
///启动事务
db . BeginTransaction ( ) ;
db . BeginTransaction ( ) ;
///给修改时间赋值
///给修改时间赋值
DateTime time = DateTime . Now ;
//DateTime time = DateTime.Now ;
db . Update < MinioRolePermission > ( data ) ;
db . Update < MinioRolePermission > ( data ) ;
//删除历史记录加入新的记录
db . Query ( "delete from MINIO_AUTHORITY where LIMITS_AUTHORITY_ID='" + data . LimitsAuthorityId + "' " ) ;
db . Insert < MinioAuthority > ( ds ) ;
db . Commit ( ) ;
db . Commit ( ) ;
request . code = "0" ;
request . code = "0" ;
}
}
@ -611,11 +636,10 @@ namespace IBKLinker_Minio.Controller.MinioController
{
{
string sql = string . Empty ;
string sql = string . Empty ;
IList < MinioRolePermission > result = new List < MinioRolePermission > ( ) ;
IList < MinioRolePermission > result = new List < MinioRolePermission > ( ) ;
if ( minioRolePermission . Id > 0 )
if ( ! string . IsNullOrEmpty ( minioRolePermission . Id ) )
{
{
sql + = " and ID = " + minioRolePermission . Id ;
sql + = " and ID = ' " + minioRolePermission . Id + "'" ;
}
}
request . data = db . Query < MinioRolePermission > ( "select * from MINIO_ROLE_PERMISSION where 1=1 " + sql + " ORDER BY PK" ) ;
request . data = db . Query < MinioRolePermission > ( "select * from MINIO_ROLE_PERMISSION where 1=1 " + sql + " ORDER BY PK" ) ;
request . code = "0" ;
request . code = "0" ;
}
}