/*
 * Copyright (c) 京北方信息技术股份有限公司 Corporation 2021 . All rights reserved.
 *
 */
package net.northking.cctp.common.db.entity;

import net.northking.cctp.common.db.OrderBy;
import net.northking.cctp.common.db.PaginationService;
import net.northking.cctp.common.db.SqlOrderBy;

/**
 * 数据库实体对象服务抽象类
 *
 * @author : xiusong.xie
 * @version : 1.0
 */
public abstract class EntityService<T> extends PaginationService<T> implements EntityDBService
{

  /**
   * 字段名称：create_time
   */
  private static final String KEY_CreatedTime = "created_time";

  @Override
  protected OrderBy defaultOrderBy()
  {
    OrderBy orderBy = new SqlOrderBy();
    orderBy.desc(KEY_CreatedTime);
    return orderBy;
  }

  protected void beforeInsert(T record)
  {
    initBeforeInsert(record);
  }

  protected void beforeUpdate(T record)
  {
    initBeforeUpdate(record);
  }

}
