优化代码生成模板

This commit is contained in:
不做码农
2023-05-12 15:10:12 +08:00
parent ca22b17104
commit 335db343c9
4 changed files with 44 additions and 25 deletions

View File

@@ -38,8 +38,13 @@ $if(column.HtmlType == "selectMulti")
$elseif(column.CsharpType == "string")
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.${column.CsharpField}), ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
$elseif(column.CsharpType == "DateTime")
$if(column.HtmlType == "month")
DateTime monthEnd = Convert.ToDateTime(parm.${column.CsharpField}).AddMonths(1);
predicate = predicate.AndIF(parm.${column.CsharpField} != null, it => it.${column.CsharpField} >= parm.${column.CsharpField} && it.${column.CsharpField} < monthEnd);
$else
predicate = predicate.AndIF(parm.Begin${column.CsharpField} == null, it => it.${column.CsharpField} >= DateTime.Now.AddDays(-1));
predicate = predicate.AndIF(parm.Begin${column.CsharpField} != null, it => it.${column.CsharpField} >= parm.Begin${column.CsharpField} && it.${column.CsharpField} <= parm.End${column.CsharpField});
$end
$elseif(column.CsharpType == "int" || column.CsharpType == "long")
predicate = predicate.AndIF(parm.${column.CsharpField} != null, ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
$end