Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
renren-generator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
renren-generator
Commits
ad1b4dbd
Commit
ad1b4dbd
authored
Aug 13, 2018
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复生成代码报异常
parent
73f2c5fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
19 deletions
+15
-19
SysGeneratorController.java
...ain/java/io/renren/controller/SysGeneratorController.java
+10
-14
generator.js
src/main/resources/static/js/generator.js
+5
-5
No files found.
src/main/java/io/renren/controller/SysGeneratorController.java
View file @
ad1b4dbd
...
...
@@ -46,23 +46,19 @@ public class SysGeneratorController {
return
R
.
ok
().
put
(
"page"
,
pageUtil
);
}
/**
* 生成代码
*/
@RequestMapping
(
"/code"
)
public
void
code
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
String
[]
tableNames
=
new
String
[]{};
String
tables
=
request
.
getParameter
(
"tables"
);
tableNames
=
JSON
.
parseArray
(
tables
).
toArray
(
tableNames
);
byte
[]
data
=
sysGeneratorService
.
generatorCode
(
tableNames
);
response
.
reset
();
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\"renren.zip\""
);
response
.
addHeader
(
"Content-Length"
,
""
+
data
.
length
);
response
.
setContentType
(
"application/octet-stream; charset=UTF-8"
);
IOUtils
.
write
(
data
,
response
.
getOutputStream
());
public
void
code
(
String
tables
,
HttpServletResponse
response
)
throws
IOException
{
byte
[]
data
=
sysGeneratorService
.
generatorCode
(
tables
.
split
(
","
));
response
.
reset
();
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\"renren.zip\""
);
response
.
addHeader
(
"Content-Length"
,
""
+
data
.
length
);
response
.
setContentType
(
"application/octet-stream; charset=UTF-8"
);
IOUtils
.
write
(
data
,
response
.
getOutputStream
());
}
}
src/main/resources/static/js/generator.js
View file @
ad1b4dbd
...
...
@@ -50,11 +50,11 @@ var vm = new Vue({
}).
trigger
(
"reloadGrid"
);
},
generator
:
function
()
{
var
tableNames
=
getSelectedRows
();
if
(
tableNames
==
null
){
return
;
}
location
.
href
=
"sys/generator/code?tables="
+
JSON
.
stringify
(
tableNames
);
var
tableNames
=
getSelectedRows
();
if
(
tableNames
==
null
){
return
;
}
location
.
href
=
"sys/generator/code?tables="
+
tableNames
.
join
(
);
}
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment