建立新生命标准项目模板原型,名为零代!
This commit is contained in:
commit
c647bd0ad1
|
@ -0,0 +1,112 @@
|
|||
# EditorConfig is awesome:http://EditorConfig.org
|
||||
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Don't use tabs for indentation.
|
||||
[*]
|
||||
indent_style = space
|
||||
# (Please don't specify an indent_size here; that has too many unintended consequences.)
|
||||
|
||||
# Code files
|
||||
[*.{cs,csx,vb,vbx}]
|
||||
indent_size = 4
|
||||
insert_final_newline = false
|
||||
charset = utf-8-bom
|
||||
end_of_line = crlf
|
||||
|
||||
# Xml project files
|
||||
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
|
||||
indent_size = 2
|
||||
|
||||
# Xml config files
|
||||
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
|
||||
indent_size = 2
|
||||
|
||||
# JSON files
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
# Dotnet code style settings:
|
||||
[*.{cs,vb}]
|
||||
# Sort using and Import directives with System.* appearing first
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_indent_labels = flush_left
|
||||
|
||||
#csharp_space_after_cast = true
|
||||
#csharp_space_after_keywords_in_control_flow_statements = true
|
||||
#csharp_space_between_method_declaration_parameter_list_parentheses = true
|
||||
#csharp_space_between_method_call_parameter_list_parentheses = true
|
||||
#csharp_space_between_parentheses = control_flow_statements, type_casts
|
||||
|
||||
# 单行放置代码
|
||||
csharp_preserve_single_line_statements = true
|
||||
csharp_preserve_single_line_blocks = true
|
||||
|
||||
# Avoid "this." and "Me." if not necessary
|
||||
dotnet_style_qualification_for_field = false:warning
|
||||
dotnet_style_qualification_for_property = false:warning
|
||||
dotnet_style_qualification_for_method = false:warning
|
||||
dotnet_style_qualification_for_event = false:warning
|
||||
|
||||
# Use language keywords instead of framework type names for type references
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = false:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = false:suggestion
|
||||
#dotnet_style_require_accessibility_modifiers = for_non_interface_members:none/always:suggestion
|
||||
|
||||
# Suggest more modern language features when available
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||
|
||||
# CSharp code style settings:
|
||||
[*.cs]
|
||||
# Prefer "var" everywhere
|
||||
csharp_style_var_for_built_in_types = true:warning
|
||||
csharp_style_var_when_type_is_apparent = true:warning
|
||||
csharp_style_var_elsewhere = true:warning
|
||||
|
||||
# Prefer method-like constructs to have a block body
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
|
||||
|
||||
# Prefer property-like constructs to have an expression-body
|
||||
csharp_style_expression_bodied_properties = true:suggestion
|
||||
csharp_style_expression_bodied_indexers = true:suggestion
|
||||
#csharp_style_expression_bodied_accessors = true:suggestion
|
||||
|
||||
# Suggest more modern language features when available
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# 单行不需要大括号
|
||||
csharp_prefer_braces = false:suggestion
|
||||
|
||||
# Newline settings
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
|
@ -0,0 +1,26 @@
|
|||
################################################################################
|
||||
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
|
||||
################################################################################
|
||||
|
||||
/.vs
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
/packages
|
||||
*.user
|
||||
/Data
|
||||
/Log
|
||||
*.log
|
||||
*.htm
|
||||
*.nuspec
|
||||
*.nupkg
|
||||
Config/
|
||||
*.suo
|
||||
.vs/
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Zero.Agent
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Zero.AntJob
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace Zero.Core
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||
<AssemblyTitle>零代核心库</AssemblyTitle>
|
||||
<Description>Web应用、微服务、应用服务器、大数据计算和客户端等多个端共用的类库,例如模型类等</Description>
|
||||
<Company>新生命开发团队</Company>
|
||||
<Copyright>©2002-2020 NewLife</Copyright>
|
||||
<Version>1.0.2020.0801</Version>
|
||||
<FileVersion>1.0.2020.0801</FileVersion>
|
||||
<AssemblyVersion>1.0.*</AssemblyVersion>
|
||||
<Deterministic>false</Deterministic>
|
||||
<OutputPath>..\Bin</OutputPath>
|
||||
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
|
||||
<DefineConstants>$(DefineConstants);__CORE__;STD20</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,18 @@
|
|||
<#@ template language="C#" hostSpecific="true" debug="true" #>
|
||||
<#@ assembly name="netstandard" #>
|
||||
<#@ assembly name="$(SolutionDir)\DLL\NewLife.Core.dll" #>
|
||||
<#@ assembly name="$(SolutionDir)\DLL\XCode.dll" #>
|
||||
<#@ import namespace="System.Diagnostics" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ import namespace="XCode.Code" #>
|
||||
<#@ output extension=".log" #>
|
||||
<#
|
||||
// 设置当前工作目录
|
||||
PathHelper.BasePath = Host.ResolvePath(".");
|
||||
// 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名、表名字段名大小写
|
||||
//EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true,Boolean? nameIgnoreCase = null);
|
||||
EntityBuilder.Build();
|
||||
|
||||
//var tables = DAL.ImportFrom("Company.Project.xml");
|
||||
//EntityBuilder.Build(tables);
|
||||
#>
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Tables Version="9.18.7505.2225" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://www.newlifex.com http://www.newlifex.com/Model2020.xsd" NameSpace="Zero.Data.Projects" ConnName="Zero" Output="" BaseClass="Entity" ChineseFileName="True" IgnoreNameCase="True" xmlns="http://www.newlifex.com/Model2020.xsd">
|
||||
<Table Name="Team" Description="团队。管理一系列相关的产品和应用系统">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="Name" DataType="String" Master="True" Nullable="False" Description="名称" />
|
||||
<Column Name="Code" DataType="String" Description="编码" />
|
||||
<Column Name="LeaderId" DataType="Int32" Description="组长" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="Name" Unique="True" />
|
||||
<Index Columns="Code" Unique="True" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
<Table Name="Member" Description="成员。所有可用团队成员">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="Name" DataType="String" Master="True" Nullable="False" Description="名称" />
|
||||
<Column Name="Kind" DataType="String" Description="类型" />
|
||||
<Column Name="TeamId" DataType="Int32" Description="团队。所属主团队" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="Name" Unique="True" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
<Table Name="TeamMember" Description="团队成员。每个团队拥有哪些成员,每个成员有一个主力团队">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="TeamId" DataType="Int32" Description="团队" />
|
||||
<Column Name="MemberId" DataType="Int32" Description="成员" />
|
||||
<Column Name="Major" DataType="Boolean" Description="主要。是否该成员的主要团队" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="TeamId" />
|
||||
<Index Columns="MemberId" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
<Table Name="Product" Description="产品">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="TeamId" DataType="Int32" Description="团队" />
|
||||
<Column Name="Name" DataType="String" Master="True" Nullable="False" Description="名称" />
|
||||
<Column Name="Kind" DataType="String" Description="类型" />
|
||||
<Column Name="LeaderId" DataType="Int32" Description="组长" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="Completed" DataType="Boolean" Description="完成" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="Name" Unique="True" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
<Table Name="VersionPlan" Description="版本计划">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="TeamId" DataType="Int32" Description="团队" />
|
||||
<Column Name="ProductId" DataType="Int32" Description="产品" />
|
||||
<Column Name="Name" DataType="String" Master="True" Nullable="False" Description="名称。版本号" />
|
||||
<Column Name="Kind" DataType="Int32" Description="类型。常规/紧急" />
|
||||
<Column Name="StartDate" DataType="DateTime" Description="开始日期" />
|
||||
<Column Name="EndDate" DataType="DateTime" Description="结束日期" />
|
||||
<Column Name="ManHours" DataType="Int32" Description="工时" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="TeamId" />
|
||||
<Index Columns="ProductId" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
<Table Name="VersionMember" Description="版本成员">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
<Column Name="VersionId" DataType="Int32" Description="版本" />
|
||||
<Column Name="MemberId" DataType="Int32" Description="成员" />
|
||||
<Column Name="StartDate" DataType="DateTime" Description="开始日期" />
|
||||
<Column Name="EndDate" DataType="DateTime" Description="结束日期" />
|
||||
<Column Name="ManHours" DataType="Int32" Description="工时" />
|
||||
<Column Name="Major" DataType="Boolean" Description="主要。是否该成员的主要团队" />
|
||||
<Column Name="Enable" DataType="Boolean" Description="启用" />
|
||||
<Column Name="CreateUser" DataType="String" Description="创建者" />
|
||||
<Column Name="CreateUserID" DataType="Int32" Description="创建人" />
|
||||
<Column Name="CreateIP" DataType="String" Description="创建地址" />
|
||||
<Column Name="CreateTime" DataType="DateTime" Description="创建时间" />
|
||||
<Column Name="UpdateUser" DataType="String" Description="更新者" />
|
||||
<Column Name="UpdateUserID" DataType="Int32" Description="更新人" />
|
||||
<Column Name="UpdateIP" DataType="String" Description="更新地址" />
|
||||
<Column Name="UpdateTime" DataType="DateTime" Description="更新时间" />
|
||||
<Column Name="Remark" DataType="String" Length="500" Description="备注" />
|
||||
</Columns>
|
||||
<Indexes>
|
||||
<Index Columns="VersionId" />
|
||||
<Index Columns="MemberId" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
</Tables>
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>产品</summary>
|
||||
public partial class Product : Entity<Product>
|
||||
{
|
||||
#region 对象操作
|
||||
static Product()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(TeamId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
|
||||
// 单对象缓存
|
||||
var sc = Meta.SingleCache;
|
||||
sc.FindSlaveKeyMethod = k => Find(_.Name == k);
|
||||
sc.GetSlaveKeyMethod = e => e.Name;
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框
|
||||
if (Name.IsNullOrEmpty()) throw new ArgumentNullException(nameof(Name), "名称不能为空!");
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
|
||||
// 检查唯一索引
|
||||
// CheckExist(isNew, nameof(Name));
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Product[产品]数据……");
|
||||
|
||||
// var entity = new Product();
|
||||
// entity.ID = 0;
|
||||
// entity.TeamId = 0;
|
||||
// entity.Name = "abc";
|
||||
// entity.Kind = "abc";
|
||||
// entity.LeaderId = 0;
|
||||
// entity.Enable = true;
|
||||
// entity.Completed = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Product[产品]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Team Team => Extends.Get(nameof(Team), k => Team.FindByID(TeamId));
|
||||
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("团队")]
|
||||
[Map(nameof(TeamId), typeof(Team), "ID")]
|
||||
public String TeamName => Team?.Name;
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Product FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据名称查找</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Product FindByName(String name)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Name == name);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache.GetItemWithSlaveKey(name) as Product;
|
||||
|
||||
return Find(_.Name == name);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<Product> Search(String name, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (!name.IsNullOrEmpty()) exp &= _.Name == name;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.Kind.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From Product Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<Product> _CategoryCache = new FieldCache<Product>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,375 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>产品</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("产品")]
|
||||
[BindIndex("IU_Product_Name", true, "Name")]
|
||||
[BindTable("Product", Description = "产品", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class Product : IProduct
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private Int32 _TeamId;
|
||||
/// <summary>团队</summary>
|
||||
[DisplayName("团队")]
|
||||
[Description("团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TeamId", "团队", "")]
|
||||
public Int32 TeamId { get => _TeamId; set { if (OnPropertyChanging("TeamId", value)) { _TeamId = value; OnPropertyChanged("TeamId"); } } }
|
||||
|
||||
private String _Name;
|
||||
/// <summary>名称</summary>
|
||||
[DisplayName("名称")]
|
||||
[Description("名称")]
|
||||
[DataObjectField(false, false, false, 50)]
|
||||
[BindColumn("Name", "名称", "", Master = true)]
|
||||
public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }
|
||||
|
||||
private String _Kind;
|
||||
/// <summary>类型</summary>
|
||||
[DisplayName("类型")]
|
||||
[Description("类型")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Kind", "类型", "")]
|
||||
public String Kind { get => _Kind; set { if (OnPropertyChanging("Kind", value)) { _Kind = value; OnPropertyChanged("Kind"); } } }
|
||||
|
||||
private Int32 _LeaderId;
|
||||
/// <summary>组长</summary>
|
||||
[DisplayName("组长")]
|
||||
[Description("组长")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("LeaderId", "组长", "")]
|
||||
public Int32 LeaderId { get => _LeaderId; set { if (OnPropertyChanging("LeaderId", value)) { _LeaderId = value; OnPropertyChanged("LeaderId"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private Boolean _Completed;
|
||||
/// <summary>完成</summary>
|
||||
[DisplayName("完成")]
|
||||
[Description("完成")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Completed", "完成", "")]
|
||||
public Boolean Completed { get => _Completed; set { if (OnPropertyChanging("Completed", value)) { _Completed = value; OnPropertyChanged("Completed"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "TeamId": return _TeamId;
|
||||
case "Name": return _Name;
|
||||
case "Kind": return _Kind;
|
||||
case "LeaderId": return _LeaderId;
|
||||
case "Enable": return _Enable;
|
||||
case "Completed": return _Completed;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "TeamId": _TeamId = value.ToInt(); break;
|
||||
case "Name": _Name = Convert.ToString(value); break;
|
||||
case "Kind": _Kind = Convert.ToString(value); break;
|
||||
case "LeaderId": _LeaderId = value.ToInt(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "Completed": _Completed = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得产品字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public static readonly Field TeamId = FindByName("TeamId");
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public static readonly Field Name = FindByName("Name");
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public static readonly Field Kind = FindByName("Kind");
|
||||
|
||||
/// <summary>组长</summary>
|
||||
public static readonly Field LeaderId = FindByName("LeaderId");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>完成</summary>
|
||||
public static readonly Field Completed = FindByName("Completed");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得产品字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public const String TeamId = "TeamId";
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public const String Name = "Name";
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public const String Kind = "Kind";
|
||||
|
||||
/// <summary>组长</summary>
|
||||
public const String LeaderId = "LeaderId";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>完成</summary>
|
||||
public const String Completed = "Completed";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>产品接口</summary>
|
||||
public partial interface IProduct
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>团队</summary>
|
||||
Int32 TeamId { get; set; }
|
||||
|
||||
/// <summary>名称</summary>
|
||||
String Name { get; set; }
|
||||
|
||||
/// <summary>类型</summary>
|
||||
String Kind { get; set; }
|
||||
|
||||
/// <summary>组长</summary>
|
||||
Int32 LeaderId { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>完成</summary>
|
||||
Boolean Completed { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>团队。管理一系列相关的产品和应用系统</summary>
|
||||
public partial class Team : Entity<Team>
|
||||
{
|
||||
#region 对象操作
|
||||
static Team()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(LeaderId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
|
||||
// 单对象缓存
|
||||
var sc = Meta.SingleCache;
|
||||
sc.FindSlaveKeyMethod = k => Find(_.Name == k);
|
||||
sc.GetSlaveKeyMethod = e => e.Name;
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框
|
||||
if (Name.IsNullOrEmpty()) throw new ArgumentNullException(nameof(Name), "名称不能为空!");
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
|
||||
// 检查唯一索引
|
||||
// CheckExist(isNew, nameof(Name));
|
||||
// CheckExist(isNew, nameof(Code));
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Team[团队]数据……");
|
||||
|
||||
// var entity = new Team();
|
||||
// entity.ID = 0;
|
||||
// entity.Name = "abc";
|
||||
// entity.Code = "abc";
|
||||
// entity.LeaderId = 0;
|
||||
// entity.Enable = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Team[团队]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Team FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据名称查找</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Team FindByName(String name)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Name == name);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache.GetItemWithSlaveKey(name) as Team;
|
||||
|
||||
return Find(_.Name == name);
|
||||
}
|
||||
|
||||
/// <summary>根据编码查找</summary>
|
||||
/// <param name="code">编码</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Team FindByCode(String code)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Code == code);
|
||||
|
||||
return Find(_.Code == code);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="code">编码</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<Team> Search(String name, String code, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (!name.IsNullOrEmpty()) exp &= _.Name == name;
|
||||
if (!code.IsNullOrEmpty()) exp &= _.Code == code;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From Team Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<Team> _CategoryCache = new FieldCache<Team>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>团队。管理一系列相关的产品和应用系统</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("团队。管理一系列相关的产品和应用系统")]
|
||||
[BindIndex("IU_Team_Name", true, "Name")]
|
||||
[BindIndex("IU_Team_Code", true, "Code")]
|
||||
[BindTable("Team", Description = "团队。管理一系列相关的产品和应用系统", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class Team : ITeam
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private String _Name;
|
||||
/// <summary>名称</summary>
|
||||
[DisplayName("名称")]
|
||||
[Description("名称")]
|
||||
[DataObjectField(false, false, false, 50)]
|
||||
[BindColumn("Name", "名称", "", Master = true)]
|
||||
public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }
|
||||
|
||||
private String _Code;
|
||||
/// <summary>编码</summary>
|
||||
[DisplayName("编码")]
|
||||
[Description("编码")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Code", "编码", "")]
|
||||
public String Code { get => _Code; set { if (OnPropertyChanging("Code", value)) { _Code = value; OnPropertyChanged("Code"); } } }
|
||||
|
||||
private Int32 _LeaderId;
|
||||
/// <summary>组长</summary>
|
||||
[DisplayName("组长")]
|
||||
[Description("组长")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("LeaderId", "组长", "")]
|
||||
public Int32 LeaderId { get => _LeaderId; set { if (OnPropertyChanging("LeaderId", value)) { _LeaderId = value; OnPropertyChanged("LeaderId"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "Name": return _Name;
|
||||
case "Code": return _Code;
|
||||
case "LeaderId": return _LeaderId;
|
||||
case "Enable": return _Enable;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "Name": _Name = Convert.ToString(value); break;
|
||||
case "Code": _Code = Convert.ToString(value); break;
|
||||
case "LeaderId": _LeaderId = value.ToInt(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得团队字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public static readonly Field Name = FindByName("Name");
|
||||
|
||||
/// <summary>编码</summary>
|
||||
public static readonly Field Code = FindByName("Code");
|
||||
|
||||
/// <summary>组长</summary>
|
||||
public static readonly Field LeaderId = FindByName("LeaderId");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得团队字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public const String Name = "Name";
|
||||
|
||||
/// <summary>编码</summary>
|
||||
public const String Code = "Code";
|
||||
|
||||
/// <summary>组长</summary>
|
||||
public const String LeaderId = "LeaderId";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>团队。管理一系列相关的产品和应用系统接口</summary>
|
||||
public partial interface ITeam
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>名称</summary>
|
||||
String Name { get; set; }
|
||||
|
||||
/// <summary>编码</summary>
|
||||
String Code { get; set; }
|
||||
|
||||
/// <summary>组长</summary>
|
||||
Int32 LeaderId { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>团队成员。每个团队拥有哪些成员,每个成员有一个主力团队</summary>
|
||||
public partial class TeamMember : Entity<TeamMember>
|
||||
{
|
||||
#region 对象操作
|
||||
static TeamMember()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(TeamId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化TeamMember[团队成员]数据……");
|
||||
|
||||
// var entity = new TeamMember();
|
||||
// entity.ID = 0;
|
||||
// entity.TeamId = 0;
|
||||
// entity.MemberId = 0;
|
||||
// entity.Major = true;
|
||||
// entity.Enable = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化TeamMember[团队成员]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Team Team => Extends.Get(nameof(Team), k => Team.FindByID(TeamId));
|
||||
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("团队")]
|
||||
[Map(nameof(TeamId), typeof(Team), "ID")]
|
||||
public String TeamName => Team?.Name;
|
||||
/// <summary>成员</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Member Member => Extends.Get(nameof(Member), k => Member.FindByID(MemberId));
|
||||
|
||||
/// <summary>成员</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("成员")]
|
||||
[Map(nameof(MemberId), typeof(Member), "ID")]
|
||||
public String MemberName => Member?.Name;
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static TeamMember FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据团队查找</summary>
|
||||
/// <param name="teamId">团队</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<TeamMember> FindAllByTeamId(Int32 teamId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TeamId == teamId);
|
||||
|
||||
return FindAll(_.TeamId == teamId);
|
||||
}
|
||||
|
||||
/// <summary>根据成员查找</summary>
|
||||
/// <param name="memberId">成员</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<TeamMember> FindAllByMemberId(Int32 memberId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.MemberId == memberId);
|
||||
|
||||
return FindAll(_.MemberId == memberId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="teamId">团队</param>
|
||||
/// <param name="memberId">成员</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<TeamMember> Search(Int32 teamId, Int32 memberId, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (teamId >= 0) exp &= _.TeamId == teamId;
|
||||
if (memberId >= 0) exp &= _.MemberId == memberId;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From TeamMember Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<TeamMember> _CategoryCache = new FieldCache<TeamMember>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>团队成员。每个团队拥有哪些成员,每个成员有一个主力团队</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("团队成员。每个团队拥有哪些成员,每个成员有一个主力团队")]
|
||||
[BindIndex("IX_TeamMember_TeamId", false, "TeamId")]
|
||||
[BindIndex("IX_TeamMember_MemberId", false, "MemberId")]
|
||||
[BindTable("TeamMember", Description = "团队成员。每个团队拥有哪些成员,每个成员有一个主力团队", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class TeamMember : ITeamMember
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private Int32 _TeamId;
|
||||
/// <summary>团队</summary>
|
||||
[DisplayName("团队")]
|
||||
[Description("团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TeamId", "团队", "")]
|
||||
public Int32 TeamId { get => _TeamId; set { if (OnPropertyChanging("TeamId", value)) { _TeamId = value; OnPropertyChanged("TeamId"); } } }
|
||||
|
||||
private Int32 _MemberId;
|
||||
/// <summary>成员</summary>
|
||||
[DisplayName("成员")]
|
||||
[Description("成员")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("MemberId", "成员", "")]
|
||||
public Int32 MemberId { get => _MemberId; set { if (OnPropertyChanging("MemberId", value)) { _MemberId = value; OnPropertyChanged("MemberId"); } } }
|
||||
|
||||
private Boolean _Major;
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
[DisplayName("主要")]
|
||||
[Description("主要。是否该成员的主要团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Major", "主要。是否该成员的主要团队", "")]
|
||||
public Boolean Major { get => _Major; set { if (OnPropertyChanging("Major", value)) { _Major = value; OnPropertyChanged("Major"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "TeamId": return _TeamId;
|
||||
case "MemberId": return _MemberId;
|
||||
case "Major": return _Major;
|
||||
case "Enable": return _Enable;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "TeamId": _TeamId = value.ToInt(); break;
|
||||
case "MemberId": _MemberId = value.ToInt(); break;
|
||||
case "Major": _Major = value.ToBoolean(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得团队成员字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public static readonly Field TeamId = FindByName("TeamId");
|
||||
|
||||
/// <summary>成员</summary>
|
||||
public static readonly Field MemberId = FindByName("MemberId");
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
public static readonly Field Major = FindByName("Major");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得团队成员字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public const String TeamId = "TeamId";
|
||||
|
||||
/// <summary>成员</summary>
|
||||
public const String MemberId = "MemberId";
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
public const String Major = "Major";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>团队成员。每个团队拥有哪些成员,每个成员有一个主力团队接口</summary>
|
||||
public partial interface ITeamMember
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>团队</summary>
|
||||
Int32 TeamId { get; set; }
|
||||
|
||||
/// <summary>成员</summary>
|
||||
Int32 MemberId { get; set; }
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
Boolean Major { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>成员。所有可用团队成员</summary>
|
||||
public partial class Member : Entity<Member>
|
||||
{
|
||||
#region 对象操作
|
||||
static Member()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(TeamId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
|
||||
// 单对象缓存
|
||||
var sc = Meta.SingleCache;
|
||||
sc.FindSlaveKeyMethod = k => Find(_.Name == k);
|
||||
sc.GetSlaveKeyMethod = e => e.Name;
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框
|
||||
if (Name.IsNullOrEmpty()) throw new ArgumentNullException(nameof(Name), "名称不能为空!");
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
|
||||
// 检查唯一索引
|
||||
// CheckExist(isNew, nameof(Name));
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Member[成员]数据……");
|
||||
|
||||
// var entity = new Member();
|
||||
// entity.ID = 0;
|
||||
// entity.Name = "abc";
|
||||
// entity.Kind = "abc";
|
||||
// entity.TeamId = 0;
|
||||
// entity.Enable = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Member[成员]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Team Team => Extends.Get(nameof(Team), k => Team.FindByID(TeamId));
|
||||
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("团队")]
|
||||
[Map(nameof(TeamId), typeof(Team), "ID")]
|
||||
public String TeamName => Team?.Name;
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Member FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据名称查找</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Member FindByName(String name)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Name == name);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache.GetItemWithSlaveKey(name) as Member;
|
||||
|
||||
return Find(_.Name == name);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<Member> Search(String name, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (!name.IsNullOrEmpty()) exp &= _.Name == name;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.Kind.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From Member Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<Member> _CategoryCache = new FieldCache<Member>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,337 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>成员。所有可用团队成员</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("成员。所有可用团队成员")]
|
||||
[BindIndex("IU_Member_Name", true, "Name")]
|
||||
[BindTable("Member", Description = "成员。所有可用团队成员", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class Member : IMember
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private String _Name;
|
||||
/// <summary>名称</summary>
|
||||
[DisplayName("名称")]
|
||||
[Description("名称")]
|
||||
[DataObjectField(false, false, false, 50)]
|
||||
[BindColumn("Name", "名称", "", Master = true)]
|
||||
public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }
|
||||
|
||||
private String _Kind;
|
||||
/// <summary>类型</summary>
|
||||
[DisplayName("类型")]
|
||||
[Description("类型")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Kind", "类型", "")]
|
||||
public String Kind { get => _Kind; set { if (OnPropertyChanging("Kind", value)) { _Kind = value; OnPropertyChanged("Kind"); } } }
|
||||
|
||||
private Int32 _TeamId;
|
||||
/// <summary>团队。所属主团队</summary>
|
||||
[DisplayName("团队")]
|
||||
[Description("团队。所属主团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TeamId", "团队。所属主团队", "")]
|
||||
public Int32 TeamId { get => _TeamId; set { if (OnPropertyChanging("TeamId", value)) { _TeamId = value; OnPropertyChanged("TeamId"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "Name": return _Name;
|
||||
case "Kind": return _Kind;
|
||||
case "TeamId": return _TeamId;
|
||||
case "Enable": return _Enable;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "Name": _Name = Convert.ToString(value); break;
|
||||
case "Kind": _Kind = Convert.ToString(value); break;
|
||||
case "TeamId": _TeamId = value.ToInt(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得成员字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public static readonly Field Name = FindByName("Name");
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public static readonly Field Kind = FindByName("Kind");
|
||||
|
||||
/// <summary>团队。所属主团队</summary>
|
||||
public static readonly Field TeamId = FindByName("TeamId");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得成员字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>名称</summary>
|
||||
public const String Name = "Name";
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public const String Kind = "Kind";
|
||||
|
||||
/// <summary>团队。所属主团队</summary>
|
||||
public const String TeamId = "TeamId";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>成员。所有可用团队成员接口</summary>
|
||||
public partial interface IMember
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>名称</summary>
|
||||
String Name { get; set; }
|
||||
|
||||
/// <summary>类型</summary>
|
||||
String Kind { get; set; }
|
||||
|
||||
/// <summary>团队。所属主团队</summary>
|
||||
Int32 TeamId { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>版本成员</summary>
|
||||
public partial class VersionMember : Entity<VersionMember>
|
||||
{
|
||||
#region 对象操作
|
||||
static VersionMember()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(VersionId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化VersionMember[版本成员]数据……");
|
||||
|
||||
// var entity = new VersionMember();
|
||||
// entity.ID = 0;
|
||||
// entity.VersionId = 0;
|
||||
// entity.MemberId = 0;
|
||||
// entity.StartDate = DateTime.Now;
|
||||
// entity.EndDate = DateTime.Now;
|
||||
// entity.ManHours = 0;
|
||||
// entity.Major = true;
|
||||
// entity.Enable = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化VersionMember[版本成员]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
/// <summary>成员</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Member Member => Extends.Get(nameof(Member), k => Member.FindByID(MemberId));
|
||||
|
||||
/// <summary>成员</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("成员")]
|
||||
[Map(nameof(MemberId), typeof(Member), "ID")]
|
||||
public String MemberName => Member?.Name;
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static VersionMember FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据版本查找</summary>
|
||||
/// <param name="versionId">版本</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionMember> FindAllByVersionId(Int32 versionId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.VersionId == versionId);
|
||||
|
||||
return FindAll(_.VersionId == versionId);
|
||||
}
|
||||
|
||||
/// <summary>根据成员查找</summary>
|
||||
/// <param name="memberId">成员</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionMember> FindAllByMemberId(Int32 memberId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.MemberId == memberId);
|
||||
|
||||
return FindAll(_.MemberId == memberId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="versionId">版本</param>
|
||||
/// <param name="memberId">成员</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionMember> Search(Int32 versionId, Int32 memberId, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (versionId >= 0) exp &= _.VersionId == versionId;
|
||||
if (memberId >= 0) exp &= _.MemberId == memberId;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From VersionMember Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<VersionMember> _CategoryCache = new FieldCache<VersionMember>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,395 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>版本成员</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("版本成员")]
|
||||
[BindIndex("IX_VersionMember_VersionId", false, "VersionId")]
|
||||
[BindIndex("IX_VersionMember_MemberId", false, "MemberId")]
|
||||
[BindTable("VersionMember", Description = "版本成员", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class VersionMember : IVersionMember
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private Int32 _VersionId;
|
||||
/// <summary>版本</summary>
|
||||
[DisplayName("版本")]
|
||||
[Description("版本")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("VersionId", "版本", "")]
|
||||
public Int32 VersionId { get => _VersionId; set { if (OnPropertyChanging("VersionId", value)) { _VersionId = value; OnPropertyChanged("VersionId"); } } }
|
||||
|
||||
private Int32 _MemberId;
|
||||
/// <summary>成员</summary>
|
||||
[DisplayName("成员")]
|
||||
[Description("成员")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("MemberId", "成员", "")]
|
||||
public Int32 MemberId { get => _MemberId; set { if (OnPropertyChanging("MemberId", value)) { _MemberId = value; OnPropertyChanged("MemberId"); } } }
|
||||
|
||||
private DateTime _StartDate;
|
||||
/// <summary>开始日期</summary>
|
||||
[DisplayName("开始日期")]
|
||||
[Description("开始日期")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("StartDate", "开始日期", "")]
|
||||
public DateTime StartDate { get => _StartDate; set { if (OnPropertyChanging("StartDate", value)) { _StartDate = value; OnPropertyChanged("StartDate"); } } }
|
||||
|
||||
private DateTime _EndDate;
|
||||
/// <summary>结束日期</summary>
|
||||
[DisplayName("结束日期")]
|
||||
[Description("结束日期")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("EndDate", "结束日期", "")]
|
||||
public DateTime EndDate { get => _EndDate; set { if (OnPropertyChanging("EndDate", value)) { _EndDate = value; OnPropertyChanged("EndDate"); } } }
|
||||
|
||||
private Int32 _ManHours;
|
||||
/// <summary>工时</summary>
|
||||
[DisplayName("工时")]
|
||||
[Description("工时")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ManHours", "工时", "")]
|
||||
public Int32 ManHours { get => _ManHours; set { if (OnPropertyChanging("ManHours", value)) { _ManHours = value; OnPropertyChanged("ManHours"); } } }
|
||||
|
||||
private Boolean _Major;
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
[DisplayName("主要")]
|
||||
[Description("主要。是否该成员的主要团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Major", "主要。是否该成员的主要团队", "")]
|
||||
public Boolean Major { get => _Major; set { if (OnPropertyChanging("Major", value)) { _Major = value; OnPropertyChanged("Major"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "VersionId": return _VersionId;
|
||||
case "MemberId": return _MemberId;
|
||||
case "StartDate": return _StartDate;
|
||||
case "EndDate": return _EndDate;
|
||||
case "ManHours": return _ManHours;
|
||||
case "Major": return _Major;
|
||||
case "Enable": return _Enable;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "VersionId": _VersionId = value.ToInt(); break;
|
||||
case "MemberId": _MemberId = value.ToInt(); break;
|
||||
case "StartDate": _StartDate = value.ToDateTime(); break;
|
||||
case "EndDate": _EndDate = value.ToDateTime(); break;
|
||||
case "ManHours": _ManHours = value.ToInt(); break;
|
||||
case "Major": _Major = value.ToBoolean(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得版本成员字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>版本</summary>
|
||||
public static readonly Field VersionId = FindByName("VersionId");
|
||||
|
||||
/// <summary>成员</summary>
|
||||
public static readonly Field MemberId = FindByName("MemberId");
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
public static readonly Field StartDate = FindByName("StartDate");
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
public static readonly Field EndDate = FindByName("EndDate");
|
||||
|
||||
/// <summary>工时</summary>
|
||||
public static readonly Field ManHours = FindByName("ManHours");
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
public static readonly Field Major = FindByName("Major");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得版本成员字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>版本</summary>
|
||||
public const String VersionId = "VersionId";
|
||||
|
||||
/// <summary>成员</summary>
|
||||
public const String MemberId = "MemberId";
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
public const String StartDate = "StartDate";
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
public const String EndDate = "EndDate";
|
||||
|
||||
/// <summary>工时</summary>
|
||||
public const String ManHours = "ManHours";
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
public const String Major = "Major";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>版本成员接口</summary>
|
||||
public partial interface IVersionMember
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>版本</summary>
|
||||
Int32 VersionId { get; set; }
|
||||
|
||||
/// <summary>成员</summary>
|
||||
Int32 MemberId { get; set; }
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
DateTime EndDate { get; set; }
|
||||
|
||||
/// <summary>工时</summary>
|
||||
Int32 ManHours { get; set; }
|
||||
|
||||
/// <summary>主要。是否该成员的主要团队</summary>
|
||||
Boolean Major { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>版本计划</summary>
|
||||
public partial class VersionPlan : Entity<VersionPlan>
|
||||
{
|
||||
#region 对象操作
|
||||
static VersionPlan()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(TeamId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<UserModule>();
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
Meta.Modules.Add<IPModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框
|
||||
if (Name.IsNullOrEmpty()) throw new ArgumentNullException(nameof(Name), "名称不能为空!");
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 处理当前已登录用户信息,可以由UserModule过滤器代劳
|
||||
/*var user = ManageProvider.User;
|
||||
if (user != null)
|
||||
{
|
||||
if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
|
||||
if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
|
||||
}*/
|
||||
//if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
//if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
|
||||
//if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化VersionPlan[版本计划]数据……");
|
||||
|
||||
// var entity = new VersionPlan();
|
||||
// entity.ID = 0;
|
||||
// entity.TeamId = 0;
|
||||
// entity.ProductId = 0;
|
||||
// entity.Name = "abc";
|
||||
// entity.Kind = 0;
|
||||
// entity.StartDate = DateTime.Now;
|
||||
// entity.EndDate = DateTime.Now;
|
||||
// entity.ManHours = 0;
|
||||
// entity.Enable = true;
|
||||
// entity.CreateUser = "abc";
|
||||
// entity.CreateUserID = 0;
|
||||
// entity.CreateIP = "abc";
|
||||
// entity.CreateTime = DateTime.Now;
|
||||
// entity.UpdateUser = "abc";
|
||||
// entity.UpdateUserID = 0;
|
||||
// entity.UpdateIP = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Remark = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化VersionPlan[版本计划]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Team Team => Extends.Get(nameof(Team), k => Team.FindByID(TeamId));
|
||||
|
||||
/// <summary>团队</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("团队")]
|
||||
[Map(nameof(TeamId), typeof(Team), "ID")]
|
||||
public String TeamName => Team?.Name;
|
||||
/// <summary>产品</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
public Product Product => Extends.Get(nameof(Product), k => Product.FindByID(ProductId));
|
||||
|
||||
/// <summary>产品</summary>
|
||||
[XmlIgnore, IgnoreDataMember]
|
||||
//[ScriptIgnore]
|
||||
[DisplayName("产品")]
|
||||
[Map(nameof(ProductId), typeof(Product), "ID")]
|
||||
public String ProductName => Product?.Name;
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static VersionPlan FindByID(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.ID == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.ID == id);
|
||||
}
|
||||
|
||||
/// <summary>根据团队查找</summary>
|
||||
/// <param name="teamId">团队</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionPlan> FindAllByTeamId(Int32 teamId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TeamId == teamId);
|
||||
|
||||
return FindAll(_.TeamId == teamId);
|
||||
}
|
||||
|
||||
/// <summary>根据产品查找</summary>
|
||||
/// <param name="productId">产品</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionPlan> FindAllByProductId(Int32 productId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.ProductId == productId);
|
||||
|
||||
return FindAll(_.ProductId == productId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="teamId">团队</param>
|
||||
/// <param name="productId">产品</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<VersionPlan> Search(Int32 teamId, Int32 productId, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (teamId >= 0) exp &= _.TeamId == teamId;
|
||||
if (productId >= 0) exp &= _.ProductId == productId;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.Name.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(ID) as ID,Category From VersionPlan Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By ID Desc limit 20
|
||||
//static readonly FieldCache<VersionPlan> _CategoryCache = new FieldCache<VersionPlan>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,414 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace Zero.Data.Projects
|
||||
{
|
||||
/// <summary>版本计划</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("版本计划")]
|
||||
[BindIndex("IX_VersionPlan_TeamId", false, "TeamId")]
|
||||
[BindIndex("IX_VersionPlan_ProductId", false, "ProductId")]
|
||||
[BindTable("VersionPlan", Description = "版本计划", ConnName = "Zero", DbType = DatabaseType.None)]
|
||||
public partial class VersionPlan : IVersionPlan
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _ID;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("ID", "编号", "")]
|
||||
public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }
|
||||
|
||||
private Int32 _TeamId;
|
||||
/// <summary>团队</summary>
|
||||
[DisplayName("团队")]
|
||||
[Description("团队")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TeamId", "团队", "")]
|
||||
public Int32 TeamId { get => _TeamId; set { if (OnPropertyChanging("TeamId", value)) { _TeamId = value; OnPropertyChanged("TeamId"); } } }
|
||||
|
||||
private Int32 _ProductId;
|
||||
/// <summary>产品</summary>
|
||||
[DisplayName("产品")]
|
||||
[Description("产品")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ProductId", "产品", "")]
|
||||
public Int32 ProductId { get => _ProductId; set { if (OnPropertyChanging("ProductId", value)) { _ProductId = value; OnPropertyChanged("ProductId"); } } }
|
||||
|
||||
private String _Name;
|
||||
/// <summary>名称。版本号</summary>
|
||||
[DisplayName("名称")]
|
||||
[Description("名称。版本号")]
|
||||
[DataObjectField(false, false, false, 50)]
|
||||
[BindColumn("Name", "名称。版本号", "", Master = true)]
|
||||
public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }
|
||||
|
||||
private Int32 _Kind;
|
||||
/// <summary>类型。常规/紧急</summary>
|
||||
[DisplayName("类型")]
|
||||
[Description("类型。常规/紧急")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Kind", "类型。常规/紧急", "")]
|
||||
public Int32 Kind { get => _Kind; set { if (OnPropertyChanging("Kind", value)) { _Kind = value; OnPropertyChanged("Kind"); } } }
|
||||
|
||||
private DateTime _StartDate;
|
||||
/// <summary>开始日期</summary>
|
||||
[DisplayName("开始日期")]
|
||||
[Description("开始日期")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("StartDate", "开始日期", "")]
|
||||
public DateTime StartDate { get => _StartDate; set { if (OnPropertyChanging("StartDate", value)) { _StartDate = value; OnPropertyChanged("StartDate"); } } }
|
||||
|
||||
private DateTime _EndDate;
|
||||
/// <summary>结束日期</summary>
|
||||
[DisplayName("结束日期")]
|
||||
[Description("结束日期")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("EndDate", "结束日期", "")]
|
||||
public DateTime EndDate { get => _EndDate; set { if (OnPropertyChanging("EndDate", value)) { _EndDate = value; OnPropertyChanged("EndDate"); } } }
|
||||
|
||||
private Int32 _ManHours;
|
||||
/// <summary>工时</summary>
|
||||
[DisplayName("工时")]
|
||||
[Description("工时")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ManHours", "工时", "")]
|
||||
public Int32 ManHours { get => _ManHours; set { if (OnPropertyChanging("ManHours", value)) { _ManHours = value; OnPropertyChanged("ManHours"); } } }
|
||||
|
||||
private Boolean _Enable;
|
||||
/// <summary>启用</summary>
|
||||
[DisplayName("启用")]
|
||||
[Description("启用")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Enable", "启用", "")]
|
||||
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
|
||||
|
||||
private String _CreateUser;
|
||||
/// <summary>创建者</summary>
|
||||
[DisplayName("创建者")]
|
||||
[Description("创建者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateUser", "创建者", "")]
|
||||
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
|
||||
|
||||
private Int32 _CreateUserID;
|
||||
/// <summary>创建人</summary>
|
||||
[DisplayName("创建人")]
|
||||
[Description("创建人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CreateUserID", "创建人", "")]
|
||||
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
|
||||
|
||||
private String _CreateIP;
|
||||
/// <summary>创建地址</summary>
|
||||
[DisplayName("创建地址")]
|
||||
[Description("创建地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("CreateIP", "创建地址", "")]
|
||||
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
|
||||
|
||||
private DateTime _CreateTime;
|
||||
/// <summary>创建时间</summary>
|
||||
[DisplayName("创建时间")]
|
||||
[Description("创建时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("CreateTime", "创建时间", "")]
|
||||
public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }
|
||||
|
||||
private String _UpdateUser;
|
||||
/// <summary>更新者</summary>
|
||||
[DisplayName("更新者")]
|
||||
[Description("更新者")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateUser", "更新者", "")]
|
||||
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
|
||||
|
||||
private Int32 _UpdateUserID;
|
||||
/// <summary>更新人</summary>
|
||||
[DisplayName("更新人")]
|
||||
[Description("更新人")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UpdateUserID", "更新人", "")]
|
||||
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
|
||||
|
||||
private String _UpdateIP;
|
||||
/// <summary>更新地址</summary>
|
||||
[DisplayName("更新地址")]
|
||||
[Description("更新地址")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UpdateIP", "更新地址", "")]
|
||||
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>更新时间</summary>
|
||||
[DisplayName("更新时间")]
|
||||
[Description("更新时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "更新时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
|
||||
|
||||
private String _Remark;
|
||||
/// <summary>备注</summary>
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 500)]
|
||||
[BindColumn("Remark", "备注", "")]
|
||||
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": return _ID;
|
||||
case "TeamId": return _TeamId;
|
||||
case "ProductId": return _ProductId;
|
||||
case "Name": return _Name;
|
||||
case "Kind": return _Kind;
|
||||
case "StartDate": return _StartDate;
|
||||
case "EndDate": return _EndDate;
|
||||
case "ManHours": return _ManHours;
|
||||
case "Enable": return _Enable;
|
||||
case "CreateUser": return _CreateUser;
|
||||
case "CreateUserID": return _CreateUserID;
|
||||
case "CreateIP": return _CreateIP;
|
||||
case "CreateTime": return _CreateTime;
|
||||
case "UpdateUser": return _UpdateUser;
|
||||
case "UpdateUserID": return _UpdateUserID;
|
||||
case "UpdateIP": return _UpdateIP;
|
||||
case "UpdateTime": return _UpdateTime;
|
||||
case "Remark": return _Remark;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "ID": _ID = value.ToInt(); break;
|
||||
case "TeamId": _TeamId = value.ToInt(); break;
|
||||
case "ProductId": _ProductId = value.ToInt(); break;
|
||||
case "Name": _Name = Convert.ToString(value); break;
|
||||
case "Kind": _Kind = value.ToInt(); break;
|
||||
case "StartDate": _StartDate = value.ToDateTime(); break;
|
||||
case "EndDate": _EndDate = value.ToDateTime(); break;
|
||||
case "ManHours": _ManHours = value.ToInt(); break;
|
||||
case "Enable": _Enable = value.ToBoolean(); break;
|
||||
case "CreateUser": _CreateUser = Convert.ToString(value); break;
|
||||
case "CreateUserID": _CreateUserID = value.ToInt(); break;
|
||||
case "CreateIP": _CreateIP = Convert.ToString(value); break;
|
||||
case "CreateTime": _CreateTime = value.ToDateTime(); break;
|
||||
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
|
||||
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
|
||||
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
|
||||
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
|
||||
case "Remark": _Remark = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得版本计划字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field ID = FindByName("ID");
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public static readonly Field TeamId = FindByName("TeamId");
|
||||
|
||||
/// <summary>产品</summary>
|
||||
public static readonly Field ProductId = FindByName("ProductId");
|
||||
|
||||
/// <summary>名称。版本号</summary>
|
||||
public static readonly Field Name = FindByName("Name");
|
||||
|
||||
/// <summary>类型。常规/紧急</summary>
|
||||
public static readonly Field Kind = FindByName("Kind");
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
public static readonly Field StartDate = FindByName("StartDate");
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
public static readonly Field EndDate = FindByName("EndDate");
|
||||
|
||||
/// <summary>工时</summary>
|
||||
public static readonly Field ManHours = FindByName("ManHours");
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public static readonly Field Enable = FindByName("Enable");
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public static readonly Field CreateUser = FindByName("CreateUser");
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public static readonly Field CreateUserID = FindByName("CreateUserID");
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public static readonly Field CreateIP = FindByName("CreateIP");
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public static readonly Field CreateTime = FindByName("CreateTime");
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public static readonly Field UpdateUser = FindByName("UpdateUser");
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public static readonly Field UpdateIP = FindByName("UpdateIP");
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName("UpdateTime");
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public static readonly Field Remark = FindByName("Remark");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得版本计划字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String ID = "ID";
|
||||
|
||||
/// <summary>团队</summary>
|
||||
public const String TeamId = "TeamId";
|
||||
|
||||
/// <summary>产品</summary>
|
||||
public const String ProductId = "ProductId";
|
||||
|
||||
/// <summary>名称。版本号</summary>
|
||||
public const String Name = "Name";
|
||||
|
||||
/// <summary>类型。常规/紧急</summary>
|
||||
public const String Kind = "Kind";
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
public const String StartDate = "StartDate";
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
public const String EndDate = "EndDate";
|
||||
|
||||
/// <summary>工时</summary>
|
||||
public const String ManHours = "ManHours";
|
||||
|
||||
/// <summary>启用</summary>
|
||||
public const String Enable = "Enable";
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
public const String CreateUser = "CreateUser";
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public const String CreateUserID = "CreateUserID";
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
public const String CreateIP = "CreateIP";
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public const String CreateTime = "CreateTime";
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
public const String UpdateUser = "UpdateUser";
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
public const String UpdateUserID = "UpdateUserID";
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
public const String UpdateIP = "UpdateIP";
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public const String Remark = "Remark";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>版本计划接口</summary>
|
||||
public partial interface IVersionPlan
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 ID { get; set; }
|
||||
|
||||
/// <summary>团队</summary>
|
||||
Int32 TeamId { get; set; }
|
||||
|
||||
/// <summary>产品</summary>
|
||||
Int32 ProductId { get; set; }
|
||||
|
||||
/// <summary>名称。版本号</summary>
|
||||
String Name { get; set; }
|
||||
|
||||
/// <summary>类型。常规/紧急</summary>
|
||||
Int32 Kind { get; set; }
|
||||
|
||||
/// <summary>开始日期</summary>
|
||||
DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>结束日期</summary>
|
||||
DateTime EndDate { get; set; }
|
||||
|
||||
/// <summary>工时</summary>
|
||||
Int32 ManHours { get; set; }
|
||||
|
||||
/// <summary>启用</summary>
|
||||
Boolean Enable { get; set; }
|
||||
|
||||
/// <summary>创建者</summary>
|
||||
String CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
Int32 CreateUserID { get; set; }
|
||||
|
||||
/// <summary>创建地址</summary>
|
||||
String CreateIP { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>更新者</summary>
|
||||
String UpdateUser { get; set; }
|
||||
|
||||
/// <summary>更新人</summary>
|
||||
Int32 UpdateUserID { get; set; }
|
||||
|
||||
/// <summary>更新地址</summary>
|
||||
String UpdateIP { get; set; }
|
||||
|
||||
/// <summary>更新时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
String Remark { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AssemblyTitle>零代数据层</AssemblyTitle>
|
||||
<Description>Web应用、微服务、应用服务器、大数据计算等共用数据层,主要包括数据层实体类</Description>
|
||||
<Company>新生命开发团队</Company>
|
||||
<Copyright>©2002-2020 NewLife</Copyright>
|
||||
<Version>1.0.2020.0801</Version>
|
||||
<FileVersion>1.0.2020.0801</FileVersion>
|
||||
<AssemblyVersion>1.0.*</AssemblyVersion>
|
||||
<Deterministic>false</Deterministic>
|
||||
<OutputPath>..\Bin</OutputPath>
|
||||
<DocumentationFile>$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
|
||||
<DefineConstants>$(DefineConstants);__CORE__;STD20</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Projects\Config\**" />
|
||||
<Compile Remove="Projects\Log\**" />
|
||||
<EmbeddedResource Remove="Projects\Config\**" />
|
||||
<EmbeddedResource Remove="Projects\Log\**" />
|
||||
<None Remove="Projects\Config\**" />
|
||||
<None Remove="Projects\Log\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.18.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Zero.Core\Zero.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Projects\Build.log">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Build.tt</DependentUpon>
|
||||
</None>
|
||||
<None Update="Projects\Build.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Build.log</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Zero.Server
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OA.Web.Models;
|
||||
|
||||
namespace OA.Web.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace OA.Web.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace OA.Web
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:2022",
|
||||
"sslPort": 44327
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"OA.Web": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace OA.Web
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllersWithViews();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
@ -0,0 +1,25 @@
|
|||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - OA.Web</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">OA.Web</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2020 - OA.Web - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
|
@ -0,0 +1,3 @@
|
|||
@using OA.Web
|
||||
@using OA.Web.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@ -0,0 +1,3 @@
|
|||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
<PackageReference Include="NewLife.Cube.Core" Version="3.6.2020.709" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.18.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Zero.Core\Zero.Core.csproj" />
|
||||
<ProjectReference Include="..\Zero.Data\Zero.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Zero.WebApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
var rng = new Random();
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = rng.Next(-20, 55),
|
||||
Summary = Summaries[rng.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Zero.WebApi
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:18527",
|
||||
"sslPort": 44366
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Zero.WebApi": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Zero.WebApi
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Zero.WebApi
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string Summary { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.8.2020.701" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30320.27
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{646A665A-1143-44ED-948F-3E00749DEA75}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zero.Data", "Zero.Data\Zero.Data.csproj", "{9F174334-B067-4826-9934-80B1ED103810}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zero.Web", "Zero.Web\Zero.Web.csproj", "{517ACFC9-2727-4931-B06D-4B073B8CDE55}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zero.Core", "Zero.Core\Zero.Core.csproj", "{A456F9A4-C2C1-4DA0-BB49-302A3A2C78B2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zero.Agent", "Zero.Agent\Zero.Agent.csproj", "{CDDFD803-5973-4AB9-9079-CB7A6CE85A40}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zero.AntJob", "Zero.AntJob\Zero.AntJob.csproj", "{E59E32C0-DA0C-4983-A6DF-BD42A994EC35}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zero.WebApi", "Zero.WebApi\Zero.WebApi.csproj", "{11AA0791-B891-40F9-94F4-07AC339C9C95}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zero.Server", "Zero.Server\Zero.Server.csproj", "{8BEB2416-E98A-4F8D-AFC8-EA3F61001553}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9F174334-B067-4826-9934-80B1ED103810}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9F174334-B067-4826-9934-80B1ED103810}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9F174334-B067-4826-9934-80B1ED103810}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9F174334-B067-4826-9934-80B1ED103810}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{517ACFC9-2727-4931-B06D-4B073B8CDE55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{517ACFC9-2727-4931-B06D-4B073B8CDE55}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{517ACFC9-2727-4931-B06D-4B073B8CDE55}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{517ACFC9-2727-4931-B06D-4B073B8CDE55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A456F9A4-C2C1-4DA0-BB49-302A3A2C78B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A456F9A4-C2C1-4DA0-BB49-302A3A2C78B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A456F9A4-C2C1-4DA0-BB49-302A3A2C78B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A456F9A4-C2C1-4DA0-BB49-302A3A2C78B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CDDFD803-5973-4AB9-9079-CB7A6CE85A40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDDFD803-5973-4AB9-9079-CB7A6CE85A40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDDFD803-5973-4AB9-9079-CB7A6CE85A40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDDFD803-5973-4AB9-9079-CB7A6CE85A40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E59E32C0-DA0C-4983-A6DF-BD42A994EC35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E59E32C0-DA0C-4983-A6DF-BD42A994EC35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E59E32C0-DA0C-4983-A6DF-BD42A994EC35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E59E32C0-DA0C-4983-A6DF-BD42A994EC35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{11AA0791-B891-40F9-94F4-07AC339C9C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{11AA0791-B891-40F9-94F4-07AC339C9C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{11AA0791-B891-40F9-94F4-07AC339C9C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{11AA0791-B891-40F9-94F4-07AC339C9C95}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8BEB2416-E98A-4F8D-AFC8-EA3F61001553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8BEB2416-E98A-4F8D-AFC8-EA3F61001553}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BEB2416-E98A-4F8D-AFC8-EA3F61001553}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BEB2416-E98A-4F8D-AFC8-EA3F61001553}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BE924F3A-C35B-41BB-9987-B45CA13A8723}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue