package com.qmth.sop.business.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.sop.business.entity.TGError;
import com.qmth.sop.business.mapper.TGErrorMapper;
import com.qmth.sop.business.service.TGErrorService;
import com.qmth.sop.common.contant.SystemConstant;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 全局异常错误信息表 服务实现类
 * </p>
 *
 * @author wangliang
 * @since 2023-07-17
 */
@Service
public class TGErrorServiceImpl extends ServiceImpl<TGErrorMapper, TGError> implements TGErrorService {

    /**
     * 保存错误信息
     *
     * @param s
     */
    @Override
    @Transactional
    public void saveExamTgError(Object... s) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(SystemConstant.TYPE, s[0]);
        jsonObject.put(SystemConstant.ERROR_METHOD, s[1]);
        this.save(new TGError(jsonObject.toJSONString()));
    }
}
