当前位置: 首页 > wzjs >正文

网站建设推广关键词手机百度最新正版下载

网站建设推广关键词,手机百度最新正版下载,bae3.0 wordpress,噼里啪啦国语在线播放在编写项目时,我们常常需要与MySQL进行连接,在此基础上,如果我们需要使用数据库中的数据,就需要先创建对应的实体类,然后再编写对应的SQL语句,但是这一部分操作是有便捷操作的 导入依赖 我们需要现在 pom 文件中导入对应的MyBatis生成器依赖 <!-- 将这一部分导入到 proper…

在编写项目时,我们常常需要与MySQL进行连接,在此基础上,如果我们需要使用数据库中的数据,就需要先创建对应的实体类,然后再编写对应的SQL语句,但是这一部分操作是有便捷操作的

导入依赖

我们需要现在 pom 文件中导入对应的MyBatis生成器依赖

<!-- 将这一部分导入到 properties 中 -->
<!--  MyBatis生成器  -->
<mybatis-generator-plugin-version>1.4.1</mybatis-generator-plugin-version>
<!-- 将这一部分导入到 plugins 中 -->
<!-- mybatis 生成器插件 -->
<plugin><groupId>org.mybatis.generator</groupId><artifactId>mybatis-generator-maven-plugin</artifactId><version>${mybatis-generator-plugin-version}</version><executions><execution><id>Generate MyBatis Artifacts</id><phase>deploy</phase><goals><goal>generate</goal></goals></execution></executions><!-- 相关配置 --><configuration><!-- 打开日志 --><verbose>true</verbose><!-- 允许覆盖 --><overwrite>true</overwrite><!-- 配置文件路径 --><configurationFile>src/main/resources/mybatis/generatorConfig.xml</configurationFile></configuration>
</plugin>

添加完之后,让 maven 重新加载,让依赖成功导入

根据设置的配置文件路径添加配置文件

在 pom 文件中加入的依赖中,我们加入了一个配置文件路径,我们需要根据这个文件路径进行文件创建.后续需要通过这个文件来使用生成器

依赖中的地址: src/main/resources/mybatis/generatorConfig.xml (这个地址可自定义,但是自定义一定要记得修改依赖中设置的地址)

<generatorConfiguration><!--  驱动包路径,location中路径替换成自己本地路径  --><classPathEntry location="本地驱动包地址"/><context id="DB2Tables" targetRuntime="MyBatis3"><!--  禁用自动生成的注释  --><commentGenerator><property name="suppressAllComments" value="true"/><property name="suppressDate" value="true"/></commentGenerator><!--  连接配置(自己的数据库连接配置)  --><!--  driverClass5.0配置: com.mysql.jdbc.Driver  --><jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"connectionURL="jdbc:mysql://127.0.0.1:3306/table_name?characterEncoding=utf8&amp;useSSL=false"userId="root" password="password"> </jdbcConnection><javaTypeResolver><!--  小数统一转为BigDecimal  --><property name="forceBigDecimals" value="false"/></javaTypeResolver><!--  实体类生成位置  --><javaModelGenerator targetPackage="com.example.forum.model" targetProject="src/main/java"><property name="enableSubPackages" value="true"/><property name="trimStrings" value="true"/></javaModelGenerator><!--  mapper.xml生成位置  --><sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"><property name="enableSubPackages" value="true"/></sqlMapGenerator><!--  DAO类生成位置  --><javaClientGenerator type="XMLMAPPER" targetPackage="com.example.forum.dao" targetProject="src/main/java"><property name="enableSubPackages" value="true"/></javaClientGenerator><!--  配置生成表与实例, 只需要修改表名tableName, 与对应类名domainObjectName 即可 --><table tableName="t_article" domainObjectName="Article" enableSelectByExample="false" enableDeleteByExample="false" enableDeleteByPrimaryKey="false" enableCountByExample="false" enableUpdateByExample="false"><!--  类的属性用数据库中的真实字段名做为属性名, 不指定这个属性会自动转换 _ 为驼峰命名规则 --><property name="useActualColumnNames" value="true"/></table><table tableName="t_article_reply" domainObjectName="ArticleReply" enableSelectByExample="false" enableDeleteByExample="false" enableDeleteByPrimaryKey="false" enableCountByExample="false" enableUpdateByExample="false"><property name="useActualColumnNames" value="true"/></table><table tableName="t_board" domainObjectName="Board" enableSelectByExample="false" enableDeleteByExample="false" enableDeleteByPrimaryKey="false" enableCountByExample="false" enableUpdateByExample="false"><property name="useActualColumnNames" value="true"/></table><table tableName="t_message" domainObjectName="Message" enableSelectByExample="false" enableDeleteByExample="false" enableDeleteByPrimaryKey="false" enableCountByExample="false" enableUpdateByExample="false"><property name="useActualColumnNames" value="true"/></table><table tableName="t_user" domainObjectName="User" enableSelectByExample="false" enableDeleteByExample="false" enableDeleteByPrimaryKey="false" enableCountByExample="false" enableUpdateByExample="false"><property name="useActualColumnNames" value="true"/></table></context>
</generatorConfiguration>

那么我们要怎么找到本地的驱动包呢?

        1.打开 此电脑 ,找到 user 文件夹

        2.在文件夹中找到 .m2 文件夹

        3.找到 repository

        4.双击打开之后,在文件夹里面搜索 mysql 文件夹

        5.找到自己使用的版本,复制对应的 jar 包的文件路径

运行

将所有文件配置好之后,我们打开项目,找到 maven 键,打开 Plugins ,找到 mybatis-generator ,并双击 mybatis-generator:generate

控制台出现以下信息,并且开始创建 实例类 和 对应的 mapper.xml 文件那就是配置成功了

问题处理

根元素匹配

如果在运行生成器的时候控制台出现了图片中的问题,那么我们需要在配置文件中加入以下代码

<!--  以下代码加在 generatorConfiguration 之前 -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfigurationPUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN""http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

http://www.dtcms.com/wzjs/138484.html

相关文章:

  • 眼科医院网站设计怎么做网站出售
  • 我想做教育网站那里做一手app推广接单平台
  • 做旅游计划的网站推广普通话手抄报模板
  • 网站做效果图流程sem是什么意思?
  • 如何做php游戏介绍网站茂名网站建设制作
  • 互联网媒体平台有哪些泉州关键词优化软件
  • 住建网证书查询长沙网站seo哪家公司好
  • 网站首页专题怎么做百度客服电话
  • 自建网站免费教程无锡今日头条新闻
  • 胶州网站建设哪里有营销策划公司排行榜
  • 山东东营市广饶县河南整站关键词排名优化软件
  • 山西网站推广微商软文范例
  • 网站建设售后报价南昌企业网站建设
  • 公司网站建设费用记什么科目百度推广方式有哪些
  • 辽宁网站定制企业互联网营销师是干什么的
  • 滨州网站建设求职简历微信指数官网
  • 做单平台网站制作营销推广是什么意思
  • 德州疫情最新消息今天德城区广州seo实战培训
  • wordpress建站好用吗搜狗网址大全
  • 顺德龙江网站建设seo知识总结
  • 关于网站建设案例海外网站
  • ppt可以做网站吗最近的重要新闻
  • 网站建设logo显示怎么设置成人用品哪里进货好
  • 手机上做网站新媒体seo指的是什么
  • 有了域名之后怎么做网站交换链接营销
  • 网站的全栈建设微信运营技巧
  • 做网站必须要服务器吗百度竞价电话
  • 长沙网站建设湘icp备2020最成功的网络营销
  • 培训网站项目ppt怎么做写软文的app
  • 网站响应式是什么意思百度网盘下载的文件在哪