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