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

win.doyto.query.core.CommonCrudService Maven / Gradle / Ivy

There is a newer version: 0.2.2.1-RELEASE
Show newest version
package win.doyto.query.core;

import win.doyto.query.entity.Persistable;
import win.doyto.query.service.QueryService;

/**
 * CommonCrudService
 *
 * @author f0rb on 2019-06-01
 */
public interface CommonCrudService extends QueryService {

    void create(E e);

    void update(E e);

    default E save(E e) {
        if (e.isNew()) {
            create(e);
        } else {
            update(e);
        }
        return e;
    }

    void patch(E e);

    /**
     * 执行INSERT INTO [TABLE] (col1, col2) VALUES (?), (?)
     * 
    *
  1. 清空全部缓存
  2. *
  3. 不会按id清理缓存
  4. *
  5. 不会执行{@link win.doyto.query.entity.EntityAspect#afterCreate(Object)}
  6. *
*/ int batchInsert(Iterable entities); /** * 执行UPDATE [TABLE] SET ... WHERE ... *
    *
  1. 清空全部缓存
  2. *
  3. 不会按id清理缓存
  4. *
  5. 不会执行{@link win.doyto.query.entity.EntityAspect#afterUpdate(Object, Object)}
  6. *
* @param e entity object * @param q query object * @return */ int patch(E e, Q q); /** * 执行DELETE FORM [TABLE] WHERE ... *
    *
  1. 清空全部缓存
  2. *
  3. 不会按id清理缓存
  4. *
  5. 不会执行{@link win.doyto.query.entity.EntityAspect#afterDelete(Object)}
  6. *
* * @param q query object */ int delete(Q q); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy