package com.persagy.meiku.services

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

/**
 * 状态
 *
 * @author  wx
 * @date  2020/9/21 11:35
 */
object MeiKuStateService : SObjectService<MeiKuState>(SMybatisDao(MeiKuState::class.java)) {
    /**
     * 创建之前操作
     *
     * @param entity    状态对象
     * @return 是否执行
     */
    override fun onCreateBefore(entity: MeiKuState): Boolean {
        /** id 为空赋值 */
        if (entity.id.isNullOrEmpty()){
            entity.id = UUID.randomUUID().toString().replace("-", "")
        }
        return super.onCreateBefore(entity)
    }
}