diff --git a/hchyun-ui/src/views/tool/apiclass/apiclassInfoForm.vue b/hchyun-ui/src/views/tool/apiclass/apiclassInfoForm.vue
index cc6e904..120eeb0 100644
--- a/hchyun-ui/src/views/tool/apiclass/apiclassInfoForm.vue
+++ b/hchyun-ui/src/views/tool/apiclass/apiclassInfoForm.vue
@@ -52,67 +52,68 @@
diff --git a/hchyun-ui/src/views/tool/apiclass/index.vue b/hchyun-ui/src/views/tool/apiclass/index.vue
index 4efb8ef..2bc61e0 100644
--- a/hchyun-ui/src/views/tool/apiclass/index.vue
+++ b/hchyun-ui/src/views/tool/apiclass/index.vue
@@ -222,7 +222,11 @@
import {queryListModule} from "@/api/tool/module"
import {getClassPreview} from "@/api/tool/interTable"
import hljs from "highlight.js/lib/highlight";
+ import "highlight.js/styles/github-gist.css";
+ import {genCode} from "@/api/tool/gen";
+ import {downLoadZip} from "@/utils/zipdownload";
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
+ hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
export default {
name: "Apiclass",
components: {},
@@ -307,17 +311,23 @@
methods: {
/** 预览代码 */
handlePreview(id){
- getClassPreview(3).then(res =>{
+ console.log(id)
+ getClassPreview(id).then(res =>{
this.preview.data = res.data;
this.preview.open = true;
var keys = Object.keys(res.data)
this.preview.activeName = keys[0]
})
},
+ /** 生成代码操作 */
+ handleGenTable(row) {
+ downLoadZip("/generator/intertable/classgen/" + row.id, "hchyun");
+ },
/** 高亮显示 */
highlightedCode(code, key) {
const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
+ console.log(language)
const result = hljs.highlight(language, code || "", true);
return result.value || ' ';
},
@@ -352,8 +362,8 @@
if (start) {
str = ''
}
- this.form.packageName = 'com.hchyun.' + str +"."
- this.form.prefix = str+":"+this.form.cName + ":"
+ this.form.packageName = 'com.hchyun.' + str
+ this.form.prefix = str+":"+this.form.cName.toLowerCase()
},
// 表单重置
reset() {
diff --git a/hchyun-ui/src/views/tool/gen/index.vue b/hchyun-ui/src/views/tool/gen/index.vue
index 46b05fb..9a00514 100644
--- a/hchyun-ui/src/views/tool/gen/index.vue
+++ b/hchyun-ui/src/views/tool/gen/index.vue
@@ -306,6 +306,7 @@ export default {
highlightedCode(code, key) {
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
+ console.log(language)
const result = hljs.highlight(language, code || "", true);
return result.value || ' ';
},
diff --git a/hchyun-ui/src/views/tool/module/index.vue b/hchyun-ui/src/views/tool/module/index.vue
index 524ffbb..97ba1e7 100644
--- a/hchyun-ui/src/views/tool/module/index.vue
+++ b/hchyun-ui/src/views/tool/module/index.vue
@@ -104,7 +104,7 @@
type="text"
size="small"
icon="el-icon-view"
- @click="handlePreview(scope.row)"
+ @click="handlePreview(scope.row.id)"
v-hasPermi="['tool:apiclass:preview']"
>预览
{
+ console.log(id)
+ getModulePreview(id).then(res=>{
this.preview.data = res.data;
this.preview.open = true;
var keys = Object.keys(res.data)
@@ -256,6 +259,7 @@ export default {
highlightedCode(code, key) {
const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
+ console.log(language)
const result = hljs.highlight(language, code || "", true);
return result.value || ' ';
},
diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/constant/ReturnConstants.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/constant/ReturnConstants.java
index 288e55e..e7c7f33 100644
--- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/constant/ReturnConstants.java
+++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/constant/ReturnConstants.java
@@ -18,4 +18,8 @@ public class ReturnConstants {
* 操作失败
*/
public static final String SYS_FAILL = "数据库异常!";
+ /**
+ * 接口为空
+ */
+ public static final String INTER_NULL = "该类下接口数据为空,请先添加接口!";
}
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 829f022..607257d 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
@@ -1,5 +1,6 @@
package com.hchyun.generator.controller;
+import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
@@ -14,6 +15,7 @@ import com.hchyun.generator.entity.Apiclass;
import com.hchyun.generator.service.ApiclassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -34,6 +36,8 @@ import com.hchyun.generator.entity.InterTable;
import com.hchyun.generator.service.InterTableService;
import com.hchyun.common.utils.poi.ExcelUtil;
+import javax.servlet.http.HttpServletResponse;
+
/**
* 接口信息Controller
*
@@ -76,16 +80,18 @@ public class InterTableController extends HcyBaseController {
*/
@ApiOperation("预览代码(工作流)")
+ @PreAuthorize("@ss.hasPermi('generator:intertable:classpreview')")
+ @Log(title = "预览代码(工作流)", businessType = BusinessType.GENCODE)
@GetMapping("/classpreview/{id}")
- public AjaxResult classPreview(@PathVariable("id") Long id){
+ public AjaxResult classPreview(@PathVariable("id") Long id) {
try {
- ServerResult