mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-24 08:24:58 +08:00
72 lines
2.8 KiB
Plaintext
72 lines
2.8 KiB
Plaintext
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
|
|
<%@ Register Name="TreeQuery" Template="Trees/TreeQuery.cst" MergeProperties="False" ExcludeProperties="" %>
|
|
|
|
<%@ Assembly Src="..\..\Common\Model.cs" %>
|
|
<%@ Assembly Src="..\..\Common\Extensions.cs" %>
|
|
|
|
<%@ Import Namespace="System.Collections.Generic" %>
|
|
<%@ Import Namespace="System.Linq" %>
|
|
<%@ Import Namespace="System.Text" %>
|
|
<%@ Import Namespace="System.Text.RegularExpressions" %>
|
|
<%@ Import Namespace="SchemaMapper" %>
|
|
|
|
<%@ Property Name="Entity" Type="SchemaMapper.Entity" %>
|
|
<%@ Property Name="Namespace" Type="System.String" %>
|
|
<%-- Safe类名 --%>
|
|
<% string SafeClassName = Entity.ClassName.ToSafeName(); %>
|
|
<%-- 描述 --%>
|
|
<% string Description = Entity.Description; %>
|
|
<%-- 如果是树型实体,则调用子模板 --%>
|
|
<%
|
|
if( Entity.IsTreeEntity() ){
|
|
CodeTemplate template = new TreeQuery();
|
|
template.SetProperty("Namespace",Namespace);
|
|
template.SetProperty("Entity",Entity);
|
|
template.Render(this.Response);
|
|
return;
|
|
}
|
|
%>
|
|
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Util;
|
|
using Util.Datas.Queries;
|
|
|
|
namespace <%= string.Format("{0}.Service.Queries.{1}",Namespace,Entity.TableSchema) %> {
|
|
/// <summary>
|
|
/// <%= Description %>查询参数
|
|
/// </summary>
|
|
public class <%= SafeClassName %>Query : QueryParameter {
|
|
<% foreach(Property p in Entity.Properties) { %>
|
|
<% if( Entity.IsFilterByQueryObject(p) ) continue;%>
|
|
<% if( p.SystemType == typeof(DateTime) ) {%>
|
|
/// <summary>
|
|
/// 起始<%=p.Description %>
|
|
/// </summary>
|
|
[Display( Name = "起始<%=p.Description %>" )]
|
|
public DateTime? Begin<%= p.PropertyName.ToSafeName() %> { get; set; }
|
|
/// <summary>
|
|
/// 结束<%=p.Description %>
|
|
/// </summary>
|
|
[Display( Name = "结束<%=p.Description %>" )]
|
|
public DateTime? End<%= p.PropertyName.ToSafeName() %> { get; set; }
|
|
<%continue;}%>
|
|
<% if( p.SystemType == typeof(string) ) {%>
|
|
|
|
private <%= p.SystemType.ToNullableType(true) %> <%= p.PropertyName.ToFieldName() %> = string.Empty;
|
|
/// <summary>
|
|
/// <%=p.Description %>
|
|
/// </summary>
|
|
[Display(Name="<%=p.Description %>")]
|
|
public <%= p.SystemType.ToNullableType(true) %> <%= p.PropertyName.ToSafeName() %> {
|
|
get => <%= p.PropertyName.ToFieldName() %> == null ? string.Empty : <%= p.PropertyName.ToFieldName() %>.Trim();
|
|
set => <%= p.PropertyName.ToFieldName() %> = value;
|
|
}
|
|
<%continue;} %>
|
|
/// <summary>
|
|
/// <%=p.Description %>
|
|
/// </summary>
|
|
[Display(Name="<%=p.Description %>")]
|
|
public <%= p.SystemType.ToNullableType(true) %> <%= p.PropertyName.ToSafeName() %> { get; set; }
|
|
<% } %>
|
|
}
|
|
} |