类 MybatisPlusRelationExecutor


  • public class MybatisPlusRelationExecutor
    extends Object
    一对多查询工具
    作者:
    woodwhales on 2022-09-05 9:28
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static <LeftId extends Serializable,​LeftService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<LeftMapper,​LeftEntity>,​LeftMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<LeftEntity>,​LeftEntity,​RelationService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RelationMapper,​RelationEntity>,​RelationMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RelationEntity>,​RelationEntity>
      List<RelationEntity>
      executeQuery​(LeftId leftId, LeftService leftService, java.util.function.Function<LeftEntity,​?> getLeftIdFunction, RelationService relationService, com.baomidou.mybatisplus.core.toolkit.support.SFunction<RelationEntity,​LeftId> getLeftIdRelationFunction)
      一对多查询
      static <LeftId extends Serializable,​RightId,​LeftService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<LeftMapper,​LeftEntity>,​LeftMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<LeftEntity>,​LeftEntity,​RelationService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RelationMapper,​RelationEntity>,​RelationMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RelationEntity>,​RelationEntity,​RightService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RightMapper,​RightEntity>,​RightMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RightEntity>,​RightEntity>
      List<RightEntity>
      executeQuery​(LeftId leftId, LeftService leftService, java.util.function.Function<LeftEntity,​?> getLeftIdFunction, RelationService relationService, com.baomidou.mybatisplus.core.toolkit.support.SFunction<RelationEntity,​LeftId> getLeftIdRelationFunction, java.util.function.Function<RelationEntity,​RightId> getRightIdRelationFunction, RightService rightService, com.baomidou.mybatisplus.core.toolkit.support.SFunction<RightEntity,​?> getRightIdFunction)
      多对多查询
    • 构造器详细资料

      • MybatisPlusRelationExecutor

        public MybatisPlusRelationExecutor()
    • 方法详细资料

      • executeQuery

        public static <LeftId extends Serializable,​LeftService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<LeftMapper,​LeftEntity>,​LeftMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<LeftEntity>,​LeftEntity,​RelationService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RelationMapper,​RelationEntity>,​RelationMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RelationEntity>,​RelationEntity> List<RelationEntity> executeQuery​(LeftId leftId,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                LeftService leftService,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                java.util.function.Function<LeftEntity,​?> getLeftIdFunction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                RelationService relationService,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                com.baomidou.mybatisplus.core.toolkit.support.SFunction<RelationEntity,​LeftId> getLeftIdRelationFunction)
        一对多查询
        类型参数:
        LeftId - 业务id类型
        LeftService - 业务关系的id类型
        LeftMapper - 业务mapper类型
        LeftEntity - 业务对象类型
        RelationService - 业务关系service类型
        RelationMapper - 业务关系mapper类型
        RelationEntity - 业务关系对象类型
        参数:
        leftId - 业务id
        leftService - 业务service
        getLeftIdFunction - 获取业务对象主键
        relationService - 获取关系service
        getLeftIdRelationFunction - 获取业务id的接口
        返回:
        业务id对应的业务关系对象集合
      • executeQuery

        public static <LeftId extends Serializable,​RightId,​LeftService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<LeftMapper,​LeftEntity>,​LeftMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<LeftEntity>,​LeftEntity,​RelationService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RelationMapper,​RelationEntity>,​RelationMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RelationEntity>,​RelationEntity,​RightService extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<RightMapper,​RightEntity>,​RightMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<RightEntity>,​RightEntity> List<RightEntity> executeQuery​(LeftId leftId,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          LeftService leftService,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          java.util.function.Function<LeftEntity,​?> getLeftIdFunction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          RelationService relationService,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          com.baomidou.mybatisplus.core.toolkit.support.SFunction<RelationEntity,​LeftId> getLeftIdRelationFunction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          java.util.function.Function<RelationEntity,​RightId> getRightIdRelationFunction,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          RightService rightService,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          com.baomidou.mybatisplus.core.toolkit.support.SFunction<RightEntity,​?> getRightIdFunction)
        多对多查询

        通过用户查询对应的角色列表 user - roleList user1 - role1 - role2 - role3

        user [user主键] user_role [user主键,role主键] role [role主键]
        类型参数:
        LeftId - 业务id类型
        RightId - 业务关系的id类型
        LeftService - 业务service类型
        LeftMapper - 业务mapper类型
        LeftEntity - 业务对象类型
        RelationService - 业务关系service类型
        RelationMapper - 业务关系mapper类型
        RelationEntity - 业务关系对象类型
        RightService - 业务关系service类型
        RightMapper - 业务关系mapper类型
        RightEntity - 业务关系对象类型
        参数:
        leftId - 业务id
        leftService - 业务service
        getLeftIdFunction - 获取业务对象主键
        relationService - 业务关系对象service
        getLeftIdRelationFunction - 获取业务id的接口
        getRightIdRelationFunction - 获取关系对象id的接口
        rightService - 获取关系service
        getRightIdFunction - 获取业务关系对象id
        返回:
        业务id对应的业务关系对象集合