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.dialect; 017 018import com.mybatisflex.core.query.QueryWrapper; 019import com.mybatisflex.core.row.Row; 020import com.mybatisflex.core.table.TableInfo; 021 022import java.util.List; 023 024public interface IDialect { 025 026 String wrap(String keyword); 027 028 String forInsertRow(String tableName, Row row); 029 030 String forInsertBatchWithFirstRowColumns(String tableName, List<Row> rows); 031 032 String forDeleteById(String tableName, String[] primaryKeys); 033 034 String forDeleteBatchByIds(String tableName, String[] primaryKeys, Object[] ids); 035 036 String forDeleteByQuery(QueryWrapper queryWrapper); 037 038 String forUpdateById(String tableName, Row row); 039 040 String forUpdateByQuery(QueryWrapper queryWrapper, Row data); 041 042 String forUpdateBatchById(String tableName, List<Row> rows); 043 044 String forSelectOneById(String tableName, String[] primaryKeys, Object[] primaryValues); 045 046 String forSelectListByQuery(QueryWrapper queryWrapper); 047 048 String forSelectCountByQuery(QueryWrapper queryWrapper); 049 050 051 String buildSelectSql(QueryWrapper queryWrapper); 052 053 String buildSelectCountSql(QueryWrapper queryWrapper); 054 055 String buildDeleteSql(QueryWrapper queryWrapper); 056 057 String buildWhereConditionSql(QueryWrapper queryWrapper); 058 059 060 061 //////for entity ///// 062 String forInsertEntity(TableInfo tableInfo, Object entity); 063 064 String forInsertEntityBatch(TableInfo tableInfo, List<Object> entities); 065 066 String forDeleteEntityById(TableInfo tableInfo); 067 068 String forDeleteEntityBatchByIds(TableInfo tableInfo, Object[] primaryValues); 069 070 String forDeleteEntityBatchByQuery(TableInfo tableInfo, QueryWrapper queryWrapper); 071 072 String forUpdateEntity(TableInfo tableInfo, Object entity, boolean ignoreNulls); 073 074 String forUpdateEntityByQuery(TableInfo tableInfo, Object entity, boolean ignoreNulls, QueryWrapper queryWrapper); 075 076 String forSelectOneEntityById(TableInfo tableInfo); 077 078 String forSelectEntityListByIds(TableInfo tableInfo, Object[] primaryValues); 079 080}