package com.persagy.meiku.services

import com.persagy.mybatis.SMybatisDao
import com.persagy.meiku.models.entities.MeiKuAnchor
import com.persagy.service.SObjectService
import java.util.*

/**
 * 锚点服务
 *
 * @author  wx
 * @date  2020/9/21 11:31
 */
object MeiKuAnchorService: SObjectService<MeiKuAnchor>(SMybatisDao(MeiKuAnchor::class.java)) {

    /**
     * 创建之前操作
     *
     * @param entity    锚点对象
     * @return 是否执行
     */
    override fun onCreateBefore(entity: MeiKuAnchor): Boolean {
        /** id 为空赋值 */
        if (entity.id.isNullOrEmpty()){
            entity.id = UUID.randomUUID().toString().replace("-", "")
        }
        return super.onCreateBefore(entity)
    }

}