package com.njcn.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.LogInfoDTO;
import com.njcn.system.mapper.UserLogMapper;
import com.njcn.system.pojo.po.UserLog;
import com.njcn.system.service.IUserLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hongawen
 * @since 2021-12-13
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class UserLogServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implements IUserLogService {


    @Override
    public void addUserLog(LogInfoDTO logInfoDTO) {
        UserLog userLog = new UserLog();
        BeanUtil.copyProperties(logInfoDTO, userLog);
        userLog.setCreateBy(logInfoDTO.getUserIndex());
        userLog.setUpdateBy(logInfoDTO.getUserIndex());
        userLog.setState(0);
        this.baseMapper.insert(userLog);
    }

}
