package cn.pluss.platform.util;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.enums.SqlKeyword;

import java.util.Objects;

public class CustomAbstractWrapper<T> extends QueryWrapper<T> {

    public CustomAbstractWrapper() {
    }

    public CustomAbstractWrapper(T entity) {
        super(entity);
    }

    public CustomAbstractWrapper(T entity, String... columns) {
        super(entity, columns);
    }

    @Override
    protected QueryWrapper<T> addCondition(boolean condition, String column, SqlKeyword sqlKeyword, Object val) {
        if (Objects.isNull(val) || "".equals(val)) {
            condition = false;
        }
        return super.addCondition(condition, column, sqlKeyword, val);
    }
}
