All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.diboot.core.methods.GetOneInRecycleBin Maven / Gradle / Ivy

There is a newer version: 3.4.2
Show newest version
package com.diboot.core.methods;

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 com.diboot.core.methods.RecycleBinSqlMethod;
import org.apache.ibatis.scripting.defaults.RawSqlSource;

public class GetOneInRecycleBin extends AbstractMethod {
    public GetOneInRecycleBin() {
        this(RecycleBinSqlMethod.SELECT_BY_ID.name());
    }

    public GetOneInRecycleBin(String name) {
        super(name);
    }
    @Override
    public MappedStatement injectMappedStatement(Class mapperClass, Class modelClass, TableInfo tableInfo) {
        RecycleBinSqlMethod sqlMethod = RecycleBinSqlMethod.SELECT_BY_ID;
        SqlSource sqlSource = new RawSqlSource(this.configuration, String.format(sqlMethod.getSql(), this.sqlSelectColumns(tableInfo, false), tableInfo.getTableName(), tableInfo.getKeyColumn(), tableInfo.getKeyProperty(), " AND NOT (" + tableInfo.getLogicDeleteSql(true, true) + ") "), Object.class);
        return this.addSelectMappedStatementForTable(mapperClass, this.methodName, sqlSource, tableInfo);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy