diff --git a/hchyun-ui/src/api/test/father.js b/hchyun-ui/src/api/test/father.js
index 467d9b5..d40e872 100644
--- a/hchyun-ui/src/api/test/father.js
+++ b/hchyun-ui/src/api/test/father.js
@@ -1,12 +1,21 @@
import request from '@/utils/request'
+
// 查询关联查询父列表
-export function listFather(query) {
- console.log(query)
+export function listFather(data) {
return request({
url: '/test/father/list',
method: 'put',
- data: query
+ data: data
+ })
+}
+
+// 导出关联查询父
+export function exportFather(data) {
+ return request({
+ url: '/test/father/export',
+ method: 'put',
+ data: data
})
}
@@ -43,12 +52,3 @@ export function delFather(id) {
method: 'delete'
})
}
-
-// 导出关联查询父
-export function exportFather(query) {
- return request({
- url: '/test/father/export',
- method: 'get',
- params: query
- })
-}
diff --git a/hchyun-ui/src/views/test/father/index.vue b/hchyun-ui/src/views/test/father/index.vue
index 9407233..1c4c5b1 100644
--- a/hchyun-ui/src/views/test/father/index.vue
+++ b/hchyun-ui/src/views/test/father/index.vue
@@ -114,6 +114,7 @@
+
@@ -139,8 +140,8 @@
@@ -194,7 +195,6 @@ export default {
open: false,
// 创建时间时间范围
daterangeCreateTime: [],
- assCreateTime: [],
// 主键字典
idOptions: [],
// 父id字典
@@ -234,6 +234,7 @@ export default {
methods: {
/** 查询关联查询父列表 */
getList() {
+ this.loading = true;
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/annotation/Excel.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/annotation/Excel.java
index d71175c..18c055f 100644
--- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/annotation/Excel.java
+++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/annotation/Excel.java
@@ -18,7 +18,9 @@ public @interface Excel
/**
* 导出时在excel中排序
*/
- public int sort() default Integer.MAX_VALUE;
+// public int sort() default Integer.MAX_VALUE;
+
+ public int sort() default 1;
/**
* 导出到Excel中的名字.
@@ -105,6 +107,7 @@ public @interface Excel
*/
public boolean isStatistics() default false;
+
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/controller/HcyBaseController.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/controller/HcyBaseController.java
index bf92396..013084a 100644
--- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/controller/HcyBaseController.java
+++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/controller/HcyBaseController.java
@@ -49,6 +49,18 @@ public class HcyBaseController {
}
}
+ /**
+ * 设置请求分页数据
+ */
+ public void startPage(Map map) {
+ PageDomain pageDomain = TableSupport.buildPageRequest();
+ Integer pageNum = (Integer) map.get("pageNum");
+ Integer pageSize = (Integer) map.get("pageSize");
+ if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
+ String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+ PageHelper.startPage(pageNum, pageSize, orderBy);
+ }
+ }
/**
* 响应请求分页数据
diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/BaseEntity.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/BaseEntity.java
index 4b3128e..6eef589 100644
--- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/BaseEntity.java
+++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/BaseEntity.java
@@ -8,6 +8,7 @@ import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.hchyun.common.annotation.Excel;
/**
* Entity基类
@@ -30,6 +31,7 @@ public class BaseEntity implements Serializable {
/**
* 创建时间
*/
+ @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = Integer.MAX_VALUE-1)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@@ -41,6 +43,7 @@ public class BaseEntity implements Serializable {
/**
* 更新时间
*/
+ @Excel(name = "更新时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = Integer.MAX_VALUE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/utils/poi/ExcelUtil.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/utils/poi/ExcelUtil.java
index 1ff12d7..66ad8e5 100644
--- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/utils/poi/ExcelUtil.java
+++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/utils/poi/ExcelUtil.java
@@ -736,7 +736,7 @@ public class ExcelUtil {
return o;
}
- /**
+ /** todo
* 得到所有定义字段
*/
private void createExcelField() {
diff --git a/hchyun/hchyun-generator/src/main/resources/vm/java/controller.java.vm b/hchyun/hchyun-generator/src/main/resources/vm/java/controller.java.vm
index ffe47a7..285c3c4 100644
--- a/hchyun/hchyun-generator/src/main/resources/vm/java/controller.java.vm
+++ b/hchyun/hchyun-generator/src/main/resources/vm/java/controller.java.vm
@@ -57,21 +57,17 @@ public class ${ClassName}Controller extends HcyBaseController {
*/
@ApiOperation("查询${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
-#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
-#if($table.tplCategory.equals("ass"))
@PutMapping("/list")
public Serializable list(@Validated @RequestBody ${ClassName} ${className}) {
try {
- startPage(assFather.getParams());
-#else
- @GetMapping("/list")
- public Serializable list(${ClassName} ${className}) {
- try {
- startPage();
-#end
+ startPage(${className}.getParams());
ServerResult> serverResult = ${className}Service.select${ClassName}List(${className});
if (serverResult.isStart()) {
+#if($table.crud || $table.sub || $table.tplCategory.equals("ass"))
return getDataTable(serverResult.getData());
+#elseif($table.tree)
+ return AjaxResult.success(serverResult.getData());
+#end
} else {
return AjaxResult.info(serverResult.getMsg());
}
@@ -80,13 +76,6 @@ public class ${ClassName}Controller extends HcyBaseController {
return AjaxResult.error(ReturnConstants.SYS_ERROR);
}
}
-#elseif($table.tree)
- @GetMapping("/list")
- public AjaxResult list(${ClassName} ${className}) {
- List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
- return AjaxResult.success(list);
- }
-#end
/**
* 导出${functionName}列表
@@ -94,8 +83,8 @@ public class ${ClassName}Controller extends HcyBaseController {
@ApiOperation("导出${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(${ClassName} ${className}) {
+ @PutMapping("/export")
+ public AjaxResult export(@Validated @RequestBody ${ClassName} ${className}) {
try {
ServerResult> serverResult = ${className}Service.select${ClassName}List(${className});
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class);
@@ -242,19 +231,4 @@ public class ${ClassName}Controller extends HcyBaseController {
return AjaxResult.error(ReturnConstants.SYS_ERROR);
}
}
-
-#if($table.tplCategory.equals("ass"))
- /**
- * 设置请求分页数据
- */
- public void startPage(Map map) {
- PageDomain pageDomain = TableSupport.buildPageRequest();
- Integer pageNum = (Integer) map.get("pageNum");
- Integer pageSize = (Integer) map.get("pageSize");
- if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
- String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
- PageHelper.startPage(pageNum, pageSize, orderBy);
- }
- }
-#end
}
diff --git a/hchyun/hchyun-generator/src/main/resources/vm/java/entity.java.vm b/hchyun/hchyun-generator/src/main/resources/vm/java/entity.java.vm
index e571d47..3da4dd9 100644
--- a/hchyun/hchyun-generator/src/main/resources/vm/java/entity.java.vm
+++ b/hchyun/hchyun-generator/src/main/resources/vm/java/entity.java.vm
@@ -11,6 +11,7 @@ import com.hchyun.common.annotation.Excel;
#end
#if($table.tplCategory.equals("ass"))
#set($Entity="BaseEntity")
+import com.hchyun.common.annotation.Excels;
import ${packageName}.entity.${assClassName};
#elseif($table.tplCategory.equals("sub"))
import ${packageName}.entity.${subClassName};
@@ -58,18 +59,42 @@ public class ${ClassName} extends ${Entity}
#end
@ApiModelProperty("${column.columnComment}")
private $column.javaType $column.javaField;
+#end
+#end
-#end
-#end
#if($table.sub)
/** $table.subTable.functionName信息 */
@ApiModelProperty("${table.subTable.functionName}信息")
private List<${subClassName}> ${subclassName}List;
#elseif($table.tplCategory.equals("ass"))
- private ${assClassName} ${assclassName};
-
+ #set($count = 0)
+#foreach($column in $table.assColumns)
+#if($column.isList == "1")
+ #set($count = $count + 1)
#end
+#end
+ #set($targetName = "")
+ #set($indexs = 0)
+#foreach($column in $table.assColumns)
+#if($column.isList == "1")
+#set($parentheseIndex=$column.columnComment.indexOf("("))
+#if($parentheseIndex != -1)
+#set($comment=$column.columnComment.substring(0, $parentheseIndex))
+#else
+#set($comment=$column.columnComment)
+#end
+#set($indexs = $indexs + 1)
+#set($targetName = $targetName + '@Excel(name = "'+$comment+'",targetAttr = "'+$column.javaField+'")')
+#if($indexs != $count)
+ #set($targetName = $targetName + ",")
+#end
+#end
+#end
+ @Excels({${targetName}}))
+ private ${assClassName} ${assclassName};
+#end
+
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
diff --git a/hchyun/hchyun-generator/src/main/resources/vm/js/api.js.vm b/hchyun/hchyun-generator/src/main/resources/vm/js/api.js.vm
index 738ee99..7fec2a3 100644
--- a/hchyun/hchyun-generator/src/main/resources/vm/js/api.js.vm
+++ b/hchyun/hchyun-generator/src/main/resources/vm/js/api.js.vm
@@ -2,23 +2,22 @@ import request from '@/utils/request'
// 查询${functionName}列表
-#if($table.tplCategory.equals("ass"))
export function list${BusinessName}(data) {
return request({
url: '/${moduleName}/${businessName}/list',
method: 'put',
- params: data
+ data: data
})
}
-#else
-export function list${BusinessName}(query) {
+
+// 导出${functionName}
+export function export${BusinessName}(data) {
return request({
- url: '/${moduleName}/${businessName}/list',
- method: 'get',
- params: query
+ url: '/${moduleName}/${businessName}/export',
+ method: 'put',
+ data: data
})
}
-#end
// 查询${functionName}详细
export function get${BusinessName}(${pkColumn.javaField}) {
@@ -52,13 +51,4 @@ export function del${BusinessName}(${pkColumn.javaField}) {
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
method: 'delete'
})
-}
-
-// 导出${functionName}
-export function export${BusinessName}(query) {
- return request({
- url: '/${moduleName}/${businessName}/export',
- method: 'get',
- params: query
- })
}
\ No newline at end of file
diff --git a/hchyun/hchyun-generator/src/main/resources/vm/vue/index.vue.vm b/hchyun/hchyun-generator/src/main/resources/vm/vue/index.vue.vm
index c2ad9fd..4a97025 100644
--- a/hchyun/hchyun-generator/src/main/resources/vm/vue/index.vue.vm
+++ b/hchyun/hchyun-generator/src/main/resources/vm/vue/index.vue.vm
@@ -248,8 +248,8 @@
@@ -498,8 +498,10 @@ export default {
#end
// 查询参数
queryParams: {
- pageNum: 1,
- pageSize: 10,
+ params:{
+ pageNum: 1,
+ pageSize: 10,
+ },
#foreach ($column in $columns)
#if($column.query && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
$column.javaField: null#if($velocityCount != $columns.size()),#end
@@ -555,22 +557,6 @@ export default {
/** 查询${functionName}列表 */
getList() {
this.loading = true;
-#set($variable = 0)
-#foreach ($column in $columns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- #set($variable = 1)
-#break
-#end
-#end
-#foreach ($column in $table.assColumns)
-#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
- #set($variable = 1)
-#break
-#end
-#end
-#if($variable == 1)
- this.queryParams.params = {};
-#end
#foreach ($column in $columns)
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
diff --git a/hchyun/hchyun-generator/src/main/resources/vm/xml/mapper.xml.vm b/hchyun/hchyun-generator/src/main/resources/vm/xml/mapper.xml.vm
index 777707c..56af20a 100644
--- a/hchyun/hchyun-generator/src/main/resources/vm/xml/mapper.xml.vm
+++ b/hchyun/hchyun-generator/src/main/resources/vm/xml/mapper.xml.vm
@@ -38,7 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#if($table.tplCategory.equals("ass"))