@ -175,9 +175,9 @@ namespace IBKLinker_Minio.Controller.MinioController
//IList<MinioAuthority> result = new List<MinioAuthority>();
if ( ! string . IsNullOrEmpty ( minioAuthority . LimitsAuthorityId ) )
{
sql + = " and LIMITS_AUTHORITY_ID ='" + minioAuthority . LimitsAuthorityId + "'" ;
sql + = " and a. LIMITS_AUTHORITY_ID ='" + minioAuthority . LimitsAuthorityId + "'" ;
}
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 . data = db . Query < AuthorityModel > ( "select a.*, b .Role_Name as RoleName from MINIO_AUTHORITY a left join MINIO_ROLE_PERMISSION b on a.LIMITS_AUTHORITY_ID =b.ID where 1=1 " + sql + " ORDER BY PK" ) ;
request . code = "0" ;
}
}
@ -318,7 +318,7 @@ namespace IBKLinker_Minio.Controller.MinioController
{
sql + = " and a.STATE =" + minioUser . State + "" ;
}
if ( minioUser . RoleId > 0 )
if ( minioUser . RoleId != "" )
{
sql + = " and a.ROLE_ID =" + minioUser . RoleId + "" ;
}
@ -583,6 +583,9 @@ namespace IBKLinker_Minio.Controller.MinioController
try
{
List < MinioAuthority > AuthorityList = new List < MinioAuthority > ( ) ;
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
minioRolePermission . minioRolePermission . Id = Guid . NewGuid ( ) . ToString ( ) ;
minioRolePermission . minioRolePermission . LimitsAuthorityId = Guid . NewGuid ( ) . ToString ( ) ;
foreach ( var item in minioRolePermission . ds . Split ( ',' ) )
@ -591,12 +594,10 @@ namespace IBKLinker_Minio.Controller.MinioController
ds . LimitsAuthorityId = minioRolePermission . minioRolePermission . LimitsAuthorityId ;
ds . CreatorTime = DateTime . Now ;
ds . CreatorUser = minioRolePermission . minioRolePermission . CreatorUser ;
ds . Id = Convert . ToInt32 ( db . QueryScalar ( "select S_MINIO_STORAGE_PATH.nextval from dual" ) ) ;
ds . FileId = int . Parse ( item ) ;
AuthorityList . Add ( ds ) ;
}
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
db . BeginTransaction ( ) ;
///拿到表自增长的值赋值给自增长主键pk
minioRolePermission . minioRolePermission . Pk = bb . getPk ( "S_MINIO_ROLE_PERMISSION" , "MINIO_ROLE_PERMISSION" ) ;
@ -628,12 +629,14 @@ namespace IBKLinker_Minio.Controller.MinioController
try
{
List < MinioAuthority > AuthorityList = new List < MinioAuthority > ( ) ;
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
//data.Id=Guid.NewGuid().ToString();
if ( string . IsNullOrEmpty ( minioRolePermission . minioRolePermission . LimitsAuthorityId ) )
{
minioRolePermission . minioRolePermission . LimitsAuthorityId = Guid . NewGuid ( ) . ToString ( ) ;
}
foreach ( var item in minioRolePermission . ds . Split ( ',' ) )
{
MinioAuthority ds = new MinioAuthority ( ) ;
@ -641,11 +644,9 @@ namespace IBKLinker_Minio.Controller.MinioController
ds . CreatorTime = DateTime . Now ;
ds . CreatorUser = minioRolePermission . minioRolePermission . CreatorUser ;
ds . FileId = int . Parse ( item ) ;
ds . Id = Convert . ToInt32 ( db . QueryScalar ( "select S_MINIO_STORAGE_PATH.nextval from dual" ) ) ;
AuthorityList . Add ( ds ) ;
}
///创建数据库连接上下文对象
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
try
{
///启动事务
@ -654,7 +655,7 @@ namespace IBKLinker_Minio.Controller.MinioController
//DateTime time = DateTime.Now;
db . Update < MinioRolePermission > ( minioRolePermission . minioRolePermission ) ;
//删除历史记录加入新的记录
db . Query ( "delete from MINIO_AUTHORITY where LIMITS_AUTHORITY_ID='" + minioRolePermission . minioRolePermission . LimitsAuthorityId + "' " ) ;
db . Execute ( "delete from MINIO_AUTHORITY where LIMITS_AUTHORITY_ID='" + minioRolePermission . minioRolePermission . LimitsAuthorityId + "' " ) ;
db . Insert < MinioAuthority > ( AuthorityList ) ;
db . Commit ( ) ;
request . code = "0" ;
@ -702,7 +703,7 @@ namespace IBKLinker_Minio.Controller.MinioController
MinioUser date = new MinioUser ( ) ;
date . UserId = item . UserId ; //用户ID
date . UserName = item . UserName ; //用户姓名
date . RoleId = 0 ; //角色ID( 将角色id改成0)
date . RoleId = "" ; //角色ID( 将角色id改成0)
date . CreatorUser = item . CreatorUser ; //创建人
date . State = item . State ; //状态
date . CreatorTime = item . CreatorTime ; //创建时间
@ -710,8 +711,8 @@ namespace IBKLinker_Minio.Controller.MinioController
}
db . Update < MinioUser > ( UdpData ) ;
}
sql + = string . Format ( "delete from MINIO_AUTHORITY where 1=1 and LIMITS_AUTHORITY_ID= {0};", data . LimitsAuthorityId ) ;
sql = string . Format ( "delete from MINIO_ROLE_PERMISSION where 1=1 and PK={0};" , data . Pk ) ;
sql + = string . Format ( "delete from MINIO_AUTHORITY where 1=1 and LIMITS_AUTHORITY_ID= ' {0}' ;", data . LimitsAuthorityId ) ;
sql + = string . Format ( "delete from MINIO_ROLE_PERMISSION where 1=1 and PK={0};" , data . Pk ) ;
sql + = "end;" ;
db . Execute ( sql ) ;
db . Commit ( ) ; //提交事务
@ -748,6 +749,10 @@ namespace IBKLinker_Minio.Controller.MinioController
{
sql + = " and ID ='" + minioRolePermission . Id + "'" ;
}
if ( ! string . IsNullOrEmpty ( minioRolePermission . RoleName ) )
{
sql + = " and ROLE_NAME like'%" + minioRolePermission . RoleName + "%'" ;
}
request . data = db . Query < MinioRolePermission > ( "select * from MINIO_ROLE_PERMISSION where 1=1 " + sql + " ORDER BY PK" ) ;
request . code = "0" ;
}