项目中3步解决Mybatis在桌面生成代码

栏目: Java · 发布时间: 6年前

内容简介:数据库表有几张表复制几个<table(这个很简单照的步骤一步步来)4.pom.xml文件中配依赖

数据库表有几张表复制几个<table(这个很简单照的步骤一步步来)

项目中3步解决Mybatis在桌面生成代码
<?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="mysql-connector-java-5.1.28.jar"/>
	<context id="DB2Tables"	targetRuntime="MyBatis3">
 <commentGenerator> 

                <property name="suppressAllComments" value="true" /> 

            </commentGenerator>  
		<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/vhr" userId="root" password="123456">
		</jdbcConnection>
		<javaTypeResolver>
			<property name="forceBigDecimals" value="false"/>
		</javaTypeResolver>

		<javaModelGenerator targetPackage="org.javaboy.bean" targetProject="src">
			<property name="enableSubPackages" value="true"/>
			<property name="trimStrings" value="true"/>
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="org.javaboy.mapper" targetProject="src">
			<property name="enableSubPackages" value="true"/>
		</sqlMapGenerator>

		<javaClientGenerator type="XMLMAPPER" targetPackage="org.javaboy.mapper" targetProject="src">
			<property name="enableSubPackages" value="true"/>
		</javaClientGenerator>

	     <table tableName="adjustsalary" domainObjectName="Adjustsalary" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>

复制代码

2.run.bat开启文件生成src目录代码

  • run.bat启动无效,就删掉创建一个.txt文件,里面写下条命令保存,修改文件格式.bat
  • 生成没代码看xml文件信息是否有错
java -jar lib/mybatis-generator-core-1.3.1.jar -configfile generator.xml -overwrite
复制代码
项目中3步解决Mybatis在桌面生成代码

3.拷贝src目录中代码到项目中

项目中3步解决Mybatis在桌面生成代码

4.pom.xml文件中配依赖

  • 根据自己需求配置这很简单的
<dependency>
       <groupId>org.mybatis.spring.boot</groupId>
       <artifactId>mybatis-spring-boot-starter</artifactId>
       <version>2.0.1</version>
   </dependency>

   <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
    </build>

复制代码

if4-my.sharepoint.com/:f:/g/perso…


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Host Your Web Site In The Cloud

Host Your Web Site In The Cloud

Jeff Barr / SitePoint / 2010-9-28 / USD 39.95

Host Your Web Site On The Cloud is the OFFICIAL step-by-step guide to this revolutionary approach to hosting and managing your websites and applications, authored by Amazon's very own Jeffrey Barr. "H......一起来看看 《Host Your Web Site In The Cloud》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具