From 1071008100a4bd6aebd37db49916f2ec4d3efaaf Mon Sep 17 00:00:00 2001 From: sunliang <593170460@qq.com> Date: Fri, 15 Dec 2023 16:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=A1=A8=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=92=E8=89=B2=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinioController/MinioApiController.cs | 71 ++++++++++--------- .../Entity/MinioController/MinioUser.cs | 2 +- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs b/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs index af747c8..19dca99 100644 --- a/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs +++ b/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs @@ -175,9 +175,9 @@ namespace IBKLinker_Minio.Controller.MinioController //IList result = new List(); if (!string.IsNullOrEmpty(minioAuthority.LimitsAuthorityId)) { - sql += " and LIMITS_AUTHORITY_ID ='" + minioAuthority.LimitsAuthorityId + "'"; + sql += " and a.LIMITS_AUTHORITY_ID ='" + minioAuthority.LimitsAuthorityId + "'"; } - request.data = db.Query("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("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,20 +583,21 @@ namespace IBKLinker_Minio.Controller.MinioController try { List AuthorityList = new List(); - minioRolePermission.minioRolePermission.Id = Guid.NewGuid().ToString(); - minioRolePermission.minioRolePermission.LimitsAuthorityId = Guid.NewGuid().ToString(); - foreach (var item in minioRolePermission.ds.Split(',')) - { - MinioAuthority ds = new MinioAuthority(); - ds.LimitsAuthorityId = minioRolePermission.minioRolePermission.LimitsAuthorityId; - ds.CreatorTime = DateTime.Now; - ds.CreatorUser = minioRolePermission.minioRolePermission.CreatorUser; - ds.FileId = int.Parse(item); - AuthorityList.Add(ds); - } ///创建数据库连接上下文对象 using (IDbContext db = ObjectContainer.GetObject("db")) { + minioRolePermission.minioRolePermission.Id = Guid.NewGuid().ToString(); + minioRolePermission.minioRolePermission.LimitsAuthorityId = Guid.NewGuid().ToString(); + foreach (var item in minioRolePermission.ds.Split(',')) + { + MinioAuthority ds = new MinioAuthority(); + 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); + } db.BeginTransaction(); ///拿到表自增长的值赋值给自增长主键pk minioRolePermission.minioRolePermission.Pk = bb.getPk("S_MINIO_ROLE_PERMISSION", "MINIO_ROLE_PERMISSION"); @@ -628,24 +629,24 @@ namespace IBKLinker_Minio.Controller.MinioController try { List AuthorityList = new List(); - //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(); - ds.LimitsAuthorityId = minioRolePermission.minioRolePermission.LimitsAuthorityId; - ds.CreatorTime = DateTime.Now; - ds.CreatorUser = minioRolePermission.minioRolePermission.CreatorUser; - ds.FileId = int.Parse(item); - AuthorityList.Add(ds); - } ///创建数据库连接上下文对象 using (IDbContext db = ObjectContainer.GetObject("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(); + ds.LimitsAuthorityId = minioRolePermission.minioRolePermission.LimitsAuthorityId; + 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); + } try { ///启动事务 @@ -654,7 +655,7 @@ namespace IBKLinker_Minio.Controller.MinioController //DateTime time = DateTime.Now; db.Update(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(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(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("select * from MINIO_ROLE_PERMISSION where 1=1 " + sql + " ORDER BY PK"); request.code = "0"; } diff --git a/IBKLinker-Minio/Entity/MinioController/MinioUser.cs b/IBKLinker-Minio/Entity/MinioController/MinioUser.cs index 484026a..00026d9 100644 --- a/IBKLinker-Minio/Entity/MinioController/MinioUser.cs +++ b/IBKLinker-Minio/Entity/MinioController/MinioUser.cs @@ -32,7 +32,7 @@ namespace IBKLinker_Minio.Entity.MinioController ///角色ID /// [Persistent("ROLE_ID"), DisplayName("角色ID")] - public int RoleId { get; set; } + public string RoleId { get; set; } /// ///创建人