package com.persagy.server.services.task

import com.persagy.server.services.base.RService
import cn.sagacloud.server.datacenter.utils.IdUtils
import com.persagy.server.datacenter.models.entities.task.RecordProblems
import com.persagy.mybatis.SMybatisDao
import com.persagy.service.SPageContext

/**
 *
 */
object RecordProblemsService : RService<RecordProblems>(SMybatisDao(RecordProblems::class.java)){

    override fun onCreateBefore(entity: RecordProblems): Boolean {
        val projectId = SPageContext.getHeader("ProjectId")

        if (entity.id.isNullOrEmpty()){
            entity.id = IdUtils.uuidCreate()
        }
        if (entity.projectId.isNullOrEmpty()){
            entity.projectId = projectId
        }

        return super.onCreateBefore(entity)
    } //

} // Object RecordProblemsService