Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duiba-generator
Project
Project
Details
Activity
Releases
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
孙长纪
duiba-generator
Commits
622f1c1b
Commit
622f1c1b
authored
Mar 29, 2019
by
孙长纪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
废弃项目
parent
d56beaf2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
20 deletions
+17
-20
MybatisGenerator.java
...n/java/cn/com/duiba/duiba/generator/MybatisGenerator.java
+1
-1
DuibaGeneratorException.java
...a/duiba/generator/exceptions/DuibaGeneratorException.java
+1
-2
AbstractGenerator.java
.../com/duiba/duiba/generator/gencode/AbstractGenerator.java
+1
-1
JavaDaoGenerator.java
...n/com/duiba/duiba/generator/gencode/JavaDaoGenerator.java
+1
-1
JavaDaoImplGenerator.java
...m/duiba/duiba/generator/gencode/JavaDaoImplGenerator.java
+1
-1
JavaEntityGenerator.java
...om/duiba/duiba/generator/gencode/JavaEntityGenerator.java
+1
-1
SQLXmlGenerator.java
...cn/com/duiba/duiba/generator/gencode/SQLXmlGenerator.java
+1
-1
DuibaFreemarkerService.java
...om/duiba/duiba/generator/tpls/DuibaFreemarkerService.java
+9
-11
CodeGeneratorTest.java
.../java/cn/com/duiba/duiba/generator/CodeGeneratorTest.java
+1
-1
No files found.
src/main/java/cn/com/duiba/duiba/generator/MybatisGenerator.java
View file @
622f1c1b
...
@@ -7,7 +7,7 @@ import cn.com.duiba.duiba.generator.gencode.JavaDaoGenerator;
...
@@ -7,7 +7,7 @@ import cn.com.duiba.duiba.generator.gencode.JavaDaoGenerator;
import
cn.com.duiba.duiba.generator.gencode.JavaDaoImplGenerator
;
import
cn.com.duiba.duiba.generator.gencode.JavaDaoImplGenerator
;
import
cn.com.duiba.duiba.generator.gencode.JavaEntityGenerator
;
import
cn.com.duiba.duiba.generator.gencode.JavaEntityGenerator
;
import
cn.com.duiba.duiba.generator.gencode.SQLXmlGenerator
;
import
cn.com.duiba.duiba.generator.gencode.SQLXmlGenerator
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.utils.DBUtils
;
import
cn.com.duiba.duiba.generator.utils.DBUtils
;
import
java.sql.Connection
;
import
java.sql.Connection
;
...
...
src/main/java/cn/com/duiba/duiba/generator/exceptions/DuibaGeneratorException.java
View file @
622f1c1b
package
cn
.
com
.
duiba
.
duiba
.
generator
.
exceptions
;
package
cn
.
com
.
duiba
.
duiba
.
generator
.
exceptions
;
public
class
DuibaGeneratorException
extends
RuntimeException
{
public
class
DuibaGeneratorException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
1832371381972592054L
;
private
static
final
long
serialVersionUID
=
-
1832371381972592054L
;
...
@@ -11,5 +11,4 @@ public class DuibaGeneratorException extends RuntimeException{
...
@@ -11,5 +11,4 @@ public class DuibaGeneratorException extends RuntimeException{
public
DuibaGeneratorException
(
Throwable
cause
)
{
public
DuibaGeneratorException
(
Throwable
cause
)
{
super
(
cause
);
super
(
cause
);
}
}
}
}
src/main/java/cn/com/duiba/duiba/generator/gencode/AbstractGenerator.java
View file @
622f1c1b
...
@@ -3,7 +3,7 @@ package cn.com.duiba.duiba.generator.gencode;
...
@@ -3,7 +3,7 @@ package cn.com.duiba.duiba.generator.gencode;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.exceptions.DuibaGeneratorException
;
import
cn.com.duiba.duiba.generator.exceptions.DuibaGeneratorException
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
java.io.File
;
import
java.io.File
;
...
...
src/main/java/cn/com/duiba/duiba/generator/gencode/JavaDaoGenerator.java
View file @
622f1c1b
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
public
class
JavaDaoGenerator
extends
AbstractGenerator
{
public
class
JavaDaoGenerator
extends
AbstractGenerator
{
...
...
src/main/java/cn/com/duiba/duiba/generator/gencode/JavaDaoImplGenerator.java
View file @
622f1c1b
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
/**
/**
...
...
src/main/java/cn/com/duiba/duiba/generator/gencode/JavaEntityGenerator.java
View file @
622f1c1b
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
import
cn.com.duiba.duiba.generator.utils.PathUtils
;
/**
/**
...
...
src/main/java/cn/com/duiba/duiba/generator/gencode/SQLXmlGenerator.java
View file @
622f1c1b
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
...
@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.GeneratorConfig
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.entity.TableEntity
;
import
cn.com.duiba.duiba.generator.
service
s.DuibaFreemarkerService
;
import
cn.com.duiba.duiba.generator.
tpl
s.DuibaFreemarkerService
;
public
class
SQLXmlGenerator
extends
AbstractGenerator
{
public
class
SQLXmlGenerator
extends
AbstractGenerator
{
...
...
src/main/java/cn/com/duiba/duiba/generator/
service
s/DuibaFreemarkerService.java
→
src/main/java/cn/com/duiba/duiba/generator/
tpl
s/DuibaFreemarkerService.java
View file @
622f1c1b
package
cn
.
com
.
duiba
.
duiba
.
generator
.
service
s
;
package
cn
.
com
.
duiba
.
duiba
.
generator
.
tpl
s
;
import
freemarker.template.Configuration
;
import
freemarker.template.Configuration
;
import
freemarker.template.DefaultObjectWrapper
;
import
freemarker.template.DefaultObjectWrapper
;
...
@@ -12,18 +12,16 @@ import java.util.Map;
...
@@ -12,18 +12,16 @@ import java.util.Map;
/**
/**
* FreeMarker模板
* FreeMarker模板
*
* @author sunchangji
*/
*/
public
class
DuibaFreemarkerService
{
public
class
DuibaFreemarkerService
{
private
String
location
;
private
String
location
;
private
String
suffix
;
private
String
suffix
;
private
Configuration
cfg
=
new
Configuration
();
private
Configuration
cfg
=
new
Configuration
();
private
String
encoding
=
"utf-8"
;
private
String
encoding
=
"utf-8"
;
public
DuibaFreemarkerService
(){
public
DuibaFreemarkerService
()
{
cfg
.
setDefaultEncoding
(
encoding
);
cfg
.
setDefaultEncoding
(
encoding
);
cfg
.
setClassForTemplateLoading
(
DuibaFreemarkerService
.
class
,
""
);
cfg
.
setClassForTemplateLoading
(
DuibaFreemarkerService
.
class
,
""
);
cfg
.
setObjectWrapper
(
new
DefaultObjectWrapper
());
cfg
.
setObjectWrapper
(
new
DefaultObjectWrapper
());
...
@@ -34,14 +32,14 @@ public class DuibaFreemarkerService {
...
@@ -34,14 +32,14 @@ public class DuibaFreemarkerService {
public
String
merge
(
String
template
,
Map
<
String
,
Object
>
model
)
{
public
String
merge
(
String
template
,
Map
<
String
,
Object
>
model
)
{
try
{
try
{
Template
tpl
=
cfg
.
getTemplate
(
template
+
"."
+
suffix
);
Template
tpl
=
cfg
.
getTemplate
(
template
+
"."
+
suffix
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
OutputStreamWriter
writer
=
new
OutputStreamWriter
(
bos
);
OutputStreamWriter
writer
=
new
OutputStreamWriter
(
bos
);
tpl
.
process
(
model
,
writer
);
tpl
.
process
(
model
,
writer
);
writer
.
flush
();
writer
.
flush
();
writer
.
close
();
writer
.
close
();
byte
[]
byteArray
=
bos
.
toByteArray
();
byte
[]
byteArray
=
bos
.
toByteArray
();
return
new
String
(
byteArray
,
encoding
);
return
new
String
(
byteArray
,
encoding
);
}
catch
(
IOException
|
TemplateException
e
)
{
}
catch
(
IOException
|
TemplateException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
src/test/java/cn/com/duiba/duiba/generator/CodeGeneratorTest.java
View file @
622f1c1b
...
@@ -12,7 +12,7 @@ public class CodeGeneratorTest {
...
@@ -12,7 +12,7 @@ public class CodeGeneratorTest {
String
pwd
=
"dev_fas015"
;
String
pwd
=
"dev_fas015"
;
GeneratorConfig
config
=
new
GeneratorConfig
(
DB_URL
,
user
,
pwd
);
GeneratorConfig
config
=
new
GeneratorConfig
(
DB_URL
,
user
,
pwd
);
config
.
setDaoPackage
(
"cn.com.duiba.
shark
.mybatis.generator.test.dao"
);
config
.
setDaoPackage
(
"cn.com.duiba..mybatis.generator.test.dao"
);
config
.
setEntityPackage
(
"cn.com.duiba.shark.mybatis.generator.test.entity"
);
config
.
setEntityPackage
(
"cn.com.duiba.shark.mybatis.generator.test.entity"
);
config
.
setXmlLocation
(
"src/main/resources"
);
config
.
setXmlLocation
(
"src/main/resources"
);
config
.
setTableSchema
(
"act_com_conf"
);
config
.
setTableSchema
(
"act_com_conf"
);
...
...
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