package com.jy.framework.mybatis.join;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class QueryConditionConnect extends AbstractSql {

    /**
     * 连接方式（ and or ）
     */
    private final String connectType;

    /**
     * 连接方法
     */
    private final QueryCondition queryCondition;

    @Override
    protected String format() {
        String sql = queryCondition.format();
        if (ObjectUtil.isEmpty(sql)) {
            return StringPool.EMPTY;
        }
        return connectType + sql;
    }

}
