Przeglądaj źródła

代码生成日期控件区分范围

RuoYi 4 lat temu
rodzic
commit
73ee7bc485

+ 1 - 1
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css

@@ -602,7 +602,7 @@ div.ztree-border {
 	list-style: none;
 }
 
-.time-input {
+.select-time .time-input {
 	display: block;
 	width: 100%;
 	padding-left: 10px;

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

@@ -273,6 +273,7 @@ public class VelocityUtils
             if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType()))
             {
                 importList.add("java.util.Date");
+                importList.add("com.fasterxml.jackson.annotation.JsonFormat");
             }
             else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType()))
             {

+ 6 - 1
ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm

@@ -41,7 +41,12 @@
                                     <option value="-1">代码生成请选择字典属性</option>
                                 </select>
                             </li>
-#elseif($column.htmlType == "datetime")
+#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
+                            <li>
+                                <label>${comment}:</label>
+                                <input type="text" class="time-input" placeholder="请选择${comment}" name="${column.javaField}"/>
+                            </li>
+#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
                             <li class="select-time">
                                 <label>${comment}:</label>
                                 <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[begin${AttrName}]"/>

+ 6 - 1
ruoyi-generator/src/main/resources/vm/html/list.html.vm

@@ -41,7 +41,12 @@
                                     <option value="-1">代码生成请选择字典属性</option>
                                 </select>
                             </li>
-#elseif($column.htmlType == "datetime")
+#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
+                            <li>
+                                <label>${comment}:</label>
+                                <input type="text" class="time-input" placeholder="请选择${comment}" name="${column.javaField}"/>
+                            </li>
+#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
                             <li class="select-time">
                                 <label>${comment}:</label>
                                 <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[begin${AttrName}]"/>

+ 1 - 0
ruoyi-generator/src/main/resources/vm/java/domain.java.vm

@@ -40,6 +40,7 @@ public class ${ClassName} extends ${Entity}
 #if($parentheseIndex != -1)
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
 #elseif($column.javaType == 'Date')
+    @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
 #else
     @Excel(name = "${comment}")