package com.trade.common.config.mybatis.plugin;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * 不做实体的国际化处理，mybatisplus适用。 如果实体类继承BaseI18nDomain，默认会对实体进行国际化处理。{@link I18nSqlProcessInterceptor}
 */
public interface Non18nWrapper {

    /**
     * 不包含i18n的queryWrapper
     * 
     * @return QueryWrapper
     */
    static <T> QueryWrapper<T> queryWrapperWithNonI18n() {
        return new NonI18nQueryWrapper<>();
    }

    /**
     * 不包含i18n的lambdaqueryWrapper
     * 
     * @param entityClass 实体类
     * @return LambdaQueryWrapper
     */
    static <T> LambdaQueryWrapper<T> lambdaQueryWithNonI18n(Class<T> entityClass) {
        return new NonI18nLambdaQueryWrapper<>(entityClass);
    }

    class NonI18nQueryWrapper<T> extends QueryWrapper<T> implements Non18nWrapper {
    }

    class NonI18nLambdaQueryWrapper<T> extends LambdaQueryWrapper<T> implements Non18nWrapper {

        public NonI18nLambdaQueryWrapper(Class<T> entityClass){
            super(entityClass);
        }
    }
}
