fix 修改IBusinessPlacePermissionsService
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Dlhis.Basic.Api
|
||||
{
|
||||
[Auth]
|
||||
[Get("/api/businessplacepermissions/getPlaces")]
|
||||
Task<DefaultApiResult<List<Guid>>> GetPlaceByUserIdAsync(int userId);
|
||||
Task<DefaultApiResult<List<Guid>>> GetPlaceByUserIdAsync();
|
||||
|
||||
[Auth]
|
||||
[Post("/api/businessplacepermissions/savePlace")]
|
||||
|
||||
@@ -10,11 +10,6 @@ namespace Dlhis.Basic.Api.Request
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理人员
|
||||
/// </summary>
|
||||
public int ManagerUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace Dlhis.Basic.BusinessPlace.Controllers
|
||||
/// <summary>
|
||||
/// 根据用户获取管理点
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getPlaces")]
|
||||
public async Task<List<Guid>> GetPlaceByUserIdAsync(int userId)
|
||||
public async Task<List<Guid>> GetPlaceByUserIdAsync()
|
||||
{
|
||||
return await _businessPlacePermissionsService.GetPlaceByUserIdAsync(userId);
|
||||
return await _businessPlacePermissionsService.GetPlaceByUserIdAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,6 @@ namespace Dlhis.Basic.BusinessPlace.Request
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理人员
|
||||
/// </summary>
|
||||
public int ManagerUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace Dlhis.Basic.BusinessPlace.Services
|
||||
{
|
||||
Task SaveBusinessPlacePermissionAsync(SaveBusinessPlacePermissionRequest request);
|
||||
|
||||
Task<List<Guid>> GetPlaceByUserIdAsync(int userId);
|
||||
Task<List<Guid>> GetPlaceByUserIdAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace Dlhis.Basic.BusinessPlace.Services.Implements
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IBusinessPlaceService _businessPlaceService;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
|
||||
public BusinessPlacePermissionsService(IDbContext dbContext, IBusinessPlaceService businessPlaceService)
|
||||
{
|
||||
@@ -16,8 +18,9 @@ namespace Dlhis.Basic.BusinessPlace.Services.Implements
|
||||
_businessPlaceService = businessPlaceService;
|
||||
}
|
||||
|
||||
public async Task<List<Guid>> GetPlaceByUserIdAsync(int userId)
|
||||
public async Task<List<Guid>> GetPlaceByUserIdAsync()
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
return await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == userId)
|
||||
.Select(x => x.BusinessPlaceCode)
|
||||
@@ -26,7 +29,8 @@ namespace Dlhis.Basic.BusinessPlace.Services.Implements
|
||||
|
||||
public async Task SaveBusinessPlacePermissionAsync(SaveBusinessPlacePermissionRequest request)
|
||||
{
|
||||
if(request.Id.HasValue)
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
if (request.Id.HasValue)
|
||||
{
|
||||
var entity =await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.Id == request.Id).FirstAsync();
|
||||
@@ -36,10 +40,9 @@ namespace Dlhis.Basic.BusinessPlace.Services.Implements
|
||||
else
|
||||
{
|
||||
var entity = request.Adapt<BusinessPlaceManagerRelationshipEntity>();
|
||||
entity.ManagerUserId = userId;
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user