From b525fe659614934f253ed9c8b59c38cfebb3bc15 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 19 三月 2025 13:21:07 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi
---
LifePayment/LifePayment.Application/User/UserRoleService.cs | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs
index 057e212..97fbd78 100644
--- a/LifePayment/LifePayment.Application/User/UserRoleService.cs
+++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -1,4 +1,5 @@
锘縰sing LifePayment.Application.Contracts;
+using LifePayment.Domain;
using LifePayment.Domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
@@ -8,6 +9,7 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
+using Z.EntityFramework.Plus;
using ZeroD.Util;
namespace HumanResourcesServices.Application
@@ -16,21 +18,27 @@
{
private readonly IRepository<User, Guid> _userRepository;
private readonly IRepository<Role, Guid> _roleRepository;
+ private readonly IRepository<LifePayChannles, Guid> _channleRepository;
private readonly IRepository<UserRole, Guid> _userRoleRep;
+ private readonly IRepository<UserChannle, Guid> _userChannleRep;
public UserRoleService(
IRepository<User, Guid> userRepository,
IRepository<Role, Guid> roleRepository,
- IRepository<UserRole, Guid> userRoleRep)
+ IRepository<LifePayChannles, Guid> channleRepository,
+ IRepository<UserRole, Guid> userRoleRep,
+ IRepository<UserChannle, Guid> userChannleRep)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
+ _channleRepository = channleRepository;
_userRoleRep = userRoleRep;
+ _userChannleRep = userChannleRep;
}
public async Task<PageOutput<UserDto>> GetBackClientUsers(GetBackClientUsersInput input)
{
- var query = _userRepository.Where(s => s.ClientId == Constant.ClientType.Back).Include(i => i.UserRoles).Select(u => new UserDto
+ var query = _userRepository.Where(s => s.ClientId == Constant.ClientType.Back).Include(i => i.UserRoles).Include(i => i.UserChannle).Select(u => new UserDto
{
Id = u.Id,
UserName = u.UserName,
@@ -43,6 +51,13 @@
{
Id = r.Id,
Name = r.Name,
+ },
+ Channles = from uc in u.UserChannle
+ from c in _channleRepository.Where(s => s.Id == uc.ChannleId)
+ select new UserChannleDto
+ {
+ Id = c.Id,
+ Name = c.ChannlesName,
},
Remark = u.Remark,
CompanyOrgId = u.CompanyOrgId,
@@ -77,6 +92,21 @@
entity.Remark = input.Remark;
entity.DepartmentOrgId = input.DepartmentOrgId;
entity.CompanyOrgId = input.CompanyOrgId;
+
+ var userchannle = await _userChannleRep.Where(s => s.UserId == input.Id).DeleteAsync();
+ List<UserChannle> userChannles = new List<UserChannle>();
+ foreach (var item in input.ChannlesId)
+ {
+ userChannles.Add(new UserChannle()
+ {
+ Id = Guid.NewGuid(),
+ ChannleId = item,
+ UserId = entity.Id
+ });
+ }
+
+ await _userChannleRep.InsertManyAsync(userChannles);
+
return Constant.SUCCESS;
}
--
Gitblit v1.9.1