ServiceTemplateCode.cs
1.23 KB
using Hh.Mes.POJO.WebEntity.tool;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Hh.Mes.T4
{
public partial class ServiceTemplate
{
private readonly string AreaName;
private readonly string TableName;
private readonly string ControllerName;
private readonly List<TableColumnInfo> FilterColumns;
public ServiceTemplate(string areaName, string tableName, List<TableColumnInfo> tableColumns, int filter = 3)
{
AreaName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(areaName);
TableName = tableName;
var str = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tableName);
ControllerName = string.Join("", str.Split("_"));
FilterColumns = tableColumns.Where(x => x.TypeName.Equals("string", StringComparison.OrdinalIgnoreCase)).Take(filter).ToList();
var exp = Expressionable.Create<object>();
foreach (var item in FilterColumns)
{
if (!string.IsNullOrWhiteSpace(item.ColumnName))
{
exp.And(x=>x.ToString().Contains(item.ColumnName));
}
}
}
}
}