diff --git a/hchyun/hchyun-generator/pom.xml b/hchyun/hchyun-generator/pom.xml
index 45e4082..13cf53f 100644
--- a/hchyun/hchyun-generator/pom.xml
+++ b/hchyun/hchyun-generator/pom.xml
@@ -21,13 +21,144 @@
org.apache.velocity
velocity
-
-
+
- com.hchyun
- hchyun-common
+ commons-net
+ commons-net
+ 3.7
+
+
+ org.springframework
+ spring-context-support
+
+
+
+
+ org.springframework
+ spring-web
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+
+
+
+
+ javax.validation
+ validation-api
+
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+
+ commons-io
+ commons-io
+
+
+
+
+ commons-fileupload
+ commons-fileupload
+
+
+
+
+ org.apache.poi
+ poi-ooxml
+
+
+
+
+ org.yaml
+ snakeyaml
+
+
+
+
+ io.jsonwebtoken
+ jjwt
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+
+ org.apache.commons
+ commons-pool2
+
+
+
+
+ eu.bitwalker
+ UserAgentUtils
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+
+ io.springfox
+ springfox-swagger2
+
+
+
+
+ io.swagger
+ swagger-annotations
+ 1.5.21
+
+
+
+ io.swagger
+ swagger-models
+ 1.5.21
+
+
+
+
+ io.springfox
+ springfox-swagger-ui
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excel.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excel.java
new file mode 100644
index 0000000..9344046
--- /dev/null
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excel.java
@@ -0,0 +1,139 @@
+package com.hchyun.generator.aop;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.math.BigDecimal;
+
+/**
+ * 自定义导出Excel数据注解
+ *
+ * @author hchyun
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Excel {
+ /**
+ * 导出时在excel中排序
+ */
+// public int sort() default Integer.MAX_VALUE;
+ public int sort() default 1;
+
+ /**
+ * 导出到Excel中的名字.
+ */
+ public String name() default "";
+
+ /**
+ * 日期格式, 如: yyyy-MM-dd
+ */
+ public String dateFormat() default "";
+
+ /**
+ * 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
+ */
+ public String dictType() default "";
+
+ /**
+ * 读取内容转表达式 (如: 0=男,1=女,2=未知)
+ */
+ public String readConverterExp() default "";
+
+ /**
+ * 分隔符,读取字符串组内容
+ */
+ public String separator() default ",";
+
+ /**
+ * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
+ */
+ public int scale() default -1;
+
+ /**
+ * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
+ */
+ public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
+
+ /**
+ * 导出类型(0数字 1字符串)
+ */
+ public ColumnType cellType() default ColumnType.STRING;
+
+ /**
+ * 导出时在excel中每个列的高度 单位为字符
+ */
+ public double height() default 14;
+
+ /**
+ * 导出时在excel中每个列的宽 单位为字符
+ */
+ public double width() default 16;
+
+ /**
+ * 文字后缀,如% 90 变成90%
+ */
+ public String suffix() default "";
+
+ /**
+ * 当值为空时,字段的默认值
+ */
+ public String defaultValue() default "";
+
+ /**
+ * 提示信息
+ */
+ public String prompt() default "";
+
+ /**
+ * 设置只能选择不能输入的列内容.
+ */
+ public String[] combo() default {};
+
+ /**
+ * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
+ */
+ public boolean isExport() default true;
+
+ /**
+ * 另一个类中的属性名称,支持多级获取,以小数点隔开
+ */
+ public String targetAttr() default "";
+
+ /**
+ * 是否自动统计数据,在最后追加一行统计数据总和
+ */
+ public boolean isStatistics() default false;
+
+
+ /**
+ * 字段类型(0:导出导入;1:仅导出;2:仅导入)
+ */
+ Type type() default Type.ALL;
+
+ public enum Type {
+ ALL(0), EXPORT(1), IMPORT(2);
+ private final int value;
+
+ Type(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+ }
+
+ public enum ColumnType {
+ NUMERIC(0), STRING(1);
+ private final int value;
+
+ ColumnType(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excels.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excels.java
new file mode 100644
index 0000000..e8b862b
--- /dev/null
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Excels.java
@@ -0,0 +1,17 @@
+package com.hchyun.generator.aop;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Excel注解集
+ *
+ * @author hchyun
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Excels {
+ Excel[] value();
+}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Log.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Log.java
new file mode 100644
index 0000000..b2ddd50
--- /dev/null
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/aop/Log.java
@@ -0,0 +1,36 @@
+package com.hchyun.generator.aop;
+
+import com.hchyun.generator.enums.GenBusinessType;
+import com.hchyun.generator.enums.GenOperatorType;
+
+import java.lang.annotation.*;
+
+/**
+ * 自定义操作日志记录注解
+ *
+ * @author hchyun
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Log {
+ /**
+ * 模块
+ */
+ public String title() default "";
+
+ /**
+ * 功能
+ */
+ public GenBusinessType businessType() default GenBusinessType.OTHER;
+
+ /**
+ * 操作人类别
+ */
+ public GenOperatorType operatorType() default GenOperatorType.MANAGE;
+
+ /**
+ * 是否保存请求的参数
+ */
+ public boolean isSaveRequestData() default true;
+}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/config/Config.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/config/Config.java
new file mode 100644
index 0000000..16d7862
--- /dev/null
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/config/Config.java
@@ -0,0 +1,34 @@
+package com.hchyun.generator.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author 18209
+ * @Date 2021/2/23 15:48
+ * @Version 1.0
+ */
+
+@Component
+@ConfigurationProperties(prefix = "hchyun")
+public class Config {
+
+
+
+ /**
+ * 上传路径
+ */
+ private static String profile;
+
+
+ public static String getProfile() {
+ return profile;
+ }
+
+ /**
+ * 获取下载路径
+ */
+ public static String getDownloadPath() {
+ return getProfile() + "/download/";
+ }
+}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AjaxResult.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AjaxResult.java
new file mode 100644
index 0000000..c173e25
--- /dev/null
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AjaxResult.java
@@ -0,0 +1,153 @@
+package com.hchyun.generator.controller;
+
+
+import com.hchyun.generator.utils.GenHttpStatus;
+import com.hchyun.generator.utils.GenStringUtils;
+
+import java.util.HashMap;
+
+/**
+ * 操作消息提醒
+ *
+ * @author hchyun
+ */
+public class AjaxResult extends HashMap {
+
+
+ /**
+ * 状态码
+ */
+ public static final String CODE_TAG = "code";
+
+ /**
+ * 返回内容
+ */
+ public static final String MSG_TAG = "msg";
+
+ /**
+ * 数据对象
+ */
+ public static final String DATA_TAG = "data";
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
+ */
+ public AjaxResult() {
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ */
+ public AjaxResult(int code, String msg) {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @param data 数据对象
+ */
+ public AjaxResult(int code, String msg, Object data) {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ if (GenStringUtils.isNotNull(data)) {
+ super.put(DATA_TAG, data);
+ }
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success() {
+ return AjaxResult.success("操作成功");
+ }
+
+ /**
+ * 返回成功数据
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success(Object data) {
+ return AjaxResult.success("操作成功", data);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg) {
+ return AjaxResult.success(msg, null);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg, Object data) {
+ return new AjaxResult(GenHttpStatus.SUCCESS, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @return
+ */
+ public static AjaxResult error() {
+ return AjaxResult.error("操作失败");
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg) {
+ return AjaxResult.error(msg, null);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg, Object data) {
+ return new AjaxResult(GenHttpStatus.ERROR, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(int code, String msg) {
+ return new AjaxResult(code, msg, null);
+ }
+
+ /**
+ * 返回提示信息
+ *
+ * @param msg 返回内容
+ * @return 提示消息
+ */
+ public static AjaxResult info(String msg) {
+ return new AjaxResult(GenHttpStatus.NO_DATA, msg, null);
+ }
+}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/ApiclassController.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/ApiclassController.java
index 6889f06..9b8f641 100644
--- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/ApiclassController.java
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/ApiclassController.java
@@ -3,9 +3,12 @@ package com.hchyun.generator.controller;
import java.io.Serializable;
import java.util.List;
-import com.hchyun.common.constant.ReturnConstants;
-import com.hchyun.common.core.controller.HcyBaseController;
-import com.hchyun.common.utils.ServerResult;
+import com.hchyun.generator.aop.Log;
+import com.hchyun.generator.enums.GenBusinessType;
+import com.hchyun.generator.utils.GenBaseController;
+import com.hchyun.generator.utils.GenReturnConstants;
+import com.hchyun.generator.utils.GenServerResult;
+import com.hchyun.generator.utils.poi.GenExcelUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -18,12 +21,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.hchyun.common.annotation.Log;
-import com.hchyun.common.core.entity.AjaxResult;
-import com.hchyun.common.enums.BusinessType;
import com.hchyun.generator.entity.Apiclass;
import com.hchyun.generator.service.ApiclassService;
-import com.hchyun.common.utils.poi.ExcelUtil;
/**
* 接口类名Controller
@@ -33,7 +32,7 @@ import com.hchyun.common.utils.poi.ExcelUtil;
*/
@RestController
@RequestMapping("/tool/apiclass")
-public class ApiclassController extends HcyBaseController {
+public class ApiclassController extends GenBaseController {
protected final Logger logger = LoggerFactory.getLogger(ApiclassController.class);
@Autowired
@@ -49,15 +48,15 @@ public class ApiclassController extends HcyBaseController {
@GetMapping("querylist")
public AjaxResult queryList() {
try {
- ServerResult> serverResult = apiclassService.selectApiclassList(new Apiclass());
- if (serverResult.isStart()) {
- return AjaxResult.success(serverResult.getData());
+ GenServerResult> genServerResult = apiclassService.selectApiclassList(new Apiclass());
+ if (genServerResult.isStart()) {
+ return AjaxResult.success(genServerResult.getData());
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -69,15 +68,15 @@ public class ApiclassController extends HcyBaseController {
public Serializable list(Apiclass apiclass) {
try {
startPage();
- ServerResult> serverResult = apiclassService.selectApiclassList(apiclass);
- if (serverResult.isStart()) {
- return getDataTable(serverResult.getData());
+ GenServerResult> genServerResult = apiclassService.selectApiclassList(apiclass);
+ if (genServerResult.isStart()) {
+ return getDataTable(genServerResult.getData());
} else {
- return AjaxResult.info(serverResult.getMsg());
+ return AjaxResult.info(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -85,20 +84,20 @@ public class ApiclassController extends HcyBaseController {
* 导出接口类名列表
*/
@PreAuthorize("@hchyun.hasPermi('tool:apiclass:export')")
- @Log(title = "接口类名", businessType = BusinessType.EXPORT)
+ @Log(title = "接口类名", businessType = GenBusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(Apiclass apiclass) {
try {
- ServerResult> serverResult = apiclassService.selectApiclassList(apiclass);
- ExcelUtil util = new ExcelUtil(Apiclass.class);
- if (serverResult.isStart()) {
- return util.exportExcel(serverResult.getData(), "apiclass");
+ GenServerResult> genServerResult = apiclassService.selectApiclassList(apiclass);
+ GenExcelUtil util = new GenExcelUtil(Apiclass.class);
+ if (genServerResult.isStart()) {
+ return util.exportExcel(genServerResult.getData(), "apiclass");
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -109,15 +108,15 @@ public class ApiclassController extends HcyBaseController {
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
try {
- ServerResult serverResult = apiclassService.selectApiclassById(id);
- if (serverResult.isStart()) {
- return AjaxResult.success(serverResult.getData());
+ GenServerResult genServerResult = apiclassService.selectApiclassById(id);
+ if (genServerResult.isStart()) {
+ return AjaxResult.success(genServerResult.getData());
} else {
- return AjaxResult.info(serverResult.getMsg());
+ return AjaxResult.info(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -125,7 +124,7 @@ public class ApiclassController extends HcyBaseController {
* 新增接口类名
*/
@PreAuthorize("@hchyun.hasPermi('tool:apiclass:add')")
- @Log(title = "接口类名", businessType = BusinessType.INSERT)
+ @Log(title = "接口类名", businessType = GenBusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Apiclass apiclass) {
if (apiclass.getmId() == null || apiclass.getmId() < 0) {
@@ -138,15 +137,15 @@ public class ApiclassController extends HcyBaseController {
return AjaxResult.error("类描述不能为空!");
}
try {
- ServerResult serverResult = apiclassService.insertApiclass(apiclass);
- if (serverResult.isStart()) {
+ GenServerResult genServerResult = apiclassService.insertApiclass(apiclass);
+ if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -154,7 +153,7 @@ public class ApiclassController extends HcyBaseController {
* 修改接口类名
*/
@PreAuthorize("@hchyun.hasPermi('tool:apiclass:edit')")
- @Log(title = "接口类名", businessType = BusinessType.UPDATE)
+ @Log(title = "接口类名", businessType = GenBusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Apiclass apiclass) {
try {
@@ -168,15 +167,15 @@ public class ApiclassController extends HcyBaseController {
if (apiclass.getcDescribe() == null || apiclass.getcDescribe().equals("")) {
return AjaxResult.error("类描述不能为空!");
}
- ServerResult serverResult = apiclassService.updateApiclass(apiclass);
- if (serverResult.isStart()) {
+ GenServerResult genServerResult = apiclassService.updateApiclass(apiclass);
+ if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -184,22 +183,22 @@ public class ApiclassController extends HcyBaseController {
* 删除接口类名
*/
@PreAuthorize("@hchyun.hasPermi('tool:apiclass:remove')")
- @Log(title = "接口类名", businessType = BusinessType.DELETE)
+ @Log(title = "接口类名", businessType = GenBusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
try {
if (ids.length < 0) {
return AjaxResult.error("id不能为空!");
}
- ServerResult serverResult = apiclassService.deleteApiclassByIds(ids);
- if (serverResult.isStart()) {
+ GenServerResult genServerResult = apiclassService.deleteApiclassByIds(ids);
+ if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AssociatedController.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AssociatedController.java
index 4230619..3028369 100644
--- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AssociatedController.java
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/AssociatedController.java
@@ -1,12 +1,9 @@
package com.hchyun.generator.controller;
-import com.hchyun.common.constant.ReturnConstants;
-import com.hchyun.common.core.entity.AjaxResult;
-import com.hchyun.common.utils.ServerResult;
import com.hchyun.generator.entity.AssColumn;
import com.hchyun.generator.service.AssociatedService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import com.hchyun.generator.utils.GenReturnConstants;
+import com.hchyun.generator.utils.GenServerResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,15 +31,14 @@ public class AssociatedController {
private AssociatedService associatedService;
- @ApiOperation("tableid")
@GetMapping("/{tableId}")
private AjaxResult assColumnsByTable(@PathVariable("tableId") Long tableId) {
try {
- ServerResult> serverResult = associatedService.assColumnsByTable(tableId);
- if (serverResult.isStart()) {
- return AjaxResult.success(serverResult.getData());
+ GenServerResult> genServerResult = associatedService.assColumnsByTable(tableId);
+ if (genServerResult.isStart()) {
+ return AjaxResult.success(genServerResult.getData());
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
@@ -50,35 +46,33 @@ public class AssociatedController {
}
}
- @ApiOperation("获取表信息")
@GetMapping("/tableinfos")
public AjaxResult tableInfos() {
try {
- ServerResult>> serverResult = associatedService.tableInfos();
- if (serverResult.isStart()) {
- return AjaxResult.success(serverResult.getData());
+ GenServerResult>> genServerResult = associatedService.tableInfos();
+ if (genServerResult.isStart()) {
+ return AjaxResult.success(genServerResult.getData());
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
- @ApiOperation("关联表字段")
@GetMapping("/{tableName}/{tableId}")
public AjaxResult assColumns(@PathVariable("tableName") String tableName, @PathVariable("tableId") Long tableId) {
try {
- ServerResult> serverResult = associatedService.assColumns(tableName, tableId);
- if (serverResult.isStart()) {
- return AjaxResult.success(serverResult.getData());
+ GenServerResult> genServerResult = associatedService.assColumns(tableName, tableId);
+ if (genServerResult.isStart()) {
+ return AjaxResult.success(genServerResult.getData());
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
}
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/GenController.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/GenController.java
index c7125a0..4ccafde 100644
--- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/GenController.java
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/GenController.java
@@ -7,8 +7,13 @@ import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
-import com.hchyun.common.constant.ReturnConstants;
-import com.hchyun.common.utils.ServerResult;
+import com.hchyun.generator.aop.Log;
+import com.hchyun.generator.enums.GenBusinessType;
+import com.hchyun.generator.utils.GenBaseController;
+import com.hchyun.generator.utils.GenReturnConstants;
+import com.hchyun.generator.utils.GenServerResult;
+import com.hchyun.generator.utils.page.GenTableDataInfo;
+import com.hchyun.generator.utils.text.Convert;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,12 +28,6 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.hchyun.common.annotation.Log;
-import com.hchyun.common.core.controller.BaseController;
-import com.hchyun.common.core.entity.AjaxResult;
-import com.hchyun.common.core.page.TableDataInfo;
-import com.hchyun.common.core.text.Convert;
-import com.hchyun.common.enums.BusinessType;
import com.hchyun.generator.entity.GenTable;
import com.hchyun.generator.entity.GenTableColumn;
import com.hchyun.generator.service.GenTableColumnService;
@@ -41,7 +40,7 @@ import com.hchyun.generator.service.GenTableService;
*/
@RestController
@RequestMapping("/tool/gen")
-public class GenController extends BaseController {
+public class GenController extends GenBaseController {
private Logger logger = LoggerFactory.getLogger(GenController.class);
@Autowired
@@ -94,7 +93,7 @@ public class GenController extends BaseController {
@PreAuthorize("@hchyun.hasPermi('tool:gen:list')")
@GetMapping(value = "/column/{talbleId}")
public Serializable columnList(Long tableId) {
- TableDataInfo dataInfo = new TableDataInfo();
+ GenTableDataInfo dataInfo = new GenTableDataInfo();
List list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
dataInfo.setRows(list);
dataInfo.setTotal(list.size());
@@ -105,7 +104,7 @@ public class GenController extends BaseController {
* 导入表结构(保存)
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:list')")
- @Log(title = "代码生成", businessType = BusinessType.IMPORT)
+ @Log(title = "代码生成", businessType = GenBusinessType.IMPORT)
@PostMapping("/importTable")
public AjaxResult importTableSave(String tables) {
String[] tableNames = Convert.toStrArray(tables);
@@ -120,7 +119,7 @@ public class GenController extends BaseController {
* 修改保存代码生成业务
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:edit')")
- @Log(title = "代码生成", businessType = BusinessType.UPDATE)
+ @Log(title = "代码生成", businessType = GenBusinessType.UPDATE)
@PutMapping
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
genTableService.validateEdit(genTable);
@@ -132,19 +131,19 @@ public class GenController extends BaseController {
* 删除代码生成
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:remove')")
- @Log(title = "代码生成", businessType = BusinessType.DELETE)
+ @Log(title = "代码生成", businessType = GenBusinessType.DELETE)
@DeleteMapping("/{tableIds}")
public AjaxResult remove(@PathVariable Long[] tableIds) {
try {
- ServerResult serverResult = genTableService.deleteGenTableByIds(tableIds);
- if (serverResult.isStart()) {
+ GenServerResult genServerResult = genTableService.deleteGenTableByIds(tableIds);
+ if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
- return AjaxResult.error(serverResult.getMsg());
+ return AjaxResult.error(genServerResult.getMsg());
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
- return AjaxResult.error(ReturnConstants.SYS_ERROR);
+ return AjaxResult.error(GenReturnConstants.SYS_ERROR);
}
}
@@ -162,7 +161,7 @@ public class GenController extends BaseController {
* 生成代码(下载方式)
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
- @Log(title = "代码生成", businessType = BusinessType.GENCODE)
+ @Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
@GetMapping("/download/{tableName}")
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
byte[] data = genTableService.downloadCode(tableName);
@@ -173,7 +172,7 @@ public class GenController extends BaseController {
* 生成代码(自定义路径)
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
- @Log(title = "代码生成", businessType = BusinessType.GENCODE)
+ @Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
@GetMapping("/genCode/{tableName}")
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
boolean start = genTableService.generatorCode(tableName);
@@ -188,7 +187,7 @@ public class GenController extends BaseController {
* 同步数据库
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:edit')")
- @Log(title = "代码生成", businessType = BusinessType.UPDATE)
+ @Log(title = "代码生成", businessType = GenBusinessType.UPDATE)
@GetMapping("/synchDb/{tableName}")
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
genTableService.synchDb(tableName);
@@ -199,7 +198,7 @@ public class GenController extends BaseController {
* 批量生成代码
*/
@PreAuthorize("@hchyun.hasPermi('tool:gen:code')")
- @Log(title = "代码生成", businessType = BusinessType.GENCODE)
+ @Log(title = "代码生成", businessType = GenBusinessType.GENCODE)
@GetMapping("/batchGenCode")
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
String[] tableNames = Convert.toStrArray(tables);
diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/InterTableController.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/InterTableController.java
index 8cf1e6a..9eaea90 100644
--- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/InterTableController.java
+++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/InterTableController.java
@@ -5,14 +5,12 @@ import java.io.Serializable;
import java.util.Map;
-import com.hchyun.common.constant.ReturnConstants;
-import com.hchyun.common.core.controller.HcyBaseController;
-import com.hchyun.common.utils.ServerResult;
+import com.hchyun.generator.aop.Log;
import com.hchyun.generator.dto.InterTableDto;
-import com.hchyun.generator.entity.Apiclass;
-import com.hchyun.generator.service.ApiclassService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import com.hchyun.generator.enums.GenBusinessType;
+import com.hchyun.generator.utils.GenBaseController;
+import com.hchyun.generator.utils.GenReturnConstants;
+import com.hchyun.generator.utils.GenServerResult;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -20,19 +18,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.hchyun.common.annotation.Log;
-import com.hchyun.common.core.entity.AjaxResult;
-import com.hchyun.common.enums.BusinessType;
import com.hchyun.generator.entity.InterTable;
import com.hchyun.generator.service.InterTableService;
-import com.hchyun.common.utils.poi.ExcelUtil;
import javax.servlet.http.HttpServletResponse;
@@ -45,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/generator/intertable")
-public class InterTableController extends HcyBaseController {
+public class InterTableController extends GenBaseController {
protected final Logger logger = LoggerFactory.getLogger(InterTableController.class);
@Autowired
@@ -58,15 +50,15 @@ public class InterTableController extends HcyBaseController {
@GetMapping("/list")
public Serializable list(InterTable interTable) {
try {
- ServerResult