Mybatis generator

mybatis 自动生成DoMapper方法

  1. 到pom.xml所在的文件夹
    shift+右键选择“在此处打开命令行窗口”
  2. 运行
    mvn mybatis-generator:generate
  3. 附1,mabatis pom插件
<build>
		<resources>
			<resource>
				<directory>src/main/java</directory>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<directory>src/test/resources</directory>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.mybatis.generator</groupId>
				<artifactId>mybatis-generator-maven-plugin</artifactId>
				<version>1.3.0</version>
				<configuration>
					<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>  
					<verbose>true</verbose>  
					<overwrite>true</overwrite>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>com.alibaba.crm.shared</groupId>
						<artifactId>rock</artifactId>
						<version>1.0.0.0</version>
					</dependency>
					<dependency>
						<groupId>org.mybatis.generator</groupId>
						<artifactId>mybatis-generator-core</artifactId>
						<version>1.3.2</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>
  1. 附2 mybatis dependency
<dependency>
				<groupId>org.mybatis</groupId>
				<artifactId>mybatis-spring</artifactId>
				<version>1.1.1</version>
			</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
		</dependency>
		<dependency>
			<groupId>org.mybatis.generator</groupId>
			<artifactId>mybatis-generator-core</artifactId>
		</dependency>
posted @ 2017-12-18 17:20  james.yj  阅读(170)  评论(0编辑  收藏  举报