فهرست منبع

java数据库模型模版完成,待测试

lichunlei 6 ماه پیش
والد
کامیت
ce0d2f09df

+ 3 - 1
Controllers/Base/HomeController.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.CodeAnalysis.CSharp.Scripting;
 using Model;
 using Model;
 using Nacos.V2.Remote;
 using Nacos.V2.Remote;
 
 
@@ -19,8 +20,9 @@ namespace Controllers
 
 
 
 
         [Route("/noauth/pub/test")]
         [Route("/noauth/pub/test")]
-        public string test()
+        public async Task<string> test()
         {
         {
+            bool result = await CSharpScript.EvaluateAsync<bool>("!string.IsNullOrEmpty(\"\")");
             return "ok";
             return "ok";
         }
         }
     }
     }

+ 8 - 5
Filters/AuthorizationFilter.cs

@@ -177,12 +177,15 @@ namespace Filters
         public string GetParam(string content)
         public string GetParam(string content)
         {
         {
             string result = "{";
             string result = "{";
-            if(content.StartsWith("?")) content = content.Substring(1);
-            string[] data = content.Split('&');
-            foreach(string sub in data)
+            if(content.StartsWith("?")) 
             {
             {
-                string[] subData = sub.Split('=');
-                result += "\"" + subData[0] + "\":\"" + subData[1] + "\",";
+                content = content.Substring(1);
+                string[] data = content.Split('&');
+                foreach(string sub in data)
+                {
+                    string[] subData = sub.Split('=');
+                    result += "\"" + subData[0] + "\":\"" + subData[1] + "\",";
+                }
             }
             }
             result += "}";
             result += "}";
             return result;
             return result;

+ 3 - 3
Program.cs

@@ -12,7 +12,7 @@ using Nacos.AspNetCore.V2;
 using Util;
 using Util;
 using System.Net;
 using System.Net;
 using System.Net.Sockets;
 using System.Net.Sockets;
-using Task;
+using Tasks;
 
 
 var builder = WebApplication.CreateBuilder(args);
 var builder = WebApplication.CreateBuilder(args);
 
 
@@ -128,7 +128,7 @@ app.MapControllers();
 app.Urls.Add("http://*:8006");
 app.Urls.Add("http://*:8006");
 
 
 
 
-MakeHelper.Instance.Start("MakeSqlQueue");
-RabbitMQClient.Instance.Conn("MakeSqlCallBackQueue");
+// MakeHelper.Instance.Start("MakeSqlQueue");
+// RabbitMQClient.Instance.Conn("MakeSqlCallBackQueue");
 
 
 app.Run();
 app.Run();

+ 1 - 1
Task/MakeHelper.cs

@@ -4,7 +4,7 @@ using Common;
 using LitJson;
 using LitJson;
 using Microsoft.CodeAnalysis.CSharp.Scripting;
 using Microsoft.CodeAnalysis.CSharp.Scripting;
 
 
-namespace Task
+namespace Tasks
 {
 {
     public class MakeHelper
     public class MakeHelper
     {
     {

+ 7 - 279
Template/Java/model.java

@@ -31,286 +31,14 @@ public class <<ym:databaseTable.tableNameUpper>> extends Model<<<ym:databaseTabl
     <<ym-loop:DatabaseFields>>
     <<ym-loop:DatabaseFields>>
     /**
     /**
      * <<fieldTitle>>
      * <<fieldTitle>>
-     */
-    @Schema(description = "<<fieldTitle>>")
-    @TableId(type = IdType.AUTO)
-    private <<ym-if:<<fieldType>>="int">>Integer<</ym-if>><<ym-if:<<fieldType>>="bigint">>Long<</ym-if>><<ym-if:<<fieldType>>="datetime">>LocalDateTime<</ym-if>><<ym-if:<<fieldType>>="bit">>Boolean<</ym-if>><<ym-if:<<fieldType>>="bit">>Boolean<</ym-if>> <<fieldNameUpper>>;
+     */<<ym-if:"<<fieldType>>"="datetime" && "<<fieldName>>".start("create")>>
+    @TableField(fill = FieldFill.INSERT)<</ym-if>><<ym-if:"<<fieldType>>"="datetime" && "<<fieldName>>".start("update")>>
+    @TableField(fill = FieldFill.UPDATE)<</ym-if>>
+    @Schema(description = "<<fieldTitle>>")<<ym-if:<<autoIncrement>>>>
+    @TableId(type = IdType.AUTO)<</ym-if>><<ym-if:"<<fieldType>>"="datetime">>
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")<</ym-if>>
+    private <<ym-if:"<<fieldType>>"="int">>Integer<</ym-if>><<ym-if:"<<fieldType>>"="bigint">>Long<</ym-if>><<ym-if:"<<fieldType>>"="numeric">>BigDecimal<</ym-if>><<ym-if:"<<fieldType>>"="datetime">>LocalDateTime<</ym-if>><<ym-if:"<<fieldType>>"="bit">>Boolean<</ym-if>><<ym-if:"<<fieldType>>"!="bit" && "<<fieldType>>"!="bigint" && "<<fieldType>>"!="numeric" && "<<fieldType>>"!="datetime" && "<<fieldType>>"!="bit">>String<</ym-if>> <<fieldNameUpper>>;
 
 
 
 
     <</ym-loop:DatabaseFields>>
     <</ym-loop:DatabaseFields>>
-    /**
-     * 新增时间
-     */
-    @TableField(fill = FieldFill.INSERT)
-    @Schema(description = "新增时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime createTime;
-
-
-    /**
-     * 更新时间
-     */
-    @TableField(fill = FieldFill.UPDATE)
-    @Schema(description = "更新时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime updateTime;
-
-
-    /**
-     * 删除标记,0未删除,1已删除
-     */
-    @Schema(description = "删除标记,0未删除,1已删除")
-    private String delFlag;
-
-
-    /**
-     * 版本
-     */
-    @Schema(description = "版本")
-    private Integer version;
-
-
-    /**
-     * 机具码
-     */
-    @Schema(description = "机具码")
-    private String posSn;
-
-
-    /**
-     * 仓库ID
-     */
-    @Schema(description = "仓库ID")
-    private Integer warehouseId;
-
-    /**
-     * 仓库名称
-     */
-    @Schema(description = "仓库名称")
-    private String warehouseName;
-
-
-    /**
-     * 所属创客ID
-     */
-    @Schema(description = "所属创客ID")
-    private Integer userId;
-
-
-    /**
-     * 商户ID
-     */
-    @Schema(description = "商户ID")
-    private Integer merchantId;
-
-
-    /**
-     * 品牌ID
-     */
-    @Schema(description = "品牌ID")
-    private Integer brandId;
-
-
-    /**
-     * 循环状态 0不可循环 1可循环
-     */
-    @Schema(description = "循环状态 0不可循环 1可循环")
-    private Integer recycleStatus;
-
-
-    /**
-     * 循环结束时间
-     */
-    @Schema(description = "循环结束时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime recycleEndTime;
-
-
-    /**
-     * 机具类型 0兑换机 1循环机
-     */
-    @Schema(description = "机具类型 0兑换机 1循环机")
-    private Integer machineType;
-
-
-    /**
-     * 机具押金
-     */
-    @Schema(description = "机具押金")
-    private BigDecimal cashPledge;
-
-
-    /**
-     * 厂家押金
-     */
-    @Schema(description = "厂家押金")
-    private BigDecimal sourcePledge;
-
-
-    /**
-     * 机具轨迹路径
-     */
-    @Schema(description = "机具轨迹路径")
-    private String allotPath;
-
-
-    /**
-     * 绑定时间
-     */
-    @Schema(description = "绑定时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime bindTime;
-
-
-    /**
-     * 激活时间
-     */
-    @Schema(description = "激活时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime actTime;
-
-
-    /**
-     * 出库时间
-     */
-    @Schema(description = "出库时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime deliveryTime;
-
-
-    /**
-     * 箱码
-     */
-    @Schema(description = "箱码")
-    private String boxSn;
-
-
-    /**
-     * 机具费率
-     */
-    @Schema(description = "机具费率")
-    private BigDecimal machineRatio;
-
-
-    /**
-     * 是否激活 0未激活 1已激活
-     */
-    @Schema(description = "是否激活 0未激活 1已激活")
-    private Integer isAct;
-
-
-    /**
-     * 绑定状态 0未绑定 1已绑定 2已解绑
-     */
-    @Schema(description = "绑定状态 0未绑定 1已绑定 2已解绑")
-    private Integer bindStatus;
-
-
-    /**
-     * 状态 -1坏机 0在库 1出库
-     */
-    @Schema(description = "状态 -1坏机 0在库 1出库")
-    private Integer status;
-
-    /**
-     * 回收状态 0正常 1可回收
-     */
-    @Schema(description = "回收状态 0正常 1可回收 ")
-    private Integer returnStatus;
-
-
-    /**
-     * 是否首台 0否 1是
-     */
-    @Schema(description = "是否首台 0否 1是")
-    private Integer isFirst;
-
-
-    /**
-     * 费率调升标记
-     */
-    @Schema(description = "费率调升标记 0未调 1已调整")
-    private Integer upFeeFlag;
-
-    /**
-     * 费率调降标记
-     */
-    @Schema(description = "费率调升标记 0未调 1已调整")
-    private Integer downFeeFlag;
-
-
-    /**
-     * 盟主用户ID
-     */
-    @Schema(description = "盟主用户ID")
-    private Integer leaderId;
-
-    /**
-     * 合伙人用户ID
-     */
-    @Schema(description = "合伙人用户ID")
-    private Integer partnerId;
-
-    /**
-     * 预发到用户的ID
-     */
-    @Schema(description = "预发到用户的ID")
-    private Integer preUserId;
-
-
-    /**
-     * 补录标识 0未补录 1已补录
-     */
-    @Schema(description = "补录标识 0未补录 1已补录")
-    private Integer isSupply;
-
-    /**
-     * 补激活奖标记 0未补录 1已补录
-     */
-    @Schema(description = "补录标识 0未补录 1已补录")
-    private Integer isOpAct;
-
-    /**
-     * 业务批次号
-     */
-    @Schema(description = "业务批次号")
-    private String batchNo;
-
-    /**
-     * 贷记卡交易额
-     */
-    @Schema(description = "贷记卡交易额")
-    private BigDecimal creditTrade;
-
-    /**
-     * 借记卡交易额
-     */
-    @Schema(description = "借记卡交易额")
-    private BigDecimal debitCardTrade;
-
-    /**
-     * 扫码交易额
-     */
-    @Schema(description = "扫码交易额")
-    private BigDecimal scanQrTrade;
-
-    /**
-     * 溯源机具和兑换券
-     */
-    @Schema(description = "溯源机具和兑换券")
-    private String sourcePosSn;
-
-    /**
-     * 机具地址
-     */
-    @Schema(description = "机具地址")
-    private String devLocation;
-
-    /**
-     * 秒到费
-     */
-    @Schema(description = "秒到费")
-    private BigDecimal secondFee;
-
-
 }
 }

+ 1 - 1
Template/Sql/db.sql

@@ -9,7 +9,7 @@ GRANT create,alter,drop,select,insert,update,delete ON <<username>>.* TO <<usern
 DROP TABLE IF EXISTS <<tableName>>;
 DROP TABLE IF EXISTS <<tableName>>;
 CREATE table <<tableName>>(
 CREATE table <<tableName>>(
 <<ym-loop:fields>>
 <<ym-loop:fields>>
-<<fieldName>> <<fieldType>><<ym-if:!isEmpty(<<fieldLength>>)>>(<<fieldLength>>)<</ym-if>><<ym-if:<<notNull>>=1>> not null<</ym-if>><<ym-if:<<autoIncrement>>=1>> AUTO_INCREMENT<</ym-if>><<ym-if:!isEmpty(<<fieldDefaultValue>>)>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>,
+<<fieldName>> <<fieldType>><<ym-if:!isEmpty("<<fieldLength>>")>>(<<fieldLength>>)<</ym-if>><<ym-if:<<notNull>>>> not null<</ym-if>><<ym-if:<<autoIncrement>>>> AUTO_INCREMENT<</ym-if>><<ym-if:!isEmpty("<<fieldDefaultValue>>")>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>,
 <</ym-loop:fields>>
 <</ym-loop:fields>>
 PRIMARY KEY(<<ym-loop:fields removeEnd=",">><<fieldName>>,<</ym-loop:fields>>)
 PRIMARY KEY(<<ym-loop:fields removeEnd=",">><<fieldName>>,<</ym-loop:fields>>)
 ) COMMENT '<<tableTitle>>' ENGINE=InnoDB DEFAULT charset=utf8mb4 COLLATE utf8mb4_general_ci;
 ) COMMENT '<<tableTitle>>' ENGINE=InnoDB DEFAULT charset=utf8mb4 COLLATE utf8mb4_general_ci;

+ 1 - 1
Template/Sql/dbField.sql

@@ -1,3 +1,3 @@
 <<ym-loop:databaseField>>
 <<ym-loop:databaseField>>
-Alter table <<ym:tableName>> <<ym:opType>> <<fieldName>> <<fieldType>><<ym-if !isEmpty(<<fieldLength>>)>>(<<fieldLength>>)<</ym-if>><<ym-if <<notNull>>=1>> not null<</ym-if>><<ym-if <<autoIncrement>>=1>> AUTO_INCREMENT<</ym-if>><<ym-if !isEmpty(<<fieldDefaultValue>>)>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>;
+Alter table <<ym:tableName>> <<ym:opType>> <<fieldName>> <<fieldType>><<ym-if:!isEmpty("<<fieldLength>>")>>(<<fieldLength>>)<</ym-if>><<ym-if:<<notNull>>>> not null<</ym-if>><<ym-if:<<autoIncrement>>>> AUTO_INCREMENT<</ym-if>><<ym-if:!isEmpty("<<fieldDefaultValue>>")>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>;
 <</ym-loop:databaseField>>
 <</ym-loop:databaseField>>

+ 1 - 1
Template/Sql/dbTable.sql

@@ -2,7 +2,7 @@
 DROP TABLE IF EXISTS <<tableName>>;
 DROP TABLE IF EXISTS <<tableName>>;
 CREATE table <<tableName>>(
 CREATE table <<tableName>>(
 <<ym-loop:fields>>
 <<ym-loop:fields>>
-<<fieldName>> <<fieldType>><<ym-if:!isEmpty(<<fieldLength>>)>>(<<fieldLength>>)<</ym-if>><<ym-if:<<notNull>>="1">> not null<</ym-if>><<ym-if:<<autoIncrement>>="1">> AUTO_INCREMENT<</ym-if>><<ym-if:!isEmpty(<<fieldDefaultValue>>)>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>,
+<<fieldName>> <<fieldType>><<ym-if:!isEmpty("<<fieldLength>>")>>(<<fieldLength>>)<</ym-if>><<ym-if:<<notNull>>>> not null<</ym-if>><<ym-if:<<autoIncrement>>>> AUTO_INCREMENT<</ym-if>><<ym-if:!isEmpty("<<fieldDefaultValue>>")>> default <<fieldDefaultValue>><</ym-if>> COMMENT <<fieldTitle>><<fieldDetail>>,
 <</ym-loop:fields>>
 <</ym-loop:fields>>
 PRIMARY KEY(
 PRIMARY KEY(
 <<ym-loop:fields removeEnd=",">>
 <<ym-loop:fields removeEnd=",">>

+ 1 - 2
Util/Maker.cs

@@ -138,7 +138,6 @@ namespace Util
                 }
                 }
                 else //否则当数值处理
                 else //否则当数值处理
                 {
                 {
-
                     templateString = templateString.Replace("<<ym:" + key + ">>", jsonObj[key].ToString());
                     templateString = templateString.Replace("<<ym:" + key + ">>", jsonObj[key].ToString());
                 }
                 }
             }
             }
@@ -153,7 +152,7 @@ namespace Util
             foreach (Match m in mc)
             foreach (Match m in mc)
             {
             {
                 string matchValue = m.Value;
                 string matchValue = m.Value;
-                Match head = Regex.Match(matchValue, "<<ym-if:.*>>");
+                Match head = Regex.Match(matchValue.Replace("<</ym-if>>", ""), "<<ym-if:.*>>");
                 if (head.Success)
                 if (head.Success)
                 {
                 {
                     string headValue = head.Value;
                     string headValue = head.Value;

+ 13 - 14
appsettings.Development.json

@@ -1,8 +1,8 @@
 {
 {
   "Logging": {
   "Logging": {
     "LogLevel": {
     "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
+      "Yarp.ReverseProxy": "Trace",
+      "Microsoft.AspNetCore.Routing": "Trace"
     }
     }
   },
   },
   "AllowedHosts": "*",
   "AllowedHosts": "*",
@@ -11,25 +11,24 @@
       {
       {
         "Optional": false,
         "Optional": false,
         "DataId": "omega",
         "DataId": "omega",
-        "Group": "DEFAULT_GROUP"
+        "Group": "DEFAULT"
       }
       }
     ],
     ],
-    "Namespace": "7e41669f-6054-45f5-b038-f7bb07410807",
-    "ServerAddresses": [ "https://nacos-test.kexiaoshuang.com/" ],
+    "Namespace": "063782d2-102a-435d-9355-b96294bb62e1",
+    "ServerAddresses": [ "http://test-nacos-csharp.kexiaoshuang.com/" ],
     "ServiceName": "omega_make",
     "ServiceName": "omega_make",
-    "GroupName": "DEFAULT_GROUP",
-    "UserName": "nacos",
-    "Password": "Kxs#2025",
-    "EndPoint": "",
-    "Ip": "localhost",
+    "GroupName": "DEFAULT",
+    "Ip": "",
     "Port": "8006",
     "Port": "8006",
-    "ConfigUseRpc": false,
-    "NamingUseRpc": false,
+    "EndPoint": "",
+    "ConfigUseRpc": true,
+    "NamingUseRpc": true,
     "RegisterEnabled": true,
     "RegisterEnabled": true,
     "InstanceEnabled": true,
     "InstanceEnabled": true,
+    "DefaultTimeOut": 30000,
     "Metadata": {
     "Metadata": {
-      "preserved.heart.beat.interval": "30000",
-      "preserved.heart.beat.timeout": "60000"
+      "preserved.heart.beat.interval": 30000,
+      "preserved.heart.beat.timeout": 60000
     }
     }
   }
   }
 }
 }