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

广州网站建设优化公司哪家好武隆网站建设费用

广州网站建设优化公司哪家好,武隆网站建设费用,做ppt介绍网站吗,android高级开发目录 一、MyBatis Generator 的使用 1.1、生成类和映射文件 1.1.1、在 pom.xml 中引入依赖 1.1.2、根据 configurationFile 标签中配置的路径 创建 generatorConfig.xml 文件 1.1.3、自动生成类 和 映射文件 1.1.4、在 Insert 标签中添加获取主键值的选项 1.1.5、扫描配置…目录 一、MyBatis Generator 的使用 1.1、生成类和映射文件 1.1.1、在 pom.xml 中引入依赖 1.1.2、根据 configurationFile 标签中配置的路径 创建 generatorConfig.xml 文件 1.1.3、自动生成类 和 映射文件 1.1.4、在 Insert 标签中添加获取主键值的选项 1.1.5、扫描配置添加 Mapper 注解 / 添加扫描注解 1.1.6、配置 mybatis 1.1.7、测试 一、MyBatis Generator 的使用 1.1、生成类和映射文件 1.1.1、在 pom.xml 中引入依赖 在 properties 标签中加入版本号. mybatis-generator-plugin-version1.4.1/mybatis-generator-plugin-version 在 build plugins 标签中加入如下配置 !-- mybatis ⽣成器插件 --plugingroupIdorg.mybatis.generator/groupIdartifactIdmybatis-generator-maven-plugin/artifactIdversion${mybatis-generator-plugin-version}/versionexecutionsexecutionidGenerate MyBatis Artifacts/idphasedeploy/phasegoalsgoalgenerate/goal/goals/execution/executions!-- 相关配置 --configuration!-- 打开⽇志 --verbosetrue/verbose!-- 允许覆盖 --overwritetrue/overwrite!-- 配置⽂件路径 --configurationFilesrc/main/resources/mybatis/generatorConfig.xml/configurationFile/configuration/plugin上述配置中需要注意的是 “配置文件路径”这个路径就是用来生成 实体类和映射文件 配置规则的位置. 1.1.2、根据 configurationFile 标签中配置的路径 创建 generatorConfig.xml 文件 这个文件就是用来描述生成规则的. 根据路径src/main/resources/mybatis在 mybatis 目录下创建 generatorConfig.xml 文件. Ps下述配置文件中需要修改的有 数据库连接、实体类和映射文件的路径、数据库表名 ?xml version1.0 encodingUTF-8? !DOCTYPE generatorConfigurationPUBLIC -//mybatis.org//DTD MyBatis Generator Configuration 1.0//ENhttp://mybatis.org/dtd/mybatis-generator-config_1_0.dtdgeneratorConfiguration!-- 驱动包路径location中路径替换成⾃⼰本地路径 --classPathEntry locationD:\class\source\mysql-connector-java-5.1.49.jar/context idDB2Tables targetRuntimeMyBatis3!-- 禁⽤⾃动⽣成的注释 --commentGeneratorproperty namesuppressAllComments valuetrue/property namesuppressDate valuetrue//commentGenerator!-- 连接配置 --jdbcConnection driverClasscom.mysql.jdbc.DriverconnectionURLjdbc:mysql://127.0.0.1:3306/javanav_db? characterEncodingutf8amp;useSSLfalseuserIdrootpassword1111/jdbcConnectionjavaTypeResolver!-- ⼩数统⼀转为BigDecimal --property nameforceBigDecimals valuefalse//javaTypeResolver!-- 实体类⽣成位置 --javaModelGenerator targetPackagecom.example.cyk.modeltargetProjectsrc/main/javaproperty nameenableSubPackages valuetrue/property nametrimStrings valuetrue//javaModelGenerator!-- mapper.xml⽣成位置 --sqlMapGenerator targetPackagemappertargetProjectsrc/main/resourcesproperty nameenableSubPackages valuetrue//sqlMapGenerator!-- mapper 接口⽣成位置 --javaClientGenerator typeXMLMAPPERtargetPackagecom.example.cyk.mapper targetProjectsrc/main/javaproperty nameenableSubPackages valuetrue//javaClientGenerator!-- 配置⽣成表与实例, 只需要修改表名tableName, 与对应类名domainObjectName 即可--table tableNamej_article domainObjectNameArticleenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalse!-- 类的属性⽤数据库中的真实字段名做为属性名, 不指定这个属性会⾃动转换 _ 为驼峰命名规则--property nameuseActualColumnNames valuetrue//tabletable tableNamej_article_reply domainObjectNameArticleReplyenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamej_board domainObjectNameBoardenableSelectByExamplefalse enableDeleteByExamplefalseenableDeleteByPrimaryKeyfalse enableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamej_message domainObjectNameMessageenableSelectByExamplefalseenableDeleteByExamplefalse enableDeleteByPrimaryKeyfalseenableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//tabletable tableNamej_user domainObjectNameUserenableSelectByExamplefalse enableDeleteByExamplefalseenableDeleteByPrimaryKeyfalse enableCountByExamplefalseenableUpdateByExamplefalseproperty nameuseActualColumnNames valuetrue//table/context /generatorConfiguration注意 驱动包路径是自己本地仓库的路径 但一定注意 需要在非中文的目录下因此你可以把这个驱动包拷贝出来放到一个非中文的目录中即可. 1.1.3、自动生成类 和 映射文件 重新加载Maven项⽬在Plugins节点下出现mybatis-generator双击运⾏在对应的目录下⽣成相应的类与映射⽂件 接着你就可以看到对应的生成了 1.1.4、在 Insert 标签中添加获取主键值的选项 在生成的 xml 文件中给每一个 insert 标签都添加以下属性useGeneratedKeystrue keyPropertyid !-- useGeneratedKeys true -- !-- keyProperty 主键字段-- !-- 当插⼊⼀条数据后可以通过user.getId()获取到⾃动⽣成的Id值如果⽅法中需要⽴即获取Id值加⼊这个配置 -- insert idinsert parameterTypecom.example.cyk.model.User useGeneratedKeystrue keyPropertyid Ps这个选项也可以自动生成但是不理想有些问题 1.1.5、扫描配置添加 Mapper 注解 / 添加扫描注解 有两种方式配置扫描 Mapper 接口. 1给每个 mapper 包下的 mapper 接口都添加 Mapper 注解. 2给启动类上 或者 新建一个配置类有 Configuration 注解加上 MapperScan(com.example.cyk.mapper) 注解. 1.1.6、配置 mybatis 在 yml 文件中配置 mybatis:mapper-locations: classpath:mapper/**/*Mapper.xml1.1.7、测试 SpringBootTest public class TestMapper {Autowiredprivate UserMapper userMapper;Testpublic void select() {User user userMapper.selectByPrimaryKey(1L);System.out.println(user);}}
http://www.w-s-a.com/news/810710/

相关文章:

  • 玉溪网站建设制作凌风wordpress百度云
  • 专业建网站价格门户网站建设 请示
  • 安徽省省博物馆网站建设佛山公司网站设计
  • 温州专业营销网站公司网络建设规划
  • 做模型常说的d站是什么网站wordpress 繁體
  • 给网站做h5缓存机制获取小程序api
  • 网站开发文档东莞市建设网站首页
  • 公共空间设计网站企业门户网站建设教程
  • 网站建设公司 深圳镇江建设质量监督站网站
  • 网站底部版权怎么做软广告经典案例
  • 网站收录突然全部没有了东莞网站建设公司电话
  • 境外企业网站推广免费ppt元素
  • 2018网站建设行业广东网站seo
  • 网站后台加密云服务器2008做网站
  • dw制作一个环保网站模板下载吉安网站建设收费
  • 深圳珠宝网站设计北京高端网站建设优势
  • 合肥企业制作网站wordpress创建网站
  • 织梦网站开发兼职wordpress 中间截取缩略图
  • 南通制作网站旅游搭建网站
  • 专业做商铺的网站个人网页html模板完整代码
  • 什么网站做美食最好最专业关键词推广是什么意思
  • 自助建设网站软件网站导航网站可以做吗
  • 网站模板放哪长沙网站优化分析
  • 泉州网站建设价钱网站模板素材
  • 南通网站托管js建设网站外网
  • 成都企业网站公司wordpress内页模板
  • 58同城建网站怎么做wordpress评论显示数字ip
  • 免费制作论坛网站模板免费下载北京网站制作长沙
  • 旅游网网站建设网站如何自己做seo
  • 如何验证网站所有权做二手家具回收哪个网站好