@@ -38,8 +38,8 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu | |||||
<module>../spring-boot-demo-properties</module> | <module>../spring-boot-demo-properties</module> | ||||
<module>../spring-boot-demo-actuator</module> | <module>../spring-boot-demo-actuator</module> | ||||
<module>../spring-boot-demo-logback</module> | <module>../spring-boot-demo-logback</module> | ||||
<module>../spring-boot-demo-jpa</module> | |||||
<module>../spring-boot-demo-mybatis</module> | |||||
<module>../spring-boot-demo-orm-jpa</module> | |||||
<module>../spring-boot-demo-orm-mybatis</module> | |||||
<module>../spring-boot-demo-cache-redis</module> | <module>../spring-boot-demo-cache-redis</module> | ||||
<module>../spring-boot-demo-swagger</module> | <module>../spring-boot-demo-swagger</module> | ||||
<module>../spring-boot-demo-ureport2</module> | <module>../spring-boot-demo-ureport2</module> | ||||
@@ -133,8 +133,8 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu | |||||
| [spring-boot-demo-properties](./spring-boot-demo-properties) | spring-boot 读取配置文件中的内容 | | | [spring-boot-demo-properties](./spring-boot-demo-properties) | spring-boot 读取配置文件中的内容 | | ||||
| [spring-boot-demo-actuator](./spring-boot-demo-actuator) | spring-boot 集成 spring-boot-starter-actuator 用于监控 spring-boot 的启动和运行状态 | | | [spring-boot-demo-actuator](./spring-boot-demo-actuator) | spring-boot 集成 spring-boot-starter-actuator 用于监控 spring-boot 的启动和运行状态 | | ||||
| [spring-boot-demo-logback](./spring-boot-demo-logback) | spring-boot 集成 logback 日志 | | | [spring-boot-demo-logback](./spring-boot-demo-logback) | spring-boot 集成 logback 日志 | | ||||
| [spring-boot-demo-jpa](./spring-boot-demo-jpa) | spring-boot 集成 spring-boot-starter-data-jpa 操作数据库 | | |||||
| [spring-boot-demo-mybatis](./spring-boot-demo-mybatis) | spring-boot 集成 [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter)、[mybatis-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) | | |||||
| [spring-boot-demo-orm-jpa](./spring-boot-demo-orm-jpa) | spring-boot 集成 spring-boot-starter-data-jpa 操作数据库 | | |||||
| [spring-boot-demo-orm-mybatis](./spring-boot-demo-orm-mybatis) | spring-boot 集成 [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter)、[mybatis-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) | | |||||
| [spring-boot-demo-cache-redis](./spring-boot-demo-cache-redis) | spring-boot 使用 Redis 做缓存 | | | [spring-boot-demo-cache-redis](./spring-boot-demo-cache-redis) | spring-boot 使用 Redis 做缓存 | | ||||
| [spring-boot-demo-swagger](./spring-boot-demo-swagger) | spring-boot 集成 [spring-boot-starter-swagger](https://github.com/SpringForAll/spring-boot-starter-swagger) (由大佬[翟永超](http://blog.didispace.com/)开源)用于统一管理、测试 API 接口 | | | [spring-boot-demo-swagger](./spring-boot-demo-swagger) | spring-boot 集成 [spring-boot-starter-swagger](https://github.com/SpringForAll/spring-boot-starter-swagger) (由大佬[翟永超](http://blog.didispace.com/)开源)用于统一管理、测试 API 接口 | | ||||
| [spring-boot-demo-ureport2](./spring-boot-demo-ureport2) | spring-boot 集成 [ureport2](https://github.com/youseries/ureport) 实现自定义报表(ureport2可以轻松实现复杂的中国式报表,功能十分强大) | | | [spring-boot-demo-ureport2](./spring-boot-demo-ureport2) | spring-boot 集成 [ureport2](https://github.com/youseries/ureport) 实现自定义报表(ureport2可以轻松实现复杂的中国式报表,功能十分强大) | | ||||
@@ -1,14 +0,0 @@ | |||||
package com.xkcoding.springbootdemomybatis; | |||||
import org.mybatis.spring.annotation.MapperScan; | |||||
import org.springframework.boot.SpringApplication; | |||||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||||
@SpringBootApplication | |||||
@MapperScan(basePackages = {"com.xkcoding.springbootdemomybatis.mapper"}) | |||||
public class SpringBootDemoMybatisApplication { | |||||
public static void main(String[] args) { | |||||
SpringApplication.run(SpringBootDemoMybatisApplication.class, args); | |||||
} | |||||
} |
@@ -10,11 +10,11 @@ | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<artifactId>spring-boot-demo-jpa</artifactId> | |||||
<artifactId>spring-boot-demo-orm-jpa</artifactId> | |||||
<version>0.0.1-SNAPSHOT</version> | <version>0.0.1-SNAPSHOT</version> | ||||
<packaging>jar</packaging> | <packaging>jar</packaging> | ||||
<name>spring-boot-demo-jpa</name> | |||||
<name>spring-boot-demo-orm-jpa</name> | |||||
<description>Demo project for Spring Boot</description> | <description>Demo project for Spring Boot</description> | ||||
<parent> | <parent> | ||||
@@ -41,7 +41,7 @@ | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<finalName>spring-boot-demo-jpa</finalName> | |||||
<finalName>spring-boot-demo-orm-jpa</finalName> | |||||
</build> | </build> | ||||
</project> | </project> |
@@ -3,11 +3,11 @@ | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<artifactId>spring-boot-demo-jpa</artifactId> | |||||
<artifactId>spring-boot-demo-orm-jpa</artifactId> | |||||
<version>0.0.1-SNAPSHOT</version> | <version>0.0.1-SNAPSHOT</version> | ||||
<packaging>jar</packaging> | <packaging>jar</packaging> | ||||
<name>spring-boot-demo-jpa</name> | |||||
<name>spring-boot-demo-orm-jpa</name> | |||||
<description>Demo project for Spring Boot</description> | <description>Demo project for Spring Boot</description> | ||||
<parent> | <parent> | ||||
@@ -34,7 +34,7 @@ | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<finalName>spring-boot-demo-jpa</finalName> | |||||
<finalName>spring-boot-demo-orm-jpa</finalName> | |||||
</build> | </build> | ||||
</project> | </project> |
@@ -1,12 +1,12 @@ | |||||
package com.xkcoding.springbootdemojpa; | |||||
package com.xkcoding.springbootdemoormjpa; | |||||
import org.springframework.boot.SpringApplication; | import org.springframework.boot.SpringApplication; | ||||
import org.springframework.boot.autoconfigure.SpringBootApplication; | import org.springframework.boot.autoconfigure.SpringBootApplication; | ||||
@SpringBootApplication | @SpringBootApplication | ||||
public class SpringBootDemoJpaApplication { | |||||
public class SpringBootDemoOrmJpaApplication { | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
SpringApplication.run(SpringBootDemoJpaApplication.class, args); | |||||
SpringApplication.run(SpringBootDemoOrmJpaApplication.class, args); | |||||
} | } | ||||
} | } |
@@ -1,8 +1,8 @@ | |||||
package com.xkcoding.springbootdemojpa.controller; | |||||
package com.xkcoding.springbootdemoormjpa.controller; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.xkcoding.springbootdemojpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemojpa.service.JpaUserService; | |||||
import com.xkcoding.springbootdemoormjpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemoormjpa.service.JpaUserService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; |
@@ -1,4 +1,4 @@ | |||||
package com.xkcoding.springbootdemojpa.entity; | |||||
package com.xkcoding.springbootdemoormjpa.entity; | |||||
import lombok.Data; | import lombok.Data; | ||||
import org.hibernate.annotations.DynamicUpdate; | import org.hibernate.annotations.DynamicUpdate; |
@@ -1,6 +1,6 @@ | |||||
package com.xkcoding.springbootdemojpa.repository; | |||||
package com.xkcoding.springbootdemoormjpa.repository; | |||||
import com.xkcoding.springbootdemojpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemoormjpa.entity.JpaUser; | |||||
import org.springframework.data.jpa.repository.JpaRepository; | import org.springframework.data.jpa.repository.JpaRepository; | ||||
import org.springframework.data.jpa.repository.Query; | import org.springframework.data.jpa.repository.Query; | ||||
import org.springframework.data.repository.query.Param; | import org.springframework.data.repository.query.Param; |
@@ -1,6 +1,6 @@ | |||||
package com.xkcoding.springbootdemojpa.service; | |||||
package com.xkcoding.springbootdemoormjpa.service; | |||||
import com.xkcoding.springbootdemojpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemoormjpa.entity.JpaUser; | |||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.Pageable; | import org.springframework.data.domain.Pageable; | ||||
@@ -1,8 +1,8 @@ | |||||
package com.xkcoding.springbootdemojpa.service.impl; | |||||
package com.xkcoding.springbootdemoormjpa.service.impl; | |||||
import com.xkcoding.springbootdemojpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemojpa.repository.JpaUserRepository; | |||||
import com.xkcoding.springbootdemojpa.service.JpaUserService; | |||||
import com.xkcoding.springbootdemoormjpa.entity.JpaUser; | |||||
import com.xkcoding.springbootdemoormjpa.repository.JpaUserRepository; | |||||
import com.xkcoding.springbootdemoormjpa.service.JpaUserService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
import org.springframework.data.domain.Pageable; | import org.springframework.data.domain.Pageable; |
@@ -1,4 +1,4 @@ | |||||
package com.xkcoding.springbootdemojpa; | |||||
package com.xkcoding.springbootdemoormjpa; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; | |||||
@RunWith(SpringRunner.class) | @RunWith(SpringRunner.class) | ||||
@SpringBootTest | @SpringBootTest | ||||
public class SpringBootDemoJpaApplicationTests { | |||||
public class SpringBootDemoOrmJpaApplicationTests { | |||||
@Test | @Test | ||||
public void contextLoads() { | public void contextLoads() { |
@@ -1,4 +1,4 @@ | |||||
# spring-boot-demo-mybatis | |||||
# spring-boot-demo-orm-mybatis | |||||
依赖 [spring-boot-demo-parent](../spring-boot-demo-parent)、`mybatis-spring-boot-starter`、`druid-spring-boot-starter`、`mapper-spring-boot-starter`(通用Mapper)、`pagehelper-spring-boot-starter`(分页插件PageHelper) | 依赖 [spring-boot-demo-parent](../spring-boot-demo-parent)、`mybatis-spring-boot-starter`、`druid-spring-boot-starter`、`mapper-spring-boot-starter`(通用Mapper)、`pagehelper-spring-boot-starter`(分页插件PageHelper) | ||||
@@ -10,11 +10,11 @@ | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<artifactId>spring-boot-demo-mybatis</artifactId> | |||||
<artifactId>spring-boot-demo-orm-mybatis</artifactId> | |||||
<version>0.0.1-SNAPSHOT</version> | <version>0.0.1-SNAPSHOT</version> | ||||
<packaging>war</packaging> | <packaging>war</packaging> | ||||
<name>spring-boot-demo-mybatis</name> | |||||
<name>spring-boot-demo-orm-mybatis</name> | |||||
<description>Demo project for Spring Boot</description> | <description>Demo project for Spring Boot</description> | ||||
<parent> | <parent> | ||||
@@ -59,7 +59,7 @@ | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<finalName>spring-boot-demo-mybatis</finalName> | |||||
<finalName>spring-boot-demo-orm-mybatis</finalName> | |||||
</build> | </build> | ||||
</project> | </project> | ||||
@@ -122,7 +122,7 @@ spring: | |||||
merge-sql: true | merge-sql: true | ||||
# mybatis 配置 | # mybatis 配置 | ||||
mybatis: | mybatis: | ||||
type-aliases-package: com.xkcoding.springbootdemomybatis.model | |||||
type-aliases-package: com.xkcoding.springbootdemoormmybatistis.model | |||||
mapper-locations: classpath:mapper/*.xml | mapper-locations: classpath:mapper/*.xml | ||||
# 配置项:开启下划线到驼峰的自动转换. 作用:将数据库字段根据驼峰规则自动注入到对象属性 | # 配置项:开启下划线到驼峰的自动转换. 作用:将数据库字段根据驼峰规则自动注入到对象属性 | ||||
configuration: | configuration: | ||||
@@ -131,7 +131,7 @@ mybatis: | |||||
mapper: | mapper: | ||||
not-empty: false | not-empty: false | ||||
identity: MYSQL | identity: MYSQL | ||||
mappers: com.xkcoding.springbootdemomybatis.util.MyMapper | |||||
mappers: com.xkcoding.springbootdemoormmybatistis.util.MyMapper | |||||
# PageHelper 配置 | # PageHelper 配置 | ||||
pagehelper: | pagehelper: | ||||
helper-dialect: mysql | helper-dialect: mysql | ||||
@@ -164,15 +164,15 @@ INSERT INTO `mybatis_user` VALUES (1, 'klay', '13799008800', '2017-11-13 16:04:3 | |||||
INSERT INTO `mybatis_user` VALUES (2, 'Tome', '18988991234', '2017-11-13 16:13:28'); | INSERT INTO `mybatis_user` VALUES (2, 'Tome', '18988991234', '2017-11-13 16:13:28'); | ||||
``` | ``` | ||||
### SpringBootDemoMybatisApplication.java | |||||
### SpringBootDemoOrmMybatisApplication.java | |||||
```java | ```java | ||||
@SpringBootApplication | @SpringBootApplication | ||||
@MapperScan(basePackages = {"com.xkcoding.springbootdemomybatis.mapper"}) | |||||
public class SpringBootDemoMybatisApplication { | |||||
@MapperScan(basePackages = {"com.xkcoding.springbootdemoormmybatis.mapper"}) | |||||
public class SpringBootDemoOrmMybatisApplication { | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
SpringApplication.run(SpringBootDemoMybatisApplication.class, args); | |||||
SpringApplication.run(SpringBootDemoOrmMybatisApplication.class, args); | |||||
} | } | ||||
} | } | ||||
``` | ``` | ||||
@@ -223,7 +223,7 @@ public interface MybatisUserMapper extends MyMapper<MybatisUser> { | |||||
```xml | ```xml | ||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
<mapper namespace="com.xkcoding.springbootdemomybatis.mapper.MybatisUserMapper"> | |||||
<mapper namespace="com.xkcoding.springbootdemoormmybatis.mapper.MybatisUserMapper"> | |||||
<resultMap id="mybatisUserMap" type="com.xkcoding.springbootdemomybatis.model.MybatisUser"> | <resultMap id="mybatisUserMap" type="com.xkcoding.springbootdemomybatis.model.MybatisUser"> | ||||
<id property="id" column="id"/> | <id property="id" column="id"/> | ||||
@@ -3,11 +3,11 @@ | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<artifactId>spring-boot-demo-mybatis</artifactId> | |||||
<artifactId>spring-boot-demo-orm-mybatis</artifactId> | |||||
<version>0.0.1-SNAPSHOT</version> | <version>0.0.1-SNAPSHOT</version> | ||||
<packaging>war</packaging> | <packaging>war</packaging> | ||||
<name>spring-boot-demo-mybatis</name> | |||||
<name>spring-boot-demo-orm-mybatis</name> | |||||
<description>Demo project for Spring Boot</description> | <description>Demo project for Spring Boot</description> | ||||
<parent> | <parent> | ||||
@@ -52,7 +52,7 @@ | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<finalName>spring-boot-demo-mybatis</finalName> | |||||
<finalName>spring-boot-demo-orm-mybatis</finalName> | |||||
</build> | </build> | ||||
</project> | </project> |
@@ -0,0 +1,14 @@ | |||||
package com.xkcoding.springbootdemoormmybatis; | |||||
import org.mybatis.spring.annotation.MapperScan; | |||||
import org.springframework.boot.SpringApplication; | |||||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||||
@SpringBootApplication | |||||
@MapperScan(basePackages = {"com.xkcoding.springbootdemoormmybatis.mapper"}) | |||||
public class SpringBootDemoOrmMybatisApplication { | |||||
public static void main(String[] args) { | |||||
SpringApplication.run(SpringBootDemoOrmMybatisApplication.class, args); | |||||
} | |||||
} |
@@ -1,8 +1,8 @@ | |||||
package com.xkcoding.springbootdemomybatis.controller; | |||||
package com.xkcoding.springbootdemoormmybatis.controller; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.xkcoding.springbootdemomybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemomybatis.service.MybatisUserService; | |||||
import com.xkcoding.springbootdemoormmybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemoormmybatis.service.MybatisUserService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
@@ -1,7 +1,7 @@ | |||||
package com.xkcoding.springbootdemomybatis.mapper; | |||||
package com.xkcoding.springbootdemoormmybatis.mapper; | |||||
import com.xkcoding.springbootdemomybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemomybatis.util.MyMapper; | |||||
import com.xkcoding.springbootdemoormmybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemoormmybatis.util.MyMapper; | |||||
import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -1,4 +1,4 @@ | |||||
package com.xkcoding.springbootdemomybatis.model; | |||||
package com.xkcoding.springbootdemoormmybatis.model; | |||||
import lombok.*; | import lombok.*; | ||||
@@ -1,6 +1,6 @@ | |||||
package com.xkcoding.springbootdemomybatis.service; | |||||
package com.xkcoding.springbootdemoormmybatis.service; | |||||
import com.xkcoding.springbootdemomybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemoormmybatis.model.MybatisUser; | |||||
import java.util.List; | import java.util.List; | ||||
@@ -1,10 +1,9 @@ | |||||
package com.xkcoding.springbootdemomybatis.service.impl; | |||||
package com.xkcoding.springbootdemoormmybatis.service.impl; | |||||
import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
import com.xiaoleilu.hutool.util.PageUtil; | |||||
import com.xkcoding.springbootdemomybatis.mapper.MybatisUserMapper; | |||||
import com.xkcoding.springbootdemomybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemomybatis.service.MybatisUserService; | |||||
import com.xkcoding.springbootdemoormmybatis.mapper.MybatisUserMapper; | |||||
import com.xkcoding.springbootdemoormmybatis.model.MybatisUser; | |||||
import com.xkcoding.springbootdemoormmybatis.service.MybatisUserService; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; |
@@ -1,4 +1,4 @@ | |||||
package com.xkcoding.springbootdemomybatis.util; | |||||
package com.xkcoding.springbootdemoormmybatis.util; | |||||
import tk.mybatis.mapper.common.Mapper; | import tk.mybatis.mapper.common.Mapper; | ||||
import tk.mybatis.mapper.common.MySqlMapper; | import tk.mybatis.mapper.common.MySqlMapper; |
@@ -52,7 +52,7 @@ spring: | |||||
merge-sql: true | merge-sql: true | ||||
# mybatis 配置 | # mybatis 配置 | ||||
mybatis: | mybatis: | ||||
type-aliases-package: com.xkcoding.springbootdemomybatis.model | |||||
type-aliases-package: com.xkcoding.springbootdemoormmybatistis.model | |||||
mapper-locations: classpath:mapper/*.xml | mapper-locations: classpath:mapper/*.xml | ||||
# 配置项:开启下划线到驼峰的自动转换. 作用:将数据库字段根据驼峰规则自动注入到对象属性 | # 配置项:开启下划线到驼峰的自动转换. 作用:将数据库字段根据驼峰规则自动注入到对象属性 | ||||
configuration: | configuration: | ||||
@@ -61,7 +61,7 @@ mybatis: | |||||
mapper: | mapper: | ||||
not-empty: false | not-empty: false | ||||
identity: MYSQL | identity: MYSQL | ||||
mappers: com.xkcoding.springbootdemomybatis.util.MyMapper | |||||
mappers: com.xkcoding.springbootdemoormmybatistis.util.MyMapper | |||||
# PageHelper 配置 | # PageHelper 配置 | ||||
pagehelper: | pagehelper: | ||||
helper-dialect: mysql | helper-dialect: mysql |
@@ -41,7 +41,7 @@ | |||||
</encoder> | </encoder> | ||||
</appender> | </appender> | ||||
<logger name="com.xkcoding.springbootdemomybatis.mapper" level="TRACE"/> | |||||
<logger name="com.xkcoding.springbootdemoormmybatis.mapper" level="TRACE"/> | |||||
<root level="info"> | <root level="info"> | ||||
<appender-ref ref="consoleLog"/> | <appender-ref ref="consoleLog"/> |
@@ -1,7 +1,7 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
<mapper namespace="com.xkcoding.springbootdemomybatis.mapper.MybatisUserMapper"> | |||||
<resultMap id="mybatisUserMap" type="com.xkcoding.springbootdemomybatis.model.MybatisUser"> | |||||
<mapper namespace="com.xkcoding.springbootdemoormmybatis.mapper.MybatisUserMapper"> | |||||
<resultMap id="mybatisUserMap" type="com.xkcoding.springbootdemoormmybatis.model.MybatisUser"> | |||||
<id property="id" column="id"/> | <id property="id" column="id"/> | ||||
<result property="name" column="name"/> | <result property="name" column="name"/> |
@@ -1,4 +1,4 @@ | |||||
package com.xkcoding.springbootdemomybatis; | |||||
package com.xkcoding.springbootdemoormmybatis; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; | |||||
@RunWith(SpringRunner.class) | @RunWith(SpringRunner.class) | ||||
@SpringBootTest | @SpringBootTest | ||||
public class SpringBootDemoMybatisApplicationTests { | |||||
public class SpringBootDemoOrmMybatisApplicationTests { | |||||
@Test | @Test | ||||
public void contextLoads() { | public void contextLoads() { |
@@ -16,8 +16,8 @@ | |||||
<module>../spring-boot-demo-properties</module> | <module>../spring-boot-demo-properties</module> | ||||
<module>../spring-boot-demo-actuator</module> | <module>../spring-boot-demo-actuator</module> | ||||
<module>../spring-boot-demo-logback</module> | <module>../spring-boot-demo-logback</module> | ||||
<module>../spring-boot-demo-jpa</module> | |||||
<module>../spring-boot-demo-mybatis</module> | |||||
<module>../spring-boot-demo-orm-jpa</module> | |||||
<module>../spring-boot-demo-orm-mybatis</module> | |||||
<module>../spring-boot-demo-cache-redis</module> | <module>../spring-boot-demo-cache-redis</module> | ||||
<module>../spring-boot-demo-swagger</module> | <module>../spring-boot-demo-swagger</module> | ||||
<module>../spring-boot-demo-ureport2</module> | <module>../spring-boot-demo-ureport2</module> | ||||