123456789101112131415161718192021222324252627282930313233 |
- package org.example.join.model;
- import cn.hutool.core.util.StrUtil;
- import com.baomidou.mybatisplus.core.toolkit.StringPool;
- import lombok.Getter;
- import lombok.RequiredArgsConstructor;
- @Getter
- @RequiredArgsConstructor
- public class Table implements ITable {
- private final String alias;
- private final String name;
- public Table(String name) {
- this.alias = null;
- this.name = name;
- }
- public String getAlias() {
- return StrUtil.isNotBlank(alias) ? alias : name;
- }
- @Override
- public String toSql() {
- if (StrUtil.isBlank(alias)) {
- return name;
- }
- return name + StringPool.SPACE + alias;
- }
- }
|