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
916b0400
Commit
916b0400
authored
Oct 06, 2016
by
胡小根
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成分页、过滤插件配置
parent
3e0d98f7
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
7 deletions
+50
-7
clean_mybatis_generated.sh
clean_mybatis_generated.sh
+4
-0
mybatis-generator.md
docs/wiki/mybatis-generator.md
+17
-1
pom.xml
pom.xml
+1
-1
mysqlGeneratorConfig.xml
web/src/main/resources/mybatis/mysqlGeneratorConfig.xml
+3
-0
oracleGeneratorConfig.xml
web/src/main/resources/mybatis/oracleGeneratorConfig.xml
+3
-0
business-config.xml
web/src/main/resources/spring/business-config.xml
+1
-1
spring-mvc-config.xml
web/src/main/resources/spring/spring-mvc-config.xml
+1
-0
sql-map-config.xml
web/src/main/resources/spring/sql-map-config.xml
+12
-2
web.xml
web/src/main/resources/webapp/WEB-INF/web.xml
+8
-2
No files found.
clean_mybatis_generated.sh
0 → 100644
View file @
916b0400
#!/bin/bash
rm
-rf
dao/src/main/java/com/haomostudio/SpringMVCProjectTemplate/
*
rm
-rf
domain/src/main/java/com/haomostudio/SpringMVCProjectTemplate/
*
rm
-rf
web/src/main/resources/mybatis/com/haomostudio/SpringMVCProjectTemplate/
*
docs/wiki/mybatis-generator.md
View file @
916b0400
...
...
@@ -9,4 +9,20 @@
mvn mybatis-generator:generate -pl web # 注意: 只需要执行子目录web的配置文件就可以了
项目的其他自动化代码, 还需要借助公司的Swagger2Code项目, 自动生成service和controller层的代码
功能说明如下:
实现了增删改查和列表功能
实现了翻页功能
实现了过滤功能
其他说明如下:
还需要借助公司的Swagger2Code项目, 自动生成service和controller层的代码
参考文档:
1. http://www.jianshu.com/p/e09d2370b796
2. http://www.mybatis.org/generator/index.html
3. http://mbg.cndocs.tk/index.html
4. https://my.oschina.net/miemiedev/blog/135516
pom.xml
View file @
916b0400
...
...
@@ -210,7 +210,7 @@
<artifactId>
mybatis
</artifactId>
<version>
${mybatis.version}
</version>
</dependency>
<!-- mybatis分页插件 -->
<!-- mybatis分页插件
. @Deprecated. 目前采用了官方的RowBoundsPlugin
-->
<dependency>
<groupId>
com.github.miemiedev
</groupId>
<artifactId>
mybatis-paginator
</artifactId>
...
...
web/src/main/resources/mybatis/mysqlGeneratorConfig.xml
View file @
916b0400
...
...
@@ -7,6 +7,9 @@
<classPathEntry
location=
"/Users/hxgqh/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar"
/>
<context
id=
"mysqlTables"
targetRuntime=
"MyBatis3"
>
<plugin
type=
"org.mybatis.generator.plugins.RowBoundsPlugin"
/>
<plugin
type=
"org.mybatis.generator.plugins.ToStringPlugin"
/>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/zhuluoxi"
userId=
"root"
...
...
web/src/main/resources/mybatis/oracleGeneratorConfig.xml
View file @
916b0400
...
...
@@ -7,6 +7,9 @@
<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"
>
<plugin
type=
"org.mybatis.generator.plugins.RowBoundsPlugin"
/>
<plugin
type=
"org.mybatis.generator.plugins.ToStringPlugin"
/>
<jdbcConnection
driverClass=
"oracle.jdbc.driver.OracleDriver"
connectionURL=
"jdbc:oracle:thin:@bcs.hitevision.com:1521:crmd02"
userId=
"crm"
...
...
web/src/main/resources/spring/business-config.xml
View file @
916b0400
...
...
@@ -24,7 +24,7 @@
<property
name=
"dataSource"
ref=
"crmDataSource"
/>
<property
name=
"mapperLocations"
>
<list>
<value>
classpath*:mybatis/*/*Mapper.xml
</value>
<value>
classpath*:mybatis/*
*
/*Mapper.xml
</value>
</list>
</property>
<property
name=
"configLocation"
value=
"classpath:spring/sql-map-config.xml"
/>
...
...
web/src/main/resources/spring/spring-mvc-config.xml
View file @
916b0400
...
...
@@ -56,6 +56,7 @@
<bean
class=
"org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"
>
<property
name=
"prettyPrint"
value=
"false"
/>
<property
name=
"objectMapper"
>
<!--bean class="com.github.miemiedev.mybatis.paginator.jackson2.PageListJsonMapper" /-->
<bean
class=
"com.fasterxml.jackson.databind.ObjectMapper"
>
<property
name=
"dateFormat"
>
<bean
class=
"java.text.SimpleDateFormat"
>
...
...
web/src/main/resources/spring/sql-map-config.xml
View file @
916b0400
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting
name=
"cacheEnabled"
value=
"true"
/>
...
...
@@ -10,4 +11,13 @@
<setting
name=
"defaultStatementTimeout"
value=
"25000"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
</settings>
<!--<plugins>-->
<!--<plugin interceptor="com.github.miemiedev.mybatis.paginator.OffsetLimitInterceptor">-->
<!--<property name="dialectClass"-->
<!--value="com.github.miemiedev.mybatis.paginator.dialect.MysqlDialect"/>-->
<!--<!–value="com.github.miemiedev.mybatis.paginator.dialect.OracleDialect"/>–>-->
<!--<property name="asyncTotalCount" value="true"/>-->
<!--</plugin>-->
<!--</plugins>-->
</configuration>
web/src/main/resources/webapp/WEB-INF/web.xml
View file @
916b0400
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:web=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version=
"2.5"
>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:web=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version=
"2.5"
>
<display-name>
crm-web
</display-name>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
com.github.miemiedev.mybatis.paginator.CleanupMybatisPaginatorListener
</listener-class>
</listener>
<context-param>
<param-name>
contextConfigLocation
</param-name>
...
...
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