001/**
002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (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 */
016package io.jboot.db.model;
017
018
019class SqlPart extends Column {
020
021    private String sql;
022    private Object para;
023    private boolean withoutLink = false;
024
025    public SqlPart(String sql) {
026        this.sql = sql;
027    }
028
029    public SqlPart(String sql, Object para) {
030        this.sql = sql;
031        this.para = para;
032    }
033
034    public SqlPart(String sql, boolean withoutLink) {
035        this.sql = sql;
036        this.withoutLink = withoutLink;
037    }
038
039    public SqlPart(String sql, Object para, boolean withoutLink) {
040        this.sql = sql;
041        this.para = para;
042        this.withoutLink = withoutLink;
043    }
044
045    public String getSql() {
046        return sql;
047    }
048
049    public void setSql(String sql) {
050        this.sql = sql;
051    }
052
053    public Object getPara() {
054        return para;
055    }
056
057    public void setPara(Object para) {
058        this.para = para;
059    }
060
061    public boolean isWithoutLink() {
062        return withoutLink;
063    }
064
065    public void setWithoutLink(boolean withoutLink) {
066        this.withoutLink = withoutLink;
067    }
068
069    @Override
070    public boolean hasPara() {
071        return para != null;
072    }
073
074    @Override
075    public Object getValue() {
076        return para;
077    }
078
079    //构建 sql
080    public void build(char separator) {
081    }
082}