diff --git a/mybatis-plus-join-adapter/jsqlparser/mybatis-plus-join-adapter-jsqlparser/pom.xml b/mybatis-plus-join-adapter/jsqlparser/mybatis-plus-join-adapter-jsqlparser/pom.xml index d48038a..e06110b 100644 --- a/mybatis-plus-join-adapter/jsqlparser/mybatis-plus-join-adapter-jsqlparser/pom.xml +++ b/mybatis-plus-join-adapter/jsqlparser/mybatis-plus-join-adapter-jsqlparser/pom.xml @@ -42,6 +42,12 @@ ${mybatis.plus.version} provided + + com.baomidou + mybatis-plus-jsqlparser + ${mybatis.plus.version} + provided + \ No newline at end of file diff --git a/mybatis-plus-join-adapter/mybatis-plus-join-adapter-base/pom.xml b/mybatis-plus-join-adapter/mybatis-plus-join-adapter-base/pom.xml index de6cc8c..d75be3f 100644 --- a/mybatis-plus-join-adapter/mybatis-plus-join-adapter-base/pom.xml +++ b/mybatis-plus-join-adapter/mybatis-plus-join-adapter-base/pom.xml @@ -40,6 +40,12 @@ ${mybatis.plus.version} provided + + com.baomidou + mybatis-plus-jsqlparser + ${mybatis.plus.version} + provided + com.github.yulichang mybatis-plus-join-adapter-jsqlparser diff --git a/mybatis-plus-join-core/pom.xml b/mybatis-plus-join-core/pom.xml index 6ed709c..39886ce 100644 --- a/mybatis-plus-join-core/pom.xml +++ b/mybatis-plus-join-core/pom.xml @@ -65,6 +65,18 @@ ${mybatis.plus.version} provided + + com.baomidou + mybatis-plus-jsqlparser + ${mybatis.plus.version} + provided + + + com.baomidou + mybatis-plus-spring + ${mybatis.plus.version} + provided + org.projectlombok lombok diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinAbstractRepository.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinAbstractRepository.java new file mode 100644 index 0000000..115a1e1 --- /dev/null +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinAbstractRepository.java @@ -0,0 +1,15 @@ +package com.github.yulichang.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.repository.AbstractRepository; + +/** + * {@link AbstractRepository} + * {@link JoinRepository} + * + * @auther yulichang + * @since 1.5.2 + */ +@SuppressWarnings("unused") +public abstract class JoinAbstractRepository, T> extends AbstractRepository implements JoinRepository { +} diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinCrudRepository.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinCrudRepository.java new file mode 100644 index 0000000..28b5ce1 --- /dev/null +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinCrudRepository.java @@ -0,0 +1,15 @@ +package com.github.yulichang.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.repository.CrudRepository; + +/** + * {@link CrudRepository} + * {@link JoinRepository} + * + * @auther yulichang + * @since 1.5.2 + */ +@SuppressWarnings("unused") +public abstract class JoinCrudRepository, T> extends CrudRepository implements JoinRepository { +} diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinRepository.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinRepository.java new file mode 100644 index 0000000..884d4a2 --- /dev/null +++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/repository/JoinRepository.java @@ -0,0 +1,98 @@ +package com.github.yulichang.repository; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.repository.IRepository; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.yulichang.base.JoinMapper; +import com.github.yulichang.interfaces.MPJBaseJoin; + +import java.util.List; +import java.util.Map; + +/** + * {@link IRepository} + * + * @author yulichang + * @since 1.5.2 + */ +@SuppressWarnings({"unchecked", "unused"}) +public interface JoinRepository extends IRepository { + + /** + * 根据 Wrapper 条件,连表删除 + * + * @param wrapper joinWrapper + */ + default boolean deleteJoin(MPJBaseJoin wrapper) { + return SqlHelper.retBool(((JoinMapper) getBaseMapper()).deleteJoin(wrapper)); + } + + /** + * 根据 whereEntity 条件,更新记录 + * + * @param entity 实体对象 (set 条件值,可以为 null) + * @param wrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句) + */ + default boolean updateJoin(T entity, MPJBaseJoin wrapper) { + return SqlHelper.retBool(((JoinMapper) getBaseMapper()).updateJoin(entity, wrapper)); + } + + /** + * 根据 whereEntity 条件,更新记录 (null字段也会更新 !!!) + * + * @param entity 实体对象 (set 条件值,可以为 null) + * @param wrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句) + */ + default boolean updateJoinAndNull(T entity, MPJBaseJoin wrapper) { + return SqlHelper.retBool(((JoinMapper) getBaseMapper()).updateJoinAndNull(entity, wrapper)); + } + + /** + * 根据 Wrapper 条件,查询总记录数 + */ + default Long selectJoinCount(MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinCount(wrapper); + } + + /** + * 连接查询返回一条记录 + */ + default DTO selectJoinOne(Class clazz, MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinOne(clazz, wrapper); + } + + /** + * 连接查询返回集合 + */ + default List selectJoinList(Class clazz, MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinList(clazz, wrapper); + } + + /** + * 连接查询返回集合并分页 + */ + default > P selectJoinListPage(P page, Class clazz, MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinPage(page, clazz, wrapper); + } + + /** + * 连接查询返回Map + */ + default Map selectJoinMap(MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinMap(wrapper); + } + + /** + * 连接查询返回Map集合 + */ + default List> selectJoinMaps(MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinMaps(wrapper); + } + + /** + * 连接查询返回Map集合并分页 + */ + default

>> P selectJoinMapsPage(P page, MPJBaseJoin wrapper) { + return ((JoinMapper) getBaseMapper()).selectJoinMapsPage(page, wrapper); + } +} diff --git a/mybatis-plus-join-extension/pom.xml b/mybatis-plus-join-extension/pom.xml index f776f1a..d1271c2 100644 --- a/mybatis-plus-join-extension/pom.xml +++ b/mybatis-plus-join-extension/pom.xml @@ -45,6 +45,12 @@ ${mybatis.plus.version} provided + + com.baomidou + mybatis-plus-spring + ${mybatis.plus.version} + provided + org.projectlombok lombok diff --git a/pom.xml b/pom.xml index 1438a44..698d777 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 1.5.1 - 3.5.8 + 3.5.9 17 17