1
0
فهرست منبع

修复代码生成bug

zhh 3 سال پیش
والد
کامیت
b47081ec35

+ 1 - 1
kmall-admin/src/main/webapp/js/sys/generator.js

@@ -61,7 +61,7 @@ var vm = new Vue({
             if (tableNames == null) {
                 return;
             }
-            location.href = "../sys/generator/code?tables=" + JSON.stringify(tableNames);
+            location.href = "../sys/generator/code?tables="+tableNames;
         }
     }
 });

+ 3 - 2
kmall-gen/src/main/java/com/kmall/gen/controller/SysGeneratorController.java

@@ -1,6 +1,7 @@
 package com.kmall.gen.controller;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.kmall.gen.service.SysGeneratorService;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
@@ -10,6 +11,7 @@ import org.apache.commons.io.IOUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -60,9 +62,8 @@ public class SysGeneratorController {
         //获取表名,不进行xss过滤
         HttpServletRequest orgRequest = XssHttpServletRequestWrapper.getOrgRequest(request);
         String tables = orgRequest.getParameter("tables");
-        tableNames = JSON.parseArray(tables).toArray(tableNames);
 
-        byte[] data = sysGeneratorService.generatorCode(tableNames);
+        byte[] data = sysGeneratorService.generatorCode(tables.split(","));
 
         response.reset();
         response.setHeader("Content-Disposition", "attachment; filename=\"AutoCode.zip\"");