com.github.yulichang.toolkit.SqlHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-plus-join-core Show documentation
Show all versions of mybatis-plus-join-core Show documentation
An enhanced toolkit of Mybatis-Plus to simplify development.
package com.github.yulichang.toolkit;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.github.yulichang.base.JoinMapper;
import java.util.function.Function;
/**
* @author yulichang
* @see com.baomidou.mybatisplus.extension.toolkit.SqlHelper
* @since 1.4.4
*/
@SuppressWarnings("unchecked")
public final class SqlHelper {
public static R exec(Class entityClass, Function, R> function) {
Assert.notNull(entityClass, "请使用 new MPJLambdaWrapper(主表.class) 或 JoinWrappers.lambda(主表.class) 构造方法");
Object mapper = SpringContentUtils.getMapper(entityClass);
Assert.notNull(mapper, "mapper not init <%s>", entityClass.getSimpleName());
Assert.isTrue(mapper instanceof JoinMapper, "mapper <%s> not extends MPJBaseMapper ", entityClass.getSimpleName());
return function.apply((JoinMapper) mapper);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy