做网站 找风投奇迹建站模板
做网站 找风投,奇迹建站模板,中国建设部网站-玻璃幕墙,转转怎么做钓鱼网站1、生成数据库数据
2、配置pom文件
这个plugin文件里有配置项和依赖以及版本号
修改configurationFile路径为项目里存在的generatorConfig.xml文件#xff0c;因为后续的配置都在这个文件中进行。
plugingroupIdorg.mybatis.generator/groupId因为后续的配置都在这个文件中进行。
plugingroupIdorg.mybatis.generator/groupIdartifactIdmybatis-generator-maven-plugin/artifactIdversion1.3.7/versionconfigurationconfigurationFileE:\Java\java初阶学习\JavaCode\java-learning\others\MybatisPlusTest\src\main\resources\generator\generatorConfig.xml/configurationFileoverwritetrue/overwriteverbosetrue/verbose/configurationdependenciesdependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdversion5.1.6/version/dependency/dependencies/plugin
3、配置generatorConfig.xml文件
这里面有几个地方需要自己进行修改。
驱动包的路径要配置成自己电脑里的连接数据库的驱动包连接配置需要自己输入数据库的id和密码实体类生成的位置需要在指定的目录下创包mapper.xml生成的位置需要在指定的目录下创包DAO生成的位置需要在指定的目录下创包配置数据库中的表table_name是数据库中表的名字domainObjectName是对应的java中对象的名字需修改或新建
?xml version1.0 encodingUTF-8?
!DOCTYPE generatorConfigurationPUBLIC -//mybatis.org//DTD MyBatis Generator Configuration 1.0//ENhttp://mybatis.org/dtd/mybatis-generator-config_1_0.dtd
generatorConfiguration!-- 驱动包路径location中路径替换成⾃⼰本地路径 --classPathEntry locationC:\environment\mysql-connector-java-5.1.49/context idDB2Tables targetRuntimeMyBatis3!-- 禁⽤⾃动⽣成的注释 --commentGeneratorproperty namesuppressAllComments valuetrue/property namesuppressDate valuetrue//commentGenerator!-- 连接配置 --jdbcConnection driverClasscom.mysql.jdbc.DriverconnectionURLjdbc:mysql://127.0.0.1:3306/forum_db?characterEncodingutf8amp;useSSLfalseuserIdrootpassword/jdbcConnectionjavaTypeResolver!-- ⼩数统⼀转为BigDecimal --property nameforceBigDecimals valuefalse//javaTypeResolver!-- 实体类⽣成位置 --javaModelGenerator targetPackagecom.example.mybatisplustest.modeltargetProjectsrc/main/javaproperty nameenableSubPackages valuetrue/property nametrimStrings valuetrue//javaModelGenerator!-- mapper.xml⽣成位置 --sqlMapGenerator targetPackagemappertargetProjectsrc/main/resourcesproperty nameenableSubPackages valuetrue//sqlMapGenerator!-- DAO类⽣成位置 --javaClientGenerator typeXMLMAPPERtargetPackagecom.example.mybatisplustest.dao targetProjectsrc/main/javaproperty nameenableSubPackages valuetrue//javaClientGenerator!-- 配置⽣成表与实例, 只需要修改表名tableName, 与对应类名domainObjectName 即可--table tableNamet_article domainObjectNameArticleenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalse!-- 类的属性⽤数据库中的真实字段名做为属性名, 不指定这个属性会⾃动转换为驼峰命名规则--property nameuseActualColumnNames valuetrue//tabletable tableNamet_article_reply domainObjectNameArticleReplyenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamet_board domainObjectNameBoardenableSelectByExamplefalse enableDeleteByExamplefalseenableDeleteByPrimaryKeyfalse enableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamet_message domainObjectNameMessageenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamet_user domainObjectNameUserenableSelectByExamplefalse enableDeleteByExamplefalseenableDeleteByPrimaryKeyfalse enableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//table/context
/generatorConfiguration
4、收尾工作
在每一个xml文件中的插入语句的后面加入useGeneratedKeystrue keyPropertyid 在dao文件中的每个Mapper语句上方加上Mapper注解在model中加Data删除get set配置扫描路径在config包下新建一个MybatisConfig类用于指定扫描路径
Configuration
MapperScan(com/example/mybatisplustest/dao)
public class MybatisConfig{}
5.yml文件中配置扫描路径
mybatis:mapper-locations: classpath:mapper/**/*.xml
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/88807.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!