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 */
016package com.mybatisflex.core.logicdelete;
017
018import com.mybatisflex.core.dialect.IDialect;
019import com.mybatisflex.core.query.QueryWrapper;
020import com.mybatisflex.core.table.TableInfo;
021
022/**
023 * 逻辑删除处理器。
024 */
025public interface LogicDeleteProcessor {
026
027    /**
028     * 用户构建查询正常数据的条件。
029     *
030     * @param logicColumn 逻辑删除列
031     * @param tableInfo
032     * @param dialect     数据库方言
033     */
034    String buildLogicNormalCondition(String logicColumn, TableInfo tableInfo, IDialect dialect);
035
036    /**
037     * 用户与构建删除数据时的内容。
038     *
039     * @param logicColumn 逻辑删除列
040     * @param tableInfo
041     * @param dialect     数据库方言
042     */
043    String buildLogicDeletedSet(String logicColumn, TableInfo tableInfo, IDialect dialect);
044
045    /**
046     * 用于构建通过 {@link QueryWrapper} 查询数据时的内容。
047     *
048     * @param queryWrapper 条件构造器
049     * @param tableInfo    表信息
050     */
051    void buildQueryCondition(QueryWrapper queryWrapper, TableInfo tableInfo);
052
053}
054
055