package com.unis.crk.common.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.unis.crk.common.entity.DeleteDataRecord;
import com.unis.crk.common.mapper.DeleteDataRecordMapper;
import com.unis.crk.common.service.IDeleteDataRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * <p>
 * 数据删除记录 服务实现类
 * </p>
 *
 * @author TangSong
 * @since 2022-06-01
 */
@Service
public class DeleteDataRecordServiceImpl extends ServiceImpl<DeleteDataRecordMapper, DeleteDataRecord> implements IDeleteDataRecordService {

    @Resource
    private DeleteDataRecordMapper deleteDataRecordMapper;


    /**
     * 保存轨迹表删除记录
     *
     * @param trailId
     */
    @Override
    public void saveBizflowtrail(String trailId) {
        DeleteDataRecord dataRecord = new DeleteDataRecord();
        dataRecord.setDataid(trailId);
        dataRecord.setTableName("bizflowtrail");
        super.save(dataRecord);

    }

    /**
     * 基础数据保存
     *
     * @param dataId
     * @param tableName
     */
    @Override
    public void save(String dataId, String tableName, String unitid, Date deleteTime) {
        {
            DeleteDataRecord dataRecord = new DeleteDataRecord();
            dataRecord.setDataid(dataId);
            dataRecord.setTableName(tableName);
            dataRecord.setUnitid(unitid);
            dataRecord.setDeleteTime(deleteTime);
            super.save(dataRecord);

        }
    }

    public void saveXckc(String dataId, String unitid, Date deleteTime) {
        save(dataId, "DATA_KCGL_XCKC_DEFAULT",unitid,deleteTime);
    }
    public void saveFcbgz(String dataId, String unitid, Date deleteTime) {
        save(dataId, "DATA_KCGL_FCBGZ_DEFAULT",unitid,deleteTime);
    }
    public void saveRjd(String dataId, String unitid, Date deleteTime) {
        save(dataId, "DATA_KCGL_KCRJD_DEFAULT",unitid,deleteTime);
    }
    public void saveKcsw(String dataId, String unitid, Date deleteTime) {
        save(dataId, "DATA_KCGL_KCSW_DEFAULT",unitid,deleteTime);
    }
}
