Files
shgx_tz_mes_backend_sync/ZR.CodeGenerator/CodeGenerateTemplate.cs

49 lines
1.4 KiB
C#
Raw Normal View History

using System;
using System.Linq;
using System.Text;
using ZR.Model.System.Generate;
2021-09-13 18:38:54 +08:00
namespace ZR.CodeGenerator
{
2021-09-16 17:52:31 +08:00
/// <summary>
/// 代码生成模板
/// </summary>
2021-09-13 18:38:54 +08:00
public class CodeGenerateTemplate
{
2021-12-11 16:37:08 +08:00
//模板调用
public static string QueryExp(string propertyName, string queryType)
{
if (queryType.Equals("EQ"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} == parm.{propertyName})";
}
if (queryType.Equals("GTE"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} >= parm.{propertyName})";
}
if (queryType.Equals("GT"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} > parm.{propertyName})";
}
if (queryType.Equals("LT"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} < parm.{propertyName})";
}
if (queryType.Equals("LTE"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} <= parm.{propertyName})";
}
if (queryType.Equals("NE"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName} != parm.{propertyName})";
}
if (queryType.Equals("LIKE"))
{
2022-01-18 21:29:31 +08:00
return $"it => it.{ propertyName}.Contains(parm.{propertyName}))";
}
2022-02-09 21:20:43 +08:00
return $"it => it.{ propertyName} == parm.{propertyName})";
}
2022-01-05 20:43:18 +08:00
2021-09-13 18:38:54 +08:00
}
}