Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZhangKuan
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
JIRA
JIRA
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
张宽
ZhangKuan
Commits
4b099408
Commit
4b099408
authored
Oct 06, 2016
by
胡小根
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
可以成功生成一个表的dao/mapper等
parent
231c3598
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
3519 additions
and
77 deletions
+3519
-77
CrmUserMapper.java
...m/haomostudio/SpringMVCProjectTemplate/CrmUserMapper.java
+96
-0
mybatis-generator.md
docs/wiki/mybatis-generator.md
+10
-0
CrmUser.java
...ava/com/haomostudio/SpringMVCProjectTemplate/CrmUser.java
+830
-0
CrmUserExample.java
.../haomostudio/SpringMVCProjectTemplate/CrmUserExample.java
+1963
-0
pom.xml
pom.xml
+1
-10
generatorConfig.xml
src/main/resources/generatorConfig.xml
+0
-47
test.properties
web/src/main/filters/test.properties
+4
-4
application.properties
web/src/main/resources/config/application.properties
+4
-4
CrmUserMapper.xml
...om/haomostudio/SpringMVCProjectTemplate/CrmUserMapper.xml
+600
-0
mysqlGeneratorConfig.xml
web/src/main/resources/mybatis/mysqlGeneratorConfig.xml
+0
-0
oracleGeneratorConfig.xml
web/src/main/resources/mybatis/oracleGeneratorConfig.xml
+11
-12
No files found.
dao/src/main/java/com/haomostudio/SpringMVCProjectTemplate/CrmUserMapper.java
0 → 100644
View file @
4b099408
package
com
.
haomostudio
.
SpringMVCProjectTemplate
;
import
com.haomostudio.SpringMVCProjectTemplate.CrmUser
;
import
com.haomostudio.SpringMVCProjectTemplate.CrmUserExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
CrmUserMapper
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
long
countByExample
(
CrmUserExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
deleteByExample
(
CrmUserExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
deleteByPrimaryKey
(
String
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
insert
(
CrmUser
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
insertSelective
(
CrmUser
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
List
<
CrmUser
>
selectByExample
(
CrmUserExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
CrmUser
selectByPrimaryKey
(
String
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
updateByExampleSelective
(
@Param
(
"record"
)
CrmUser
record
,
@Param
(
"example"
)
CrmUserExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
updateByExample
(
@Param
(
"record"
)
CrmUser
record
,
@Param
(
"example"
)
CrmUserExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
updateByPrimaryKeySelective
(
CrmUser
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table CRM_USER
*
* @mbg.generated Thu Oct 06 17:59:41 CST 2016
*/
int
updateByPrimaryKey
(
CrmUser
record
);
}
\ No newline at end of file
docs/wiki/mybatis-generator.md
0 → 100644
View file @
4b099408
# MyBatis Generator
采用MyBatis Generator自动生成以下代码:
mapper.xml
mapper.java
domain.java
运行如下命令:
mvn mybatis-generator:generate -pl web # 注意: 只需要执行子目录web的配置文件就可以了
\ No newline at end of file
domain/src/main/java/com/haomostudio/SpringMVCProjectTemplate/CrmUser.java
0 → 100644
View file @
4b099408
This diff is collapsed.
Click to expand it.
domain/src/main/java/com/haomostudio/SpringMVCProjectTemplate/CrmUserExample.java
0 → 100644
View file @
4b099408
This diff is collapsed.
Click to expand it.
pom.xml
View file @
4b099408
...
...
@@ -453,15 +453,6 @@
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.5
</version>
<configuration>
<configurationFile>
${project.basedir}/web/src/main/resources/config/mysqlGeneratorConfig.xml
</configurationFile>
<verbose>
true
</verbose>
<overwrite>
true
</overwrite>
<jdbcDriver>
com.mysql.jdbc.Driver
</jdbcDriver>
<jdbcURL>
jdbc:mysql://127.0.0.1:3306/zhuluoxi
</jdbcURL>
<jdbcUserId>
root
</jdbcUserId>
<jdbcPassword>
123456
</jdbcPassword>
</configuration>
</plugin>
</plugins>
</pluginManagement>
...
...
@@ -472,7 +463,7 @@
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.5
</version>
<configuration>
<configurationFile>
${
project.basedir}/web/src/main/resources/config/mysql
GeneratorConfig.xml
</configurationFile>
<configurationFile>
${
basedir}/src/main/resources/mybatis/oracle
GeneratorConfig.xml
</configurationFile>
<verbose>
true
</verbose>
<overwrite>
true
</overwrite>
</configuration>
...
...
src/main/resources/generatorConfig.xml
deleted
100644 → 0
View file @
231c3598
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry
location=
"/Users/hxgqh/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar"
/>
<context
id=
"testTables"
targetRuntime=
"MyBatis3"
>
<jdbcConnection
driverClass=
"oracle.jdbc.driver.OracleDriver"
connectionURL=
"jdbc:oracle:thin:@bcs.hitevision.com:1521:crmd02"
userId=
"crm"
password=
"sohu2020"
/>
<!-- 指定生成的类型为java类型,避免数据库中number等类型字段 -->
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!-- 生成model模型,对应的包,存放位置可以指定具体的路径,如/ProjectName/src,也可以使用MAVEN来自动生成 -->
<javaModelGenerator
targetPackage=
"com.haomostudio.model"
targetProject=
"\domain\src"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaModelGenerator>
<!--对应的xml mapper文件 -->
<sqlMapGenerator
targetPackage=
"com.haomostudio.dao"
targetProject=
"\web\src\main\resources\mybatis"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- 对应的dao接口 -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.jacksoft.mybatis.generator.dao"
targetProject=
"\dao\src"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</javaClientGenerator>
<table
tableName=
"user"
domainObjectName=
"User"
/>
</context>
</generatorConfiguration>
web/src/main/filters/test.properties
View file @
4b099408
jdbc.driverClassName
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://127.0.0.1:3306/crm_dev?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username
=
root
jdbc.password
=
123456
\ No newline at end of file
#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://127.0.0.1:3306/crm_dev?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
#jdbc.username=root
#
jdbc.password
=
123456
\ No newline at end of file
web/src/main/resources/config/application.properties
View file @
4b099408
#mysql database setting
jdbc.driver
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://10.28.163.192:3306/smartchatNew?useUnicode=true&characterEncoding=UTF-8
jdbc.username
=
knowledge
jdbc.password
=
knowledge
#
jdbc.driver=com.mysql.jdbc.Driver
#
jdbc.url=jdbc:mysql://10.28.163.192:3306/smartchatNew?useUnicode=true&characterEncoding=UTF-8
#
jdbc.username=knowledge
#
jdbc.password=knowledge
#connection pool settings
jdbc.pool.maxIdle
=
10
...
...
web/src/main/resources/mybatis/com/haomostudio/SpringMVCProjectTemplate/CrmUserMapper.xml
0 → 100644
View file @
4b099408
This diff is collapsed.
Click to expand it.
web/src/main/resources/
config
/mysqlGeneratorConfig.xml
→
web/src/main/resources/
mybatis
/mysqlGeneratorConfig.xml
View file @
4b099408
File moved
web/src/main/resources/
config
/oracleGeneratorConfig.xml
→
web/src/main/resources/
mybatis
/oracleGeneratorConfig.xml
View file @
4b099408
...
...
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry
location=
"/Users/hxgqh/.m2/repository/
mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38
.jar"
/>
<classPathEntry
location=
"/Users/hxgqh/.m2/repository/
com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0
.jar"
/>
<context
id=
"testTables"
targetRuntime=
"MyBatis3"
>
<jdbcConnection
driverClass=
"oracle.jdbc.driver.OracleDriver"
...
...
@@ -19,29 +19,28 @@
</javaTypeResolver>
<!-- 生成model模型,对应的包,存放位置可以指定具体的路径,如/ProjectName/src,也可以使用MAVEN来自动生成 -->
<javaModelGenerator
targetPackage=
"com.haomostudio.
model
"
targetProject=
"
\domain\src
"
>
<javaModelGenerator
targetPackage=
"com.haomostudio.
SpringMVCProjectTemplate
"
targetProject=
"
domain/src/main/java/
"
>
<property
name=
"enableSubPackages"
value=
"
tru
e"
/>
value=
"
fals
e"
/>
</javaModelGenerator>
<!--对应的xml mapper文件 -->
<sqlMapGenerator
targetPackage=
"com.haomostudio.
dao
"
targetProject=
"
\web\src\main\resources\mybatis
"
>
<sqlMapGenerator
targetPackage=
"com.haomostudio.
SpringMVCProjectTemplate
"
targetProject=
"
web/src/main/resources/mybatis/
"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
</sqlMapGenerator>
<!-- 对应的dao接口 -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.
jacksoft.mybatis.generator.dao
"
targetProject=
"
\dao\src
"
>
targetPackage=
"com.
haomostudio.SpringMVCProjectTemplate
"
targetProject=
"
dao/src/main/java/
"
>
<property
name=
"enableSubPackages"
value=
"
tru
e"
/>
value=
"
fals
e"
/>
</javaClientGenerator>
<table
tableName=
"user"
domainObjectName=
"User"
/>
<table
tableName=
"crm_user"
domainObjectName=
"CrmUser"
/>
</context>
</generatorConfiguration>
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