Showing
2 changed files
with
42 additions
and
1 deletions
1 | +package org.thingsboard.server.config.yunteng; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.DbType; | |
4 | +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusPropertiesCustomizer; | |
5 | +import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator; | |
6 | +import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; | |
7 | +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; | |
8 | +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; | |
9 | +import org.springframework.context.annotation.Bean; | |
10 | +import org.springframework.context.annotation.Configuration; | |
11 | + | |
12 | +import java.util.UUID; | |
13 | + | |
14 | +@Configuration | |
15 | +public class AppConfig { | |
16 | + @Bean | |
17 | + public MybatisPlusPropertiesCustomizer plusPropertiesCustomizer() { | |
18 | + return plusProperties -> | |
19 | + plusProperties | |
20 | + .getGlobalConfig() | |
21 | + .setIdentifierGenerator( | |
22 | + new IdentifierGenerator() { | |
23 | + @Override | |
24 | + public Number nextId(Object entity) { | |
25 | + return new DefaultIdentifierGenerator().nextId(entity); | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + public String nextUUID(Object entity) { | |
30 | + return UUID.randomUUID().toString(); | |
31 | + } | |
32 | + }); | |
33 | + } | |
34 | + | |
35 | + @Bean | |
36 | + public MybatisPlusInterceptor mybatisPlusInterceptor() { | |
37 | + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); | |
38 | + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); | |
39 | + return interceptor; | |
40 | + } | |
41 | +} | ... | ... |
application/src/main/java/org/thingsboard/server/config/yunteng/MyBatisMetaObjectHandler.java
renamed from
application/src/main/java/org/thingsboard/server/config/MyBatisMetaObjectHandler.java