package com.sptg.permissions.biz.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sptg.permissions.api.entity.JobLog;
import com.sptg.permissions.biz.mapper.JobLogMapper;
import com.sptg.permissions.biz.service.JobLogServiceInterface;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * title: JobLogServiceImpl
 * package: com.sptg.permissions.biz.security.impl
 * description: 定时任务日志-业务层实现类
 *
 *                  
 *                 
 */
@Service
@RequiredArgsConstructor
public class JobLogServiceImpl extends ServiceImpl<JobLogMapper, JobLog> implements JobLogServiceInterface {

    @Override
    public boolean insert(JobLog entity) {
        entity.setCreateDate(new Date());
        try{
            return super.insert(entity);
        }catch (DuplicateKeyException e){
            return false;
        }
    }
}
