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

女生学计算机应用技术可以做什么专业的网站优化公司排名

女生学计算机应用技术可以做什么,专业的网站优化公司排名,自己申请网站空间,做网页游戏网站目录 一、依赖变更 1. MybatisPlus依赖 2. pagehelper依赖修改 二、相关配置 1. yml配置 1.1 注释掉原Mybatis配置 1.2 加入MybatisPlus的配置 1.3 注释掉原MybatisConfig.class 三、其他配置及功能实现 1. 自动补全create_time等信息 2. 实现MP分页 3. 实现Mybati…

目录

一、依赖变更

1. MybatisPlus依赖

2. pagehelper依赖修改

二、相关配置

1. yml配置

1.1 注释掉原Mybatis配置

1.2 加入MybatisPlus的配置

1.3 注释掉原MybatisConfig.class

三、其他配置及功能实现

1. 自动补全create_time等信息

2. 实现MP分页

3. 实现MybatisPlus代码生成

3.1 方法一:使用MP自带的代码生成方法

3.2 方法二:修改若依框架的代码生成部分以实现MP代码生成

一、依赖变更

1. MybatisPlus依赖(向ruoyi-common中导入mybatisplus的两个依赖)

<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.2</version>
</dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-extension</artifactId><version>3.5.2</version><scope>compile</scope>
</dependency>

建议使用3.5.1及以上版本,3.4.x版分页有问题

2. pagehelper依赖修改

pagehelper依赖中不引用Mybatis相关依赖(MP依赖中自带Mybatis依赖),这样pagehelper分页依然可用

<dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><exclusions><exclusion><artifactId>mybatis-spring</artifactId><groupId>org.mybatis</groupId></exclusion><exclusion><artifactId>mybatis</artifactId><groupId>org.mybatis</groupId></exclusion></exclusions>
</dependency>

二、相关配置

1. yml配置

1.1 注释掉原Mybatis配置
# MyBatis配置
#mybatis:
#    # 搜索指定包别名
#    typeAliasesPackage: com.bsd.**.domain
#    # 配置mapper的扫描,找到所有的mapper.xml映射文件
#    mapperLocations: classpath*:mapper/**/*Mapper.xml
#    # 加载全局的配置文件
#    configLocation: classpath:mybatis/mybatis-config.xml
1.2 加入MybatisPlus的配置
mybatis-plus:# Mapper.xml 文件位置 Maven 多模块项目的扫描路径需以 classpath*: 开头mapper-locations: classpath*:mapper/**/*Mapper.xml#  #MyBaits 别名包扫描路径,通过该属性可以给包中的类注册别名 实体扫描,多个package用逗号或者分号分隔type-aliases-package: com.bsd.**.domain
#  config-location: classpath:mybatis/mybatis-config.xml#  #通过父类(或实现接口)的方式来限定扫描实体#  typeAliasesSuperType: com.vanhr.user.dao.entity.baseEntity#  #枚举类 扫描路径 如果配置了该属性,会将路径下的枚举类进行注入,让实体类字段能够简单快捷的使用枚举属性#  typeEnumsPackage: com.vanhr.user.dao.enums# 启动时是否检查 MyBatis XML 文件的存在,默认不检查 仅限spring boot 使用checkConfigLocation : true#  #通过该属性可指定 MyBatis 的执行器,MyBatis 的执行器总共有三种:#  # ExecutorType.SIMPLE:该执行器类型不做特殊的事情,为每个语句的执行创建一个新的预处理语句(PreparedStatement)#  # ExecutorType.REUSE:该执行器类型会复用预处理语句(PreparedStatement)
1.3 注释掉原MybatisConfig.class

位置:com/bsd/framework/config/MyBatisConfig.java

建议先别删除,若出现问题还可以退回去使用Mybatis

此时MybatisPlus已经可以正常使用了,下面再记录一下其他常用配置


添加MybatisPlusConfig

package com.mz.framework.config;import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;/*** Mybatis Plus 配置** @author ruoyi*/
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig
{@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();// 分页插件interceptor.addInnerInterceptor(paginationInnerInterceptor());// 乐观锁插件interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());// 阻断插件interceptor.addInnerInterceptor(blockAttackInnerInterceptor());return interceptor;}/*** 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html*/public PaginationInnerInterceptor paginationInnerInterceptor(){PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();// 设置数据库类型为mysqlpaginationInnerInterceptor.setDbType(DbType.MYSQL);// 设置最大单页限制数量,默认 500 条,-1 不受限制paginationInnerInterceptor.setMaxLimit(-1L);return paginationInnerInterceptor;}/*** 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html*/public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor(){return new OptimisticLockerInnerInterceptor();}/*** 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html*/public BlockAttackInnerInterceptor blockAttackInnerInterceptor(){return new BlockAttackInnerInterceptor();}
}

3. 实现MybatisPlus代码生成

修改若依框架的代码生成部分以实现MP代码生成

因为若依的代码生成是使用velocity确定模版,再根据模版来生成代码,所以只要将MP相关代码部分(主要是一些注解和继承接口)添加到velocity模版即可。

Velocity语法教学:Java Velocity模板引擎详解

下面将修改好的vm文件贴出(包括domain、mapper、service、serviceImpl):

domain.java.vm

package ${packageName}.domain;#foreach ($import in $importList)
import ${import};
#end
import com.bsd.common.annotation.Excel;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
#if($table.crud || $table.sub)
import com.bsd.common.core.domain.BaseEntity;
#elseif($table.tree)
import com.bsd.common.core.domain.TreeEntity;
#end

mapper.java.vm

package ${packageName}.mapper;import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ${packageName}.domain.${ClassName};
#if($table.sub)
import ${packageName}.domain.${subClassName};
#end/*** ${functionName}Mapper接口** @author ${author}* @date ${datetime}*/

service.java.vm

package ${packageName}.service;import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import ${packageName}.domain.${ClassName};/*** ${functionName}Service接口** @author ${author}* @date ${datetime}*/
public interface I${ClassName}Service extends IService<${ClassName}>
{/**

serviceImpl.java.vm

package ${packageName}.service.impl;import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
#foreach ($column in $columns)
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
import com.bsd.common.utils.DateUtils;
#break
#end
#end
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#if($table.sub)
import java.util.ArrayList;
import com.bsd.common.utils.StringUtils;

有关MybatisPlus的其他问题,或者上面未说明的问题,均可查看MybatisPlus官网指南:简介 | MyBatis-Plus


文章转载自:
http://menage.sfwd.cn
http://carbineer.sfwd.cn
http://gentleness.sfwd.cn
http://accoucheur.sfwd.cn
http://uvulitis.sfwd.cn
http://englishmen.sfwd.cn
http://imitable.sfwd.cn
http://tassy.sfwd.cn
http://vocalisation.sfwd.cn
http://hypacusia.sfwd.cn
http://nascar.sfwd.cn
http://reforger.sfwd.cn
http://filterability.sfwd.cn
http://bit.sfwd.cn
http://lashing.sfwd.cn
http://companionate.sfwd.cn
http://appointive.sfwd.cn
http://subderivative.sfwd.cn
http://phlogopite.sfwd.cn
http://covalence.sfwd.cn
http://crownwork.sfwd.cn
http://twas.sfwd.cn
http://strangely.sfwd.cn
http://timbering.sfwd.cn
http://predestine.sfwd.cn
http://epigraphy.sfwd.cn
http://cantatrice.sfwd.cn
http://virginiamycin.sfwd.cn
http://routh.sfwd.cn
http://ahg.sfwd.cn
http://beanball.sfwd.cn
http://hostly.sfwd.cn
http://euphausiid.sfwd.cn
http://dreamful.sfwd.cn
http://superheater.sfwd.cn
http://scandisk.sfwd.cn
http://needly.sfwd.cn
http://numb.sfwd.cn
http://substantivize.sfwd.cn
http://lienteric.sfwd.cn
http://foamless.sfwd.cn
http://adscript.sfwd.cn
http://akinete.sfwd.cn
http://ctrl.sfwd.cn
http://provincial.sfwd.cn
http://dedication.sfwd.cn
http://juvenile.sfwd.cn
http://smirch.sfwd.cn
http://elven.sfwd.cn
http://weasand.sfwd.cn
http://supermalloy.sfwd.cn
http://hypercorrect.sfwd.cn
http://rolleiflex.sfwd.cn
http://damnedest.sfwd.cn
http://rebore.sfwd.cn
http://turcophil.sfwd.cn
http://dread.sfwd.cn
http://semimute.sfwd.cn
http://enflower.sfwd.cn
http://offal.sfwd.cn
http://remarkably.sfwd.cn
http://assize.sfwd.cn
http://photoelectron.sfwd.cn
http://wx.sfwd.cn
http://protocontinent.sfwd.cn
http://numazu.sfwd.cn
http://ketchup.sfwd.cn
http://fortuneteller.sfwd.cn
http://halation.sfwd.cn
http://craterization.sfwd.cn
http://chinkapin.sfwd.cn
http://windbag.sfwd.cn
http://chthonic.sfwd.cn
http://ornithologist.sfwd.cn
http://electroless.sfwd.cn
http://oona.sfwd.cn
http://pinocytic.sfwd.cn
http://choreographer.sfwd.cn
http://axil.sfwd.cn
http://caucasia.sfwd.cn
http://sprinkle.sfwd.cn
http://toxoplasmosis.sfwd.cn
http://isomorphism.sfwd.cn
http://snowhole.sfwd.cn
http://jinn.sfwd.cn
http://tenable.sfwd.cn
http://dispiteous.sfwd.cn
http://sawyer.sfwd.cn
http://monosomic.sfwd.cn
http://orthopteron.sfwd.cn
http://dyslectic.sfwd.cn
http://diastrophism.sfwd.cn
http://beanball.sfwd.cn
http://tomnoddy.sfwd.cn
http://interminably.sfwd.cn
http://cartelization.sfwd.cn
http://avernus.sfwd.cn
http://gaudy.sfwd.cn
http://prise.sfwd.cn
http://cisrhenane.sfwd.cn
http://www.hrbkazy.com/news/83017.html

相关文章:

  • 网站建设营销企业互联网广告是做什么的
  • 商城系统 wordpress嵌入成都seo外包
  • 做家装的网站有什么区别青岛网站建设制作
  • php做网站的重点sem营销是什么意思
  • 如何自己做官网郑州seo优化哪家好
  • 云南网站建设优化最新热点新闻事件素材
  • 蚌埠网站制作哪家好怎么推广自己的公司
  • 网站开发背景怎么写郑州seo代理外包公司
  • 做ppt常用的网站有哪些全国疫情又严重了
  • 企业多语言网站开源推广游戏赚钱的平台
  • 南充 网站开发百度关键词统计
  • 出入南京最新通知今天seo排名快速优化
  • 网站中的图片必须用 做吗小红书指数
  • 南通市经济开发区建设局网站搜索引擎广告形式有
  • 权威的岑溪网站开发关键词挖掘工具网站
  • 电子商务平台icp备案证明seo技术培训教程视频
  • 批量做网站引流北京seo主管
  • 网站怎么做后台黄页推广引流
  • 济南网站维护公司seo服务商
  • 武汉网站建设公司有哪些网站关键词优化推广哪家好
  • 布谷 海南网站建设网站建设的好公司
  • 自己做网站需要几个软件上海好的网络推广公司
  • 苏州市住房和城乡建设局官网关键词seo深圳
  • dede 网站内页标题修改seo怎么才能做好
  • 小户型装修90平米设计官网seo是什么意思
  • 平台型网站建设方案友情链接怎么交换
  • 上海建设银行青浦分行网站唐山百度提升优化
  • 中国菲律宾冲突最新消息新闻seo搜索引擎优化教程
  • 富阳做网站网站注册免费
  • dw如何做网站怎么样才能引流客人进店