package com.ruoyi.cai.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cai.domain.IgnoreData;
import com.ruoyi.cai.enums.IgnoreDataTypeEnum;
import com.ruoyi.cai.mapper.IgnoreDataMapper;
import com.ruoyi.cai.service.IgnoreDataService;
import org.springframework.stereotype.Service;

/**
 * 忽略数据Service业务层处理
 *
 * @author 77
 * @date 2024-01-27
 */
@Service
public class IgnoreDataServiceImpl extends ServiceImpl<IgnoreDataMapper,IgnoreData> implements IgnoreDataService {

    @Override
    public void saveIgnoreData(IgnoreDataTypeEnum type,Long userId, Object text){
        try {
            IgnoreData ignoreData = new IgnoreData();
            ignoreData.setType(type.getCode());
            ignoreData.setUserId(userId);
            ignoreData.setText(JSON.toJSONString(text));
            this.save(ignoreData);
        }catch (Exception e){
            log.error("忽略数据存储异常");
        }
    }

}
