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

wap 网站的盗链问题sun v2.1 wordpress主题

wap 网站的盗链问题,sun v2.1 wordpress主题,做搜索引擎的网站有哪些,电子商务网站建设与管理的论文总结代码生成器 MyBatis Plus是MyBatis的扩展框架#xff0c;而代码生成器是MP的核心功能之一#xff0c;另外还有 “条件构造器”和“通用CRUD”等功能。 步骤演示 mp的代码生成器有两种方式自动生成代码#xff0c;一种是通过main方法来执行程序#xff0c;另一种是通过maven…代码生成器 MyBatis Plus是MyBatis的扩展框架而代码生成器是MP的核心功能之一另外还有 “条件构造器”和“通用CRUD”等功能。 步骤演示 mp的代码生成器有两种方式自动生成代码一种是通过main方法来执行程序另一种是通过maven插件build产生。第二种方法需要在pom.xml中添加大量的配置信息因此本人偏向于使用第一种方式。步骤如下 一、添加mybatis plus依赖 如果还没有创建项目当然需要先创建一个工程项目然后将jar包依赖添加到项目的classpath下如果是含有pom.xml的maven项目比如我最近在使用的springboot项目那么可以直接添加pom依赖!-- https://mvnrepository.com/artifact/org.mybatis.generator/mybatis-generator-core --dependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-boot-starter/artifactIdversion2.3/version/dependency 连接maven中央库阿里库 二、创建生成器主类 官方给出的实例连接代码生成器 此处贴出我整理过后的代码 package com.mht.springbootmybatis.generate;import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; import com.baomidou.mybatisplus.generator.config.FileOutConfig; import com.baomidou.mybatisplus.generator.config.GlobalConfig; import com.baomidou.mybatisplus.generator.config.PackageConfig; import com.baomidou.mybatisplus.generator.config.StrategyConfig; import com.baomidou.mybatisplus.generator.config.TemplateConfig; import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; import com.baomidou.mybatisplus.generator.config.rules.DbType; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;/*** p* 代码生成器演示* /p*/ public class MpGenerator {/*** p* MySQL 生成演示* /p*/public static void main(String[] args) {AutoGenerator mpg new AutoGenerator();// 选择 freemarker 引擎默认 Veloctiympg.setTemplateEngine(new FreemarkerTemplateEngine());// 全局配置GlobalConfig gc new GlobalConfig();gc.setAuthor(Mht);gc.setOutputDir(D://workspace/spring-boot-mybatis/src/main/java);gc.setFileOverride(false);// 是否覆盖同名文件默认是falsegc.setActiveRecord(true);// 不需要ActiveRecord特性的请改为falsegc.setEnableCache(false);// XML 二级缓存gc.setBaseResultMap(true);// XML ResultMapgc.setBaseColumnList(false);// XML columList/* 自定义文件命名注意 %s 会自动填充表实体属性 */// gc.setMapperName(%sDao);// gc.setXmlName(%sDao);// gc.setServiceName(MP%sService);// gc.setServiceImplName(%sServiceDiy);// gc.setControllerName(%sAction);mpg.setGlobalConfig(gc);// 数据源配置DataSourceConfig dsc new DataSourceConfig();dsc.setDbType(DbType.MYSQL);dsc.setTypeConvert(new MySqlTypeConvert() {// 自定义数据库表字段类型转换【可选】Overridepublic DbColumnType processTypeConvert(String fieldType) {System.out.println(转换类型 fieldType);// 注意processTypeConvert 存在默认类型转换如果不是你要的效果请自定义返回、非如下直接返回。return super.processTypeConvert(fieldType);}});dsc.setDriverName(com.mysql.jdbc.Driver);dsc.setUsername(root);dsc.setPassword(root);dsc.setUrl(jdbc:mysql://localhost:3306/ease-run?useUnicodetruecharacterEncodingutf8);mpg.setDataSource(dsc);// 策略配置StrategyConfig strategy new StrategyConfig();// strategy.setCapitalMode(true);// 全局大写命名 ORACLE 注意strategy.setTablePrefix(new String[] { user_ });// 此处可以修改为您的表前缀strategy.setNaming(NamingStrategy.nochange);// 表名生成策略strategy.setInclude(new String[] { user }); // 需要生成的表// strategy.setExclude(new String[]{test}); // 排除生成的表// 自定义实体父类// strategy.setSuperEntityClass(com.baomidou.demo.TestEntity);// 自定义实体公共字段// strategy.setSuperEntityColumns(new String[] { test_id, age });// 自定义 mapper 父类// strategy.setSuperMapperClass(com.baomidou.demo.TestMapper);// 自定义 service 父类// strategy.setSuperServiceClass(com.baomidou.demo.TestService);// 自定义 service 实现类父类// strategy.setSuperServiceImplClass(com.baomidou.demo.TestServiceImpl);// 自定义 controller 父类// strategy.setSuperControllerClass(com.baomidou.demo.TestController);// 【实体】是否生成字段常量默认 false// public static final String ID test_id;// strategy.setEntityColumnConstant(true);// 【实体】是否为构建者模型默认 false// public User setName(String name) {this.name name; return this;}// strategy.setEntityBuilderModel(true);mpg.setStrategy(strategy);// 包配置PackageConfig pc new PackageConfig();pc.setParent(com.mht.springbootmybatis); // pc.setModuleName(test);mpg.setPackageInfo(pc);// 注入自定义配置可以在 VM 中使用 cfg.abc 【可无】 // InjectionConfig cfg new InjectionConfig() { // Override // public void initMap() { // MapString, Object map new HashMapString, Object(); // map.put(abc, this.getConfig().getGlobalConfig().getAuthor() -mp); // this.setMap(map); // } // }; // // // 自定义 xxList.jsp 生成 // ListFileOutConfig focList new ArrayList(); // focList.add(new FileOutConfig(/template/list.jsp.vm) { // Override // public String outputFile(TableInfo tableInfo) { // // 自定义输入文件名称 // return D://my_ tableInfo.getEntityName() .jsp; // } // }); // cfg.setFileOutConfigList(focList); // mpg.setCfg(cfg); // // // 调整 xml 生成目录演示 // focList.add(new FileOutConfig(/templates/mapper.xml.vm) { // Override // public String outputFile(TableInfo tableInfo) { // return /develop/code/xml/ tableInfo.getEntityName() .xml; // } // }); // cfg.setFileOutConfigList(focList); // mpg.setCfg(cfg); // // // 关闭默认 xml 生成调整生成 至 根目录 // TemplateConfig tc new TemplateConfig(); // tc.setXml(null); // mpg.setTemplate(tc);// 自定义模板配置可以 copy 源码 mybatis-plus/src/main/resources/templates 下面内容修改// 放置自己项目的 src/main/resources/templates 目录下, 默认名称一下可以不配置也可以自定义模板名称// TemplateConfig tc new TemplateConfig();// tc.setController(...);// tc.setEntity(...);// tc.setMapper(...);// tc.setXml(...);// tc.setService(...);// tc.setServiceImpl(...);// 如上任何一个模块如果设置 空 OR Null 将不生成该模块。// mpg.setTemplate(tc);// 执行生成mpg.execute();// 打印注入设置【可无】 // System.err.println(mpg.getCfg().getMap().get(abc));}}文件基本可以拿过来直接用但需要注意这两句代码 gc.setOutputDir(D://workspace/spring-boot-mybatis/src/main/java);// 设置文件输出路径 pc.setParent(com.mht.springbootmybatis);// 父包名 下图是我项目的路径执行代码生成器之后的项目结构执行main方法前请注意在生成文件的时候需要有一个模板引擎的选择MyBatis Plus的默认模板引擎是velocity。我们可以使用freemarker。dependencygroupIdorg.freemarker/groupIdartifactIdfreemarker/artifactId/dependency 最后执行main方法就可以了。 执行控制台如下注意代码生成前请确保数据库中表已经存在。 以上就是对mybatis plus代码生成器的简单使用并不是非常详细的应用教程风只是简单的入门使用以便日后快速查阅后续发现新的值得记录的地方会继续更新这篇博客。欢迎各位踊跃留言 参考文章《MyBatis Plus代码生成器》《MyBatis Plus学习》《mybatis-plus思维导图让mybatis-plus不再难懂》
http://www.zqtcl.cn/news/117667/

相关文章:

  • 微信制作网站设计重庆关键词优化软件
  • 网站的设计与应用论文平台推广计划书模板范文
  • 网站备案用户名忘了怎么办网站做301排名会掉
  • 厦门制作网站企业网站子域名怎么做
  • 青岛微网站开发品牌建设青之见
  • 淄博哪有培训做网站的湖南营销型网站建设企业
  • 动物网站建设深圳最好的营销网站建设公司
  • 各种网站制作陕西建设厅证件查询网站
  • 如何提高一个网站如何做简单网站
  • 游戏网站开发找什么人可建智慧园区设计方案
  • 重庆网站设计公司推荐福州移动网站建设
  • 移动网站功能做网站fjfzwl
  • 食品网站建设的目的中级经济师考试成绩查询
  • 普宁建设局网站免费的网站开发平台
  • 网站域名主机空间区别网站上传系统
  • 建设高端网站公司的目的淮南房产网
  • 网站建设 中山网站建设新得体会
  • 快速搭建网站视频教程看想看的做想做的电影网站好
  • 网站聊天怎么做2345网址导航智能主版
  • 如何优化网站加载速度做推广公司
  • 网站下载不了视频php网站 数据库链接
  • 制作网页网站教程wordpress建立扁平化
  • 网站建设小知识郑州网站建设找伟置
  • 苏中建设官方网站旅游做攻略用什么网站好
  • 信息门户网站制作wordpress改商城
  • 企业类网站有哪些甘肃省和住房建设厅网站
  • 嘉兴市住房和城乡建设局网站wordpress nodejs版本
  • 做网站 百度推广深圳外贸招聘
  • 网站留言板功能网站建设 核对流程
  • WordPress输出当前网址郑州官网seo厂家