优化代码

This commit is contained in:
不做码农
2022-06-09 21:15:30 +08:00
parent e209c4a192
commit 71bbc27b1e
15 changed files with 44 additions and 55 deletions

View File

@@ -10,6 +10,7 @@ using Infrastructure.Enums;
using Infrastructure;
using ZR.Service.System.IService;
using ZR.Common;
using ZR.Admin.WebApi.Extensions;
namespace ZR.Admin.WebApi.Controllers.System
{
@@ -34,7 +35,6 @@ namespace ZR.Admin.WebApi.Controllers.System
[ActionPermissionFilter(Permission = "system:post:list")]
public IActionResult List([FromQuery] SysPost post, [FromQuery] PagerInfo pagerInfo)
{
//开始拼装查询条件
var predicate = Expressionable.Create<SysPost>();
predicate = predicate.AndIF(post.Status.IfNotEmpty(), it => it.Status == post.Status);
var list = PostService.GetPages(predicate.ToExpression(), pagerInfo, s => new { s.PostSort });
@@ -73,7 +73,7 @@ namespace ZR.Admin.WebApi.Controllers.System
throw new CustomException($"修改岗位{post.PostName}失败,岗位编码已存在");
}
post.Create_by = User.Identity.Name;
post.Create_by = HttpContext.GetName();
return ToResponse(ToJson(PostService.Add(post)));
}
@@ -95,7 +95,7 @@ namespace ZR.Admin.WebApi.Controllers.System
{
throw new CustomException($"修改岗位{post.PostName}失败,岗位编码已存在");
}
post.Update_by = User.Identity.Name;
post.Update_by = HttpContext.GetName();
return ToResponse(PostService.Update(post));
}