From 6eb23017d39889cbcace0b2a85ebb93b81220d08 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周日, 04 5月 2025 10:31:20 +0800
Subject: [PATCH] 222
---
Weben_CMS专用代码生成器/Code/MainForm.cs | 14 ++++
Weben_CMS专用代码生成器/Code/Model/GenerateCodeParam.cs | 40 +++++++++++++
Weben_CMS专用代码生成器/Code/Generate/Entity/InputModel_Generate.cs | 17 ++---
Weben_CMS专用代码生成器/Code/Templete/Entity/InputQueryModel模板.txt | 90 ++++++++++++++++++++++++++++++
Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj | 4 +
Weben_CMS专用代码生成器/Code/Utility/CommonHelper.cs | 15 ++++
6 files changed, 167 insertions(+), 13 deletions(-)
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/Entity/InputModel_Generate.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/Entity/InputModel_Generate.cs"
index d2e34cf..350ee04 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/Entity/InputModel_Generate.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Generate/Entity/InputModel_Generate.cs"
@@ -1,5 +1,6 @@
锘�
+using GenerateCode_WeiBen_WMS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,21 +13,17 @@
/// </summary>
public class InputModel_Generate : BaseGenerate
{
- public static string CreateQueryModelLText(string Modulelogo,
- string ChinaComment, List<ColumnModel> columnNameList, string entityName)
+ public static string CreateQueryModelLText(GenerateCodeParam param)
{
- var str = TextHelper.ReadText(@"Templete\Entity\InputModel妯℃澘.txt");
+ var str = TextHelper.ReadText(@"Templete\Entity\InputQueryModel妯℃澘.txt");
CommonReplace(ref str);
- str = str.Replace("$ChinaComment$", ChinaComment);//涓枃娉ㄩ噴
- str = str.Replace("$EntityName$", entityName);
-
- str = str.Replace("$Modulelogo$", Modulelogo);//妯″潡绠�鍐�
+
//澶勭悊 鍒嗛〉鏌ヨ閮ㄥ垎
string attrString = "";
- List<ColumnModel> newColumnNameList = ListHelper.OnlyRemoveId(columnNameList);
+ List<ColumnModel> newColumnNameList = ListHelper.OnlyRemoveId(param.ColumnNameList);
for (int i = 0; i < newColumnNameList.Count; ++i)
{
attrString += StructStrHelper.GenerateAttributeForQueryModel(newColumnNameList[i]);
@@ -36,10 +33,10 @@
//澶勭悊 鏂板閮ㄥ垎
attrString = "";
- newColumnNameList = ListHelper.RemoveIdCreatorModifier(columnNameList);
+ newColumnNameList = ListHelper.RemoveIdCreatorModifier(param.ColumnNameList);
for (int i = 0; i < newColumnNameList.Count; ++i)
{
- attrString += StructStrHelper.GenerateAttribute(i,newColumnNameList[i]);
+ attrString += StructStrHelper.GenerateAttribute(i, newColumnNameList[i]);
}
str = str.Replace("$AddAttributes$", attrString);
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
index b0f4400..05b343c 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
@@ -119,6 +119,7 @@
<Compile Include="Generate\BLL_Generate.cs" />
<Compile Include="Generate\DAL_Generate.cs" />
<Compile Include="Generate\Procedure_Generate.cs" />
+ <Compile Include="Model\GenerateCodeParam.cs" />
<Compile Include="Model\Enum\DataBaseEnum.cs" />
<Compile Include="Model\Enum\DataTypeEnum.cs" />
<Compile Include="Model\ListItem.cs" />
@@ -190,6 +191,9 @@
<Content Include="Templete\Entity\AddModel妯℃澘.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="Templete\Entity\InputQueryModel妯℃澘.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="Templete\Entity\OutputModel妯℃澘.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs"
index 0c0bbff..577ca9b 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs"
@@ -7,6 +7,7 @@
using System.Windows.Forms.VisualStyles;
using GenerateCode_WeiBen_WMS.DataBaseFactory;
using GenerateCode_WeiBen_WMS.Const;
+using GenerateCode_WeiBen_WMS.Model;
namespace GenerateCode_GEBrilliantFactory
{
@@ -154,12 +155,21 @@
string str_generate = "";
bool tf;
+ GenerateCodeParam param = new GenerateCodeParam()
+ {
+ Modulelogo = modulelogo,
+ ChinaComment = chinaComment,
+ NameSpacePath = wcf_NameSpacePath,
+ ColumnNameList = columnList,
+ EntityName = entityName
+ };
+
//鐢熸垚Model
//CreateModelFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
//CreateModelParamFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
- //鐢熸垚 InputModel 鏂囦欢
- str_generate = InputModel_Generate.CreateQueryModelLText(modulelogo, chinaComment, columnList, entityName);
+ //1銆佺敓鎴� 鍒嗛〉鏌ヨ 鏂囦欢
+ str_generate = InputModel_Generate.CreateQueryModelLText(param);
tf = TextHelper.Export2File_V2(tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim(), tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
////鐢熸垚 OutputModel 鏂囦欢
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Model/GenerateCodeParam.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Model/GenerateCodeParam.cs"
new file mode 100644
index 0000000..79e5f6d
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Model/GenerateCodeParam.cs"
@@ -0,0 +1,40 @@
+锘縰sing GenerateCode_GEBrilliantFactory;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GenerateCode_WeiBen_WMS.Model
+{
+ /// <summary>
+ /// 鐢熸垚浠g爜鍙傛暟
+ /// </summary>
+ public class GenerateCodeParam
+ {
+ /// <summary>
+ /// 妯″潡绠�鍐�
+ /// </summary>
+ public string Modulelogo { get; set; }
+
+ /// <summary>
+ /// 涓枃娉ㄩ噴
+ /// </summary>
+ public string ChinaComment { get; set; }
+
+ /// <summary>
+ /// 鍒楀悕鍒楄〃
+ /// </summary>
+ public List<ColumnModel> ColumnNameList { get; set; } = new List<ColumnModel>();
+
+ /// <summary>
+ /// 瀹炰綋鍚嶇О
+ /// </summary>
+ public string EntityName { get; set; }
+
+ /// <summary>
+ /// 鍛藉悕绌洪棿
+ /// </summary>
+ public string NameSpacePath { get; set; }
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Entity/InputQueryModel\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Entity/InputQueryModel\346\250\241\346\235\277.txt"
new file mode 100644
index 0000000..4e29126
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Entity/InputQueryModel\346\250\241\346\235\277.txt"
@@ -0,0 +1,90 @@
+using CmsQueryExtensions.Extension;
+using Volo.Abp.Application.Dtos;
+
+namespace CMS.Plugin.$NameSpacePath$.Application.Contracts.Dtos.$EntityName$;
+
+/// <summary>
+/// $ChinaComment$查询参数
+/// </summary>
+public class Get$EntityName$Input : ExtensiblePagedAndSortedResultRequestDto
+{
+
+ #region 关键字查询
+
+ /// <summary>
+ /// 关键字模糊查询(注意是小写!)
+ /// </summary>
+ public string searchVal { get; set; }
+
+ /// <summary>
+ /// 通用查询配置 (1:模糊查询 , 2:精准查询)(注意是小写!)
+ /// </summary>
+ public SearchFilterModeEnum searchVal_FilterMode { get; set; } = SearchFilterModeEnum.模糊查询;
+
+ /// <summary>
+ /// 子搜索组件传递的通用查询配置的属性名(注意是小写!)
+ /// </summary>
+ [NoAutoQuery]
+ public string str_searchFormInputAttrs { get; set; }
+ /// <summary>
+ /// 子搜索组件传递的通用查询配置的属性名(注意是小写!)
+ /// </summary>
+ public List<string> searchFormInputAttrs
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(str_searchFormInputAttrs))
+ {
+ return str_searchFormInputAttrs.Split(',').ToList();
+ }
+ return new List<string>();
+ }
+ }
+
+ #endregion
+
+ $QueryAttributes$
+}
+namespace Admin.NET.Application
+{
+ /// <summary>
+ /// 分页查询$ChinaComment$输入参数
+ /// </summary>
+ public class $EntityName$PageInput : PageInputCustomBase
+ {
+ $QueryAttributes$
+ }
+
+ /// <summary>
+ /// 新增$ChinaComment$输入参数
+ /// </summary>
+ public class Add$EntityName$Input : BasicsDEntity
+ {
+ $AddAttributes$
+ }
+
+ /// <summary>
+ /// 更新$ChinaComment$输入参数
+ /// </summary>
+ public class Update$EntityName$Input : Add$EntityName$Input
+ {
+ [Required(ErrorMessage = "Id主键不能为空")]
+ public virtual new long Id { get; set; }
+ }
+
+ /// <summary>
+ /// 删除$ChinaComment$输入参数
+ /// </summary>
+ public class Delete$EntityName$Input
+ {
+ public List<long> Id { get; set; }
+ }
+
+ /// <summary>
+ /// 单个查询$ChinaComment$输入参数
+ /// </summary>
+ public class Query$EntityName$Input : BaseId
+ {
+
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Utility/CommonHelper.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Utility/CommonHelper.cs"
index bbc2f09..3d358cd 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Utility/CommonHelper.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Utility/CommonHelper.cs"
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing GenerateCode_WeiBen_WMS.Model;
+using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
@@ -13,7 +14,19 @@
/// </summary>
public class CommonHelper
{
+ /// <summary>
+ /// 閫氱敤鏇挎崲瀛楃涓�
+ /// </summary>
+ /// <param name="param"></param>
+ /// <param name="str"></param>
+ public static void CommonReplaceStr(GenerateCodeParam param, ref string str)
+ {
+ str = str.Replace("$NameSpacePath$", param.NameSpacePath);//鍛藉悕绌洪棿
+ str = str.Replace("$ChinaComment$", param.ChinaComment);//涓枃娉ㄩ噴
+ str = str.Replace("$EntityName$", param.EntityName);//瀹炰綋绫诲悕
+ str = str.Replace("$Modulelogo$", param.Modulelogo);//妯″潡绠�鍐�
+ }
/// <summary>
/// 棣栧瓧姣嶅皬鍐�
--
Gitblit v1.9.3