package com.flossom.miniProgram.service.impl;

import com.flossom.common.core.domain.entity.CtLeaveMessage;
import com.flossom.common.core.enums.CtLeaveMessageEnum;
import com.flossom.common.core.mapper.CtLeaveMessageMapper;
import com.flossom.miniProgram.service.ICtleaveMeassageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CtleaveMessageServiceImpl implements ICtleaveMeassageService {
    @Autowired
    private CtLeaveMessageMapper ctLeaveMessageMapper;

    @Override
    public int saveCtleaveMeassage(CtLeaveMessage ctLeaveMessage) {
        CtLeaveMessageEnum ctLeaveMessageEnum = CtLeaveMessageEnum.fromString(ctLeaveMessage.getSource());
        ctLeaveMessage.setSourceName(ctLeaveMessageEnum.getRemark());
        ctLeaveMessage.setCreateTime(new Date());
        return ctLeaveMessageMapper.insertCtLeaveMessage(ctLeaveMessage);
    }
}
