ソースを参照

处理子集相同字段标签

lichunlei 3 ヶ月 前
コミット
28a0d76ab7
2 ファイル変更21 行追加7 行削除
  1. 4 4
      Task/MakeHelper.cs
  2. 17 3
      Util/Maker.cs

+ 4 - 4
Task/MakeHelper.cs

@@ -40,10 +40,10 @@ namespace Tasks
                 string requestId = jsonObj["requestId"].ToString();
                 //模板文件路径
                 string modePath = jsonObj["modePath"].ToString();
-                // if(modePath.Contains("controller") && content.Contains("DoubleAward"))
-                // {
-                //     string packageName = "123123123";
-                // }
+                if(modePath.Contains("serviceImpl") && content.Contains("HtTest"))
+                {
+                    string packageName = "123123123";
+                }
                 //附加数据,原样返回
                 JsonData attach = JsonMapper.ToObject(jsonObj["attach"].ToString());
                 string versionNo = attach["versionNo"].ToString();

+ 17 - 3
Util/Maker.cs

@@ -103,7 +103,14 @@ namespace Util
                                 {
                                     Dictionary<string, string> replaceDict = new Dictionary<string, string>();
                                     int index = 0;
-                                    MatchCollection subLoops = Regex.Matches(itemString, "<<.*?>>");
+                                    MatchCollection subLoops = Regex.Matches(itemString, "<<ym-loop:.*?>>[\\s\\S]*?<</ym-loop:.*?>>");
+                                    foreach (Match subLoop in subLoops)
+                                    {
+                                        index += 1;
+                                        itemString = itemString.Replace(subLoop.Value, "${tag" + index + "}$");
+                                        replaceDict.Add("tag" + index, subLoop.Value);
+                                    }
+                                    MatchCollection subLoops = Regex.Matches(itemString, "<<ym-item:.*?>>[\\s\\S]*?<</ym-item:.*?>>");
                                     foreach (Match subLoop in subLoops)
                                     {
                                         index += 1;
@@ -180,11 +187,18 @@ namespace Util
                             {
                                 Dictionary<string, string> replaceDict = new Dictionary<string, string>();
                                 int index = 0;
-                                MatchCollection subLoops = Regex.Matches(itemString, "<<.*?>>");
+                                MatchCollection subLoops = Regex.Matches(itemString, "<<ym-loop:.*?>>[\\s\\S]*?<</ym-loop:.*?>>");
+                                foreach (Match subLoop in subLoops)
+                                {
+                                    index += 1;
+                                    itemString = itemString.Replace(subLoop.Value, "${tag" + index + "}$");
+                                    replaceDict.Add("tag" + index, subLoop.Value);
+                                }
+                                MatchCollection subLoops = Regex.Matches(itemString, "<<ym-item:.*?>>[\\s\\S]*?<</ym-item:.*?>>");
                                 foreach (Match subLoop in subLoops)
                                 {
                                     index += 1;
-                                    itemString = Regex.Replace(itemString, subLoop.Value, "${tag" + index + "}$");
+                                    itemString = itemString.Replace(subLoop.Value, "${tag" + index + "}$");
                                     replaceDict.Add("tag" + index, subLoop.Value);
                                 }
                                 itemString = itemString.Replace("<<" + itemKey + ">>", itemObj.ToString());