Merge pull request '定义基础接口' (#1) from develop into main

Reviewed-on: #1
This commit is contained in:
jiangdingxuan 2024-01-08 10:46:24 +08:00
commit bd01521998
5 changed files with 51 additions and 0 deletions

View File

@ -17,4 +17,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,8 @@
package net.rzdata.demo.domain;
public record Id(String id) {
public static Id of(String id) {
return new Id(id);
}
}

View File

@ -0,0 +1,16 @@
package net.rzdata.demo.trait;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public abstract class BaseRepository<T, M extends BaseMapper<T>> {
private final transient M mapper;
public BaseRepository(M mapper) {
this.mapper = mapper;
}
public M get() {
return this.mapper;
}
}

View File

@ -0,0 +1,11 @@
package net.rzdata.demo.trait;
/**
* 实体转换类
* @param <S> 源类型
* @param <T> 目标类型
*/
public interface IConverter<S, T> {
T convert(S source);
}

View File

@ -0,0 +1,10 @@
package net.rzdata.demo.trait;
/**
* 请求实体类
* @param <T> 核心模型类型
*/
public interface IQuery<T> {
T into();
}