代码生成新增加排序生成
This commit is contained in:
@@ -51,7 +51,6 @@ namespace ${options.ApiControllerNamespace}.Controllers
|
||||
var predicate = Expressionable.Create<${replaceDto.ModelTypeName}>();
|
||||
|
||||
//搜索条件查询语法参考Sqlsugar
|
||||
//predicate = predicate.And(m => m.Name.Contains(parm.Name));
|
||||
${QueryCondition}
|
||||
$if(genTable.SortField != "")
|
||||
var response = _${replaceDto.ModelTypeName}Service.GetPages(predicate.ToExpression(), parm, x => x.${genTable.SortField}, "${genTable.SortType}");
|
||||
@@ -161,5 +160,25 @@ ${end}
|
||||
string sFileName = ExportExcel(list, "${replaceDto.ModelTypeName}", "${genTable.FunctionName}");
|
||||
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
|
||||
}
|
||||
|
||||
$if(genTable.SortField != "")
|
||||
/// <summary>
|
||||
/// 保存排序
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="orderNum"></param>
|
||||
/// <returns></returns>
|
||||
[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:update")]
|
||||
[HttpGet("ChangeSort")]
|
||||
[Log(Title = "保存排序", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult ChangeSort(int id = 0, int orderNum = 0)
|
||||
{
|
||||
if (id <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
|
||||
|
||||
bool result = _${replaceDto.ModelTypeName}Service.Update(w => w.${replaceDto.PKName} == id, it => new ${replaceDto.ModelTypeName}() { ${genTable.SortField} = orderNum });;
|
||||
|
||||
return SUCCESS(result);
|
||||
}
|
||||
$end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user