com.diboot.core.methods.DeleteBatchByIdsInRecycleBin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of diboot-core Show documentation
Show all versions of diboot-core Show documentation
diboot core extend by begcode
package com.diboot.core.methods;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
import org.apache.ibatis.scripting.defaults.RawSqlSource;
public class DeleteBatchByIdsInRecycleBin extends AbstractMethod {
public DeleteBatchByIdsInRecycleBin() {
this(RecycleBinSqlMethod.DELETE_BATCH_BY_IDS.getMethod());
}
public DeleteBatchByIdsInRecycleBin(String name) {
super(name);
}
@Override
public MappedStatement injectMappedStatement(Class> mapperClass, Class> modelClass, TableInfo tableInfo) {
String sql;
SqlSource sqlSource;
RecycleBinSqlMethod sqlMethod = RecycleBinSqlMethod.DELETE_BATCH_BY_IDS;
sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), tableInfo.getKeyColumn(), SqlScriptUtils.convertForeach(SqlScriptUtils.convertChoose("@org.apache.ibatis.type.SimpleTypeRegistry@isSimpleType(item.getClass())", "#{item}", "#{item." + tableInfo.getKeyProperty() + "}"), "coll", (String)null, "item", ","), " AND NOT (" + tableInfo.getLogicDeleteSql(true, true) + ")");
sqlSource = this.languageDriver.createSqlSource(this.configuration, sql, Object.class);
return this.addDeleteMappedStatement(mapperClass, this.methodName, sqlSource);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy