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

io.github.nichetoolkit.mybatis.provider.PostgresRemoveLinkProvider Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package io.github.nichetoolkit.mybatis.provider;

import io.github.nichetoolkit.mybatis.MybatisSqlProvider;
import io.github.nichetoolkit.mybatis.MybatisTable;
import io.github.nichetoolkit.mybatis.enums.DatabaseType;
import io.github.nichetoolkit.mybatis.error.MybatisParamErrorException;
import io.github.nichetoolkit.mybatis.error.MybatisTableErrorException;
import io.github.nichetoolkit.rest.RestException;
import io.github.nichetoolkit.rest.actuator.ConsumerActuator;
import io.github.nichetoolkit.rest.util.OptionalUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.builder.annotation.ProviderContext;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * PostgresRemoveLinkProvider
 * 

The postgres remove link provider class.

* @author Cyan ([email protected]) * @see io.github.nichetoolkit.mybatis.MybatisSqlProvider * @see lombok.extern.slf4j.Slf4j * @see org.springframework.stereotype.Component * @since Jdk1.8 */ @Slf4j @Component public class PostgresRemoveLinkProvider implements MybatisSqlProvider { @Override public DatabaseType databaseType() { return DatabaseType.POSTGRESQL; } /** * removeByLinkId *

The remove by link id method.

* @param {@link java.lang.Object}

The parameter can be of any type.

* @param providerContext {@link org.apache.ibatis.builder.annotation.ProviderContext}

The provider context parameter is ProviderContext type.

* @param linkId L

The link id parameter is L type.

* @param logic {@link java.lang.Object}

The logic parameter is Object type.

* @return {@link java.lang.String}

The remove by link id return object is String type.

* @throws RestException {@link io.github.nichetoolkit.rest.RestException}

The rest exception is RestException type.

* @see org.apache.ibatis.builder.annotation.ProviderContext * @see java.lang.Object * @see java.lang.String * @see io.github.nichetoolkit.rest.RestException */ public static String removeByLinkId(ProviderContext providerContext, L linkId, Object logic) throws RestException { return removeDynamicByLinkId(providerContext, null, linkId, logic); } /** * removeDynamicByLinkId *

The remove dynamic by link id method.

* @param {@link java.lang.Object}

The parameter can be of any type.

* @param providerContext {@link org.apache.ibatis.builder.annotation.ProviderContext}

The provider context parameter is ProviderContext type.

* @param tablename {@link java.lang.String}

The tablename parameter is String type.

* @param linkId L

The link id parameter is L type.

* @param logic {@link java.lang.Object}

The logic parameter is Object type.

* @return {@link java.lang.String}

The remove dynamic by link id return object is String type.

* @throws RestException {@link io.github.nichetoolkit.rest.RestException}

The rest exception is RestException type.

* @see org.apache.ibatis.builder.annotation.ProviderContext * @see java.lang.String * @see java.lang.Object * @see io.github.nichetoolkit.rest.RestException */ public static String removeDynamicByLinkId(ProviderContext providerContext, String tablename, L linkId, Object logic) throws RestException { OptionalUtils.ofEmpty(linkId, "The link id param of 'removeByLinkId' method cannot be empty!", message -> new MybatisParamErrorException("removeByLinkId", "linkId", message)); OptionalUtils.ofEmpty(logic, "The logic param of 'removeByLinkId' method cannot be empty!", message -> new MybatisParamErrorException("removeByLinkId", "logic", message)); String logicColumn = "The logic column of table with 'removeByLinkId' method cannot be empty!"; ConsumerActuator tableOptional = table -> OptionalUtils.ofEmpty(table.getLogicColumn(), logicColumn, log, message -> new MybatisTableErrorException("removeByLinkId", "logicColumn", message)); return MybatisSqlProvider.providingOfLinkId(providerContext, tablename, linkId, tableOptional, REMOVE_SQL_SUPPLY); } /** * removeAllByLinkIds *

The remove all by link ids method.

* @param {@link java.lang.Object}

The parameter can be of any type.

* @param providerContext {@link org.apache.ibatis.builder.annotation.ProviderContext}

The provider context parameter is ProviderContext type.

* @param linkIdList {@link java.util.Collection}

The link id list parameter is Collection type.

* @param logic {@link java.lang.Object}

The logic parameter is Object type.

* @return {@link java.lang.String}

The remove all by link ids return object is String type.

* @throws RestException {@link io.github.nichetoolkit.rest.RestException}

The rest exception is RestException type.

* @see org.apache.ibatis.builder.annotation.ProviderContext * @see java.util.Collection * @see java.lang.Object * @see java.lang.String * @see io.github.nichetoolkit.rest.RestException */ public static String removeAllByLinkIds(ProviderContext providerContext, Collection linkIdList, Object logic) throws RestException { return removeDynamicAllByLinkIds(providerContext, null, linkIdList, logic); } /** * removeDynamicAllByLinkIds *

The remove dynamic all by link ids method.

* @param {@link java.lang.Object}

The parameter can be of any type.

* @param providerContext {@link org.apache.ibatis.builder.annotation.ProviderContext}

The provider context parameter is ProviderContext type.

* @param tablename {@link java.lang.String}

The tablename parameter is String type.

* @param linkIdList {@link java.util.Collection}

The link id list parameter is Collection type.

* @param logic {@link java.lang.Object}

The logic parameter is Object type.

* @return {@link java.lang.String}

The remove dynamic all by link ids return object is String type.

* @throws RestException {@link io.github.nichetoolkit.rest.RestException}

The rest exception is RestException type.

* @see org.apache.ibatis.builder.annotation.ProviderContext * @see java.lang.String * @see java.util.Collection * @see java.lang.Object * @see io.github.nichetoolkit.rest.RestException */ public static String removeDynamicAllByLinkIds(ProviderContext providerContext, String tablename, Collection linkIdList, Object logic) throws RestException { OptionalUtils.ofEmpty(linkIdList, "The link id list param of 'removeAllByLinkIds' method cannot be empty!", message -> new MybatisParamErrorException("removeAllByLinkIds", "linkIdList", message)); OptionalUtils.ofEmpty(logic, "The logic param of 'removeAllByLinkIds' method cannot be empty!", message -> new MybatisParamErrorException("removeAllByLinkIds", "logic", message)); String logicColumn = "The logic column of table with 'removeAllByLinkIds' method cannot be empty!"; ConsumerActuator tableOptional = table -> OptionalUtils.ofEmpty(table.getLogicColumn(), logicColumn, log, message -> new MybatisTableErrorException("removeAllByLinkIds", "logicColumn", message)); return MybatisSqlProvider.providingOfLinkIdAll(providerContext, tablename, linkIdList, tableOptional, REMOVE_SQL_SUPPLY); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy