verysu 设计模式 设计模式 响应式编程 百度开发平台 codeforces leetcode usfca

导航

持久化mybatisplus baomidou配置

import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement // 开启事务管理
@MapperScan("com.leiming.crcc.subportal.mapper") // 扫描 mapper接口
@Configuration
public class MyBatisPlusConfig {

/**
* 分页插件
* @return
*/
@Bean
public PaginationInterceptor paginationInterceptor(){
return new PaginationInterceptor();
}

/**
* 序列生成器
*/
@Bean
public OracleKeyGenerator oracleKeyGenerator(){
return new OracleKeyGenerator();
}
}
mapper.xmlSQL指定mysql函数
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
</selectKey>
(SELECT REPLACE(UUID(), '-', '') AS id)

 

posted on 2021-09-02 12:56  泳之  阅读(690)  评论(0编辑  收藏  举报

我是谁? 回答错误