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

com.github.edgar615.util.spring.jdbc.JdbcImpl Maven / Gradle / Ivy

package com.github.edgar615.util.spring.jdbc;

import com.github.edgar615.util.db.Jdbc;
import com.github.edgar615.util.db.Persistent;
import com.github.edgar615.util.search.Example;
import java.util.List;
import java.util.Map;

/**
 * Created by Edgar on 2017/8/8.
 *
 * @author Edgar  Date 2017/8/8
 */
public class JdbcImpl implements Jdbc {

  private final JdbcOperation jdbcOperation;

  public JdbcImpl(JdbcOperation jdbcOperation) {
    this.jdbcOperation = jdbcOperation;
  }

  @Override
  public  void insert(Persistent persistent) {
    jdbcOperation.insert(persistent);
  }

  @Override
  public  ID insertAndGeneratedKey(Persistent persistent) {
    return jdbcOperation.insertAndGeneratedKey(persistent);
  }

  @Override
  public > void batchInsert(List persistentList) {
    jdbcOperation.batchInsert(persistentList);
  }

  @Override
  public > int deleteById(Class elementType, ID id) {
    return jdbcOperation.deleteById(elementType, id);
  }

  @Override
  public > int deleteByExample(Class elementType,
      Example example) {
    return jdbcOperation.deleteByExample(elementType, example);
  }

  @Override
  public  int updateById(Persistent persistent,
      Map addOrSub,
      List nullFields, ID id) {
    return jdbcOperation.updateById(persistent, addOrSub, nullFields, id);
  }

  @Override
  public  int updateByExample(Persistent persistent,
      Map addOrSub,
      List nullFields,
      Example example) {
    return jdbcOperation.updateByExample(persistent, addOrSub, nullFields, example);
  }

  @Override
  public > T findById(Class elementType, ID id,
      List fields) {
    return jdbcOperation.findById(elementType, id, fields);
  }

  @Override
  public > List findByExample(Class elementType,
      Example example) {
    return jdbcOperation.findByExample(elementType, example);
  }

  @Override
  public > List findByExample(Class elementType, Example example,
      int start, int limit) {
    return jdbcOperation.findByExample(elementType, example, start, limit);
  }

  @Override
  public > int countByExample(Class elementType,
      Example example) {
    return jdbcOperation.countByExample(elementType, example);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy