##bilbil尚筹网实战ideas前期准备
创建一个空的project
创建一个空的project,新建几个项目结构,视频中的二三四都是在 atcrowdfunding01-admin-parent这个目录的包下
atcrowdfunding02-admin-webui这个要勾勒,234都是在一的目录下键的工程
然后变成这样
依赖项可以Alt+insert键
###逆向工程 atcrowdfunding06-common-reverses的pom文件
<?xml version
="1.0" encoding
="UTF-8"?>
<project xmlns
="http://maven.apache.org/POM/4.0.0"
xmlns
:xsi
="http://www.w3.org/2001/XMLSchema-instance"
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
>
<groupId>com
.atguigu
.crowd
</groupId
>
<artifactId>atcrowdfunding06
-common
-reverses
</artifactId
>
<version>1.0-SNAPSHOT
</version
>
<dependencies>
<dependency>
<groupId>org
.mybatis
</groupId
>
<artifactId>mybatis
</artifactId
>
<version>3.5.3</version
>
</dependency
>
</dependencies
>
<!-- 控制 Maven 在构建过程中相关配置
-->
<build>
<!-- 构建过程中用到的插件
-->
<plugins>
<!-- 具体插件,逆向工程的操作是以构建过程中插件形式出现的
-->
<plugin>
<groupId>org
.mybatis
.generator
</groupId
>
<artifactId>mybatis
-generator
-maven
-plugin
</artifactId
>
<version>1.3.0</version
>
<!-- 插件的依赖
-->
<dependencies>
<!-- 逆向工程的核心依赖
-->
<dependency>
<groupId>org
.mybatis
.generator
</groupId
>
<artifactId>mybatis
-generator
-core
</artifactId
>
<version>1.3.2</version
>
</dependency
>
<!-- 数据库连接池
-->
<dependency>
<groupId>com
.mchange
</groupId
>
<artifactId>c3p0
</artifactId
>
<version>0.9.2</version
>
</dependency
>
<!-- MySQL 驱动
-->
<dependency>
<groupId>mysql
</groupId
>
<artifactId>mysql
-connector
-java
</artifactId
>
<version>8.0.16</version
>
</dependency
>
</dependencies
>
</plugin
>
</plugins
>
</build
>
</project
>
generatorConfig.xml中的代码 注意表的名字
<!DOCTYPE generatorConfiguration
PUBLIC
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- mybatis
-generator
:generate
-->
<context id
="atguiguTables" targetRuntime
="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释
true:是
;false:否
-->
<property name
="suppressAllComments" value
="true" />
</commentGenerator
>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码
-->
<jdbcConnection
driverClass
="com.mysql.cj.jdbc.Driver"
connectionURL
="jdbc:mysql://localhost:3306/project_crowd"
userId
="root"
password
="root">
</jdbcConnection
>
<!-- 默认
false,把 JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为
true 时把
JDBC DECIMAL
和 NUMERIC 类型解析为 java
.math
.BigDecimal
-->
<javaTypeResolver>
<property name
="forceBigDecimals" value
="false" />
</javaTypeResolver
>
<!-- targetProject
:生成 Entity 类的路径
-->
<javaModelGenerator targetProject
=".\src\main\java"
targetPackage
="com.atguigu.crowd.entity">
<!-- enableSubPackages
:是否让 schema 作为包的后缀
-->
<property name
="enableSubPackages" value
="false" />
<!-- 从数据库返回的值被清理前后的空格
-->
<property name
="trimStrings" value
="true" />
</javaModelGenerator
>
<!-- targetProject
:XxxMapper
.xml 映射文件生成的路径
-->
<sqlMapGenerator targetProject
=".\src\main\java"
targetPackage
="com.atguigu.crowd.mapper">
<!-- enableSubPackages
:是否让 schema 作为包的后缀
-->
<property name
="enableSubPackages" value
="false" />
</sqlMapGenerator
>
<!-- targetPackage:Mapper 接口生成的位置
-->
<javaClientGenerator type
="XMLMAPPER"
targetProject
=".\src\main\java"
targetPackage
="com.atguigu.crowd.mapper">
<!-- enableSubPackages
:是否让 schema 作为包的后缀
-->
<property name
="enableSubPackages" value
="false" />
</javaClientGenerator
>
<!-- 数据库表名字和我们的 entity 类对应的映射指定
-->
<table tableName
="t_admin" domainObjectName
="Admin" />
</context
>
</generatorConfiguration
>
#逆向生成代码
大概就是这样了