package com.steerinfo.ems.emslog.service.impl;

import com.steerinfo.auth.utils.JwtUtil;
import com.steerinfo.ems.emslog.enums.BusinessType;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.ems.emslog.model.EmsLog;
import com.steerinfo.ems.emslog.mapper.EmsLogMapper;
import com.steerinfo.ems.emslog.service.IEmsLogService;
import com.steerinfo.framework.utils.misc.IdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.math.BigDecimal;

/**
 * EmsLog服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2021-10-18 04:03
 * 类描述
 * 修订历史：
 * 日期：2021-10-18
 * 作者：generator
 * 参考：
 * 描述：EmsLog服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "emsLogService")
public class EmsLogServiceImpl extends BaseServiceImpl<EmsLog, String> implements IEmsLogService {

    @Autowired
    private EmsLogMapper emsLogMapper;
    @Autowired
    IdGenerator idGenerator;
    @Override
    protected IBaseMapper<EmsLog, String> getMapper() {
        return emsLogMapper;
    }

    public void insertlog(String code,String page,String table,String type){
        String userId = JwtUtil.getUseridByToken();
        EmsLog emsLog = new EmsLog();
        emsLog.setCode(code);
        emsLog.setOperator(userId);
        emsLog.setPage(page);
        emsLog.setUpdatetable(table);
        emsLog.setType(type);
        emsLog.setOperatortime(new Date());
        emsLog.setId(idGenerator.getNextStr());
        emsLogMapper.insert(emsLog);
    }


}
