feat 解散网格
This commit is contained in:
@@ -55,6 +55,16 @@ public class WorkGridsController : ControllerBase
|
||||
await _workGridService.SaveAsync(requests);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解散网格
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("dismiss")]
|
||||
public async Task DismissAsync(WorkGridDismissRequest request)
|
||||
{
|
||||
await _workGridService.DismissAsync(request.WorkGridCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网格分页
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Basic.WorkGrids.Request;
|
||||
|
||||
public class WorkGridDismissRequest
|
||||
{
|
||||
public Guid WorkGridCode { get; set; }
|
||||
}
|
||||
@@ -36,6 +36,13 @@ public interface IWorkGridService : IScopeDependency
|
||||
/// <returns></returns>
|
||||
Task ChangeAsync(string from, string to);
|
||||
|
||||
/// <summary>
|
||||
/// 解散
|
||||
/// </summary>
|
||||
/// <param name="workGridCode"></param>
|
||||
/// <returns></returns>
|
||||
Task DismissAsync(Guid workGridCode);
|
||||
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
|
||||
@@ -155,6 +155,18 @@ public class WorkGridService : IWorkGridService
|
||||
await _operateLog.LogAsync(OperateLogType.WorkGrid, $"网格({workGrid.Name})修改负责人{from}->{to}");
|
||||
}
|
||||
|
||||
public async Task DismissAsync(Guid workGridCode)
|
||||
{
|
||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.Code == workGridCode).SingleAsync();
|
||||
workGrid.ThrowIfNull("工作网格不存在");
|
||||
|
||||
var existsUser = await _dbContext.Queryable<WorkGridUserEntity>().Where(x => x.WorkGridCode == workGridCode).AnyAsync();
|
||||
existsUser.ThrowIfTrue("工作网格下存在人员,请先移除人员");
|
||||
|
||||
await _dbContext.DeleteAsync(workGrid);
|
||||
await _operateLog.LogAsync(OperateLogType.WorkGrid, $"解散网格({workGrid.Name})");
|
||||
}
|
||||
|
||||
public async Task<WorkGridUserPageResponse> GetMyWorkGridAsync(WorkGridPageRequest request)
|
||||
{
|
||||
var currentUserCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
|
||||
|
||||
Reference in New Issue
Block a user