修改查询权限表接口,修改添加角色接口、修改接口

master
孙亮 11 months ago
parent 39a0c532b8
commit 1071008100

@ -175,9 +175,9 @@ namespace IBKLinker_Minio.Controller.MinioController
//IList<MinioAuthority> result = new List<MinioAuthority>(); //IList<MinioAuthority> result = new List<MinioAuthority>();
if (!string.IsNullOrEmpty(minioAuthority.LimitsAuthorityId)) 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"; request.code = "0";
} }
} }
@ -318,7 +318,7 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
sql += " and a.STATE =" + minioUser.State + ""; sql += " and a.STATE =" + minioUser.State + "";
} }
if (minioUser.RoleId > 0) if (minioUser.RoleId != "")
{ {
sql += " and a.ROLE_ID =" + minioUser.RoleId + ""; sql += " and a.ROLE_ID =" + minioUser.RoleId + "";
} }
@ -583,20 +583,21 @@ namespace IBKLinker_Minio.Controller.MinioController
try try
{ {
List<MinioAuthority> AuthorityList = new List<MinioAuthority>(); List<MinioAuthority> AuthorityList = new List<MinioAuthority>();
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<IDbContext>("db")) 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(','))
{
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(); db.BeginTransaction();
///拿到表自增长的值赋值给自增长主键pk ///拿到表自增长的值赋值给自增长主键pk
minioRolePermission.minioRolePermission.Pk = bb.getPk("S_MINIO_ROLE_PERMISSION", "MINIO_ROLE_PERMISSION"); minioRolePermission.minioRolePermission.Pk = bb.getPk("S_MINIO_ROLE_PERMISSION", "MINIO_ROLE_PERMISSION");
@ -628,24 +629,24 @@ namespace IBKLinker_Minio.Controller.MinioController
try try
{ {
List<MinioAuthority> AuthorityList = new List<MinioAuthority>(); List<MinioAuthority> AuthorityList = new List<MinioAuthority>();
//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<IDbContext>("db")) 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();
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 try
{ {
///启动事务 ///启动事务
@ -654,7 +655,7 @@ namespace IBKLinker_Minio.Controller.MinioController
//DateTime time = DateTime.Now; //DateTime time = DateTime.Now;
db.Update<MinioRolePermission>(minioRolePermission.minioRolePermission); 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.Insert<MinioAuthority>(AuthorityList);
db.Commit(); db.Commit();
request.code = "0"; request.code = "0";
@ -702,7 +703,7 @@ namespace IBKLinker_Minio.Controller.MinioController
MinioUser date = new MinioUser(); MinioUser date = new MinioUser();
date.UserId = item.UserId;//用户ID date.UserId = item.UserId;//用户ID
date.UserName = item.UserName;//用户姓名 date.UserName = item.UserName;//用户姓名
date.RoleId = 0;//角色ID将角色id改成0 date.RoleId = "";//角色ID将角色id改成0
date.CreatorUser = item.CreatorUser;//创建人 date.CreatorUser = item.CreatorUser;//创建人
date.State = item.State;//状态 date.State = item.State;//状态
date.CreatorTime = item.CreatorTime;//创建时间 date.CreatorTime = item.CreatorTime;//创建时间
@ -710,8 +711,8 @@ namespace IBKLinker_Minio.Controller.MinioController
} }
db.Update<MinioUser>(UdpData); 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_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_ROLE_PERMISSION where 1=1 and PK={0};", data.Pk);
sql += "end;"; sql += "end;";
db.Execute(sql); db.Execute(sql);
db.Commit();//提交事务 db.Commit();//提交事务
@ -748,6 +749,10 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
sql += " and ID ='" + minioRolePermission.Id + "'"; 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.data = db.Query<MinioRolePermission>("select * from MINIO_ROLE_PERMISSION where 1=1 " + sql + " ORDER BY PK");
request.code = "0"; request.code = "0";
} }

@ -32,7 +32,7 @@ namespace IBKLinker_Minio.Entity.MinioController
///角色ID ///角色ID
/// </summary> /// </summary>
[Persistent("ROLE_ID"), DisplayName("角色ID")] [Persistent("ROLE_ID"), DisplayName("角色ID")]
public int RoleId { get; set; } public string RoleId { get; set; }
/// <summary> /// <summary>
///创建人 ///创建人

Loading…
Cancel
Save