优化代码注释

This commit is contained in:
不做码农
2022-06-10 17:46:14 +08:00
11 changed files with 11 additions and 33 deletions

View File

@@ -42,10 +42,8 @@ namespace ZR.Admin.WebApi.Controllers
[ActionPermissionFilter(Permission = "system:config:list")]
public IActionResult QuerySysConfig([FromQuery] SysConfigQueryDto parm)
{
//开始拼装查询条件
var predicate = Expressionable.Create<SysConfig>();
//TODO 搜索条件
predicate = predicate.AndIF(!parm.ConfigType.IsEmpty(),m => m.ConfigType == parm.ConfigType);
predicate = predicate.AndIF(!parm.ConfigName.IsEmpty(),m => m.ConfigName.Contains(parm.ConfigType));
predicate = predicate.AndIF(!parm.ConfigKey.IsEmpty(),m => m.ConfigKey.Contains(parm.ConfigKey));
@@ -80,7 +78,6 @@ namespace ZR.Admin.WebApi.Controllers
[AllowAnonymous]
public IActionResult GetConfigKey(string configKey)
{
//TODO 增加缓存
var response = _SysConfigService.Queryable().First(f=> f.ConfigKey == configKey);
return SUCCESS(response?.ConfigValue);
@@ -99,7 +96,6 @@ namespace ZR.Admin.WebApi.Controllers
{
throw new CustomException("请求参数错误");
}
//从 Dto 映射到 实体
var model = parm.Adapt<SysConfig>().ToCreate(HttpContext);
return SUCCESS(_SysConfigService.Insert(model, it => new
@@ -127,12 +123,10 @@ namespace ZR.Admin.WebApi.Controllers
{
throw new CustomException("请求实体不能为空");
}
//从 Dto 映射到 实体
var model = parm.Adapt<SysConfig>().ToUpdate(HttpContext);
var response = _SysConfigService.Update(w => w.ConfigId == model.ConfigId, it => new SysConfig()
{
//Update 字段映射
ConfigName = model.ConfigName,
ConfigKey = model.ConfigKey,
ConfigValue = model.ConfigValue,