From 7a540f529d2c9a541993bc9818cad9c9093fec91 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 03 十二月 2025 11:04:35 +0800
Subject: [PATCH] fix: bug
---
LifePayment/LifePayment.Application/User/UserRoleService.cs | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs
index be79492..decdddd 100644
--- a/LifePayment/LifePayment.Application/User/UserRoleService.cs
+++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -62,7 +62,8 @@
from c in _channleRepository.Where(s => s.ChannlesNum == uc.ChannleId)
select new UserChannleDto
{
- Id = c.ChannlesNum,
+ Id = c.Id,
+ ChannlesNum = c.ChannlesNum,
Name = c.ChannlesName,
},
Remark = u.Remark,
@@ -103,10 +104,16 @@
List<UserChannle> userChannles = new List<UserChannle>();
foreach (var item in input.ChannlesId)
{
+ var channleNum = item;
+ if (IsGuid(channleNum))
+ {
+ channleNum = await _channleRepository.Where(x => x.Id == Guid.Parse(item)).Select(s => s.ChannlesNum).FirstOrDefaultAsync();
+ }
+
userChannles.Add(new UserChannle()
{
Id = Guid.NewGuid(),
- ChannleId = item,
+ ChannleId = channleNum,
UserId = entity.Id
});
}
@@ -138,6 +145,7 @@
CheckExtensions.IfTrueThrowUserFriendlyException(result != Constant.SUCCESS,
CustomeErrorMessage.ResetPasswordFail);
}
+
public async Task<int> DeleteBackClientUser(Guid id)
{
var entity = await _userRepository.FirstOrDefaultAsync(s => s.Id == id && s.ClientId == Constant.ClientType.Back);
@@ -152,8 +160,16 @@
public async Task<Guid> CreateRole(CreateOrUpdateRoleInput input)
{
- var entity = ObjectMapper.Map<CreateOrUpdateRoleInput, Role>(input);
- return await _roleRepository.InsertAndGetIdAsync(entity);
+ Role role = new Role()
+ {
+ Id = input.Id,
+ Name = input.Name,
+ Sequence = input.Sequence,
+ DepartmentId = input.DepartmentId,
+ DataRange = input.DataRange,
+ Remark = input.Remark
+ };
+ return await _roleRepository.InsertAndGetIdAsync(role);
}
public async Task<PageOutput<RoleInfo>> GetRoles(GetRolesInput input)
@@ -221,5 +237,11 @@
await _roleRepository.DeleteAsync(id);
return Constant.SUCCESS;
}
+
+ private bool IsGuid(string input)
+ {
+ Guid guidOutput;
+ return Guid.TryParse(input, out guidOutput);
+ }
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.1