001/*
002 *  Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
003 *  <p>
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *  <p>
008 *  http://www.apache.org/licenses/LICENSE-2.0
009 *  <p>
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016
017package com.mybatisflex.processor.entity;
018
019/**
020 * 表详细信息。
021 *
022 * @author 王帅
023 * @since 2023-07-13
024 */
025public class TableInfo {
026
027    /**
028     * 实体类全类名。
029     */
030    private String entityName;
031
032    /**
033     * 实体类简单类名。
034     */
035    private String entitySimpleName;
036
037    /**
038     * 实体类注释。
039     */
040    private String entityComment;
041
042    /**
043     * 表名称。
044     */
045    private String tableName;
046
047    /**
048     * Schema 模式。
049     */
050    private String schema;
051
052    public String getEntityName() {
053        return entityName;
054    }
055
056    public void setEntityName(String entityName) {
057        this.entityName = entityName;
058    }
059
060    public String getEntitySimpleName() {
061        return entitySimpleName;
062    }
063
064    public void setEntitySimpleName(String entitySimpleName) {
065        this.entitySimpleName = entitySimpleName;
066    }
067
068    public String getEntityComment() {
069        return entityComment;
070    }
071
072    public void setEntityComment(String entityComment) {
073        this.entityComment = entityComment;
074    }
075
076    public String getTableName() {
077        return tableName;
078    }
079
080    public void setTableName(String tableName) {
081        int indexOf = tableName.indexOf(".");
082        if (indexOf > 0) {
083            if (schema == null || schema.trim().length() == 0) {
084                this.schema = tableName.substring(0, indexOf);
085                this.tableName = tableName.substring(indexOf + 1);
086            } else {
087                this.tableName = tableName;
088            }
089        } else {
090            this.tableName = tableName;
091        }
092    }
093
094    public String getSchema() {
095        return schema;
096    }
097
098    public void setSchema(String schema) {
099        this.schema = schema;
100    }
101
102}