瀏覽代碼

生成模板默认值修改

RuoYi 5 年之前
父節點
當前提交
d9fabe556c

+ 1 - 1
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java

@@ -81,7 +81,7 @@ public class GenConstants
     public static final String TYPE_DATE = "Date";
 
     /** 模糊查询 */
-    public static final String QUERY_LIKE = "Like";
+    public static final String QUERY_LIKE = "LIKE";
 
     /** 需要 */
     public static final String REQUIRE = "1";

+ 2 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java

@@ -34,11 +34,12 @@ public class VelocityUtils
         String businessName = genTable.getBusinessName();
         String packageName = genTable.getPackageName();
         String tplCategory = genTable.getTplCategory();
+        String functionName = genTable.getFunctionName();
 
         VelocityContext velocityContext = new VelocityContext();
         velocityContext.put("tplCategory", genTable.getTplCategory());
         velocityContext.put("tableName", genTable.getTableName());
-        velocityContext.put("functionName", genTable.getFunctionName());
+        velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
         velocityContext.put("ClassName", genTable.getClassName());
         velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
         velocityContext.put("moduleName", genTable.getModuleName());

+ 4 - 4
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm

@@ -31,13 +31,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
 #elseif($queryType == "NE")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
-#elseif(\$queryType == "GT")
+#elseif($queryType == "GT")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt; #{$javaField}</if>
-#elseif(\$queryType == "GTE")
+#elseif($queryType == "GTE")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt;= #{$javaField}</if>
-#elseif(\$queryType == "LT")
+#elseif($queryType == "LT")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt; #{$javaField}</if>
-#elseif(\$queryType == "LTE")
+#elseif($queryType == "LTE")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if>
 #elseif($queryType == "LIKE")
             <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>

+ 1 - 1
sql/ry_20190808.sql

@@ -679,7 +679,7 @@ create table gen_table_column (
   is_edit           char(1)                                    comment '是否编辑字段(1是)',
   is_list           char(1)                                    comment '是否列表字段(1是)',
   is_query          char(1)                                    comment '是否查询字段(1是)',
-  query_type        varchar(200)    default '='                comment '查询方式(等于、不等于、大于、小于、范围)',
+  query_type        varchar(200)    default 'EQ'               comment '查询方式(等于、不等于、大于、小于、范围)',
   html_type         varchar(200)                               comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
   dict_type         varchar(200)    default ''                 comment '字典类型',
   sort              int                                        comment '排序',