# CbCaseResultLogServiceImpl.java

    package cloud.wconnect.finance.service.chargeback.impl;

    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.finance.entity.chargeback.CbCase;
    import cloud.wconnect.finance.entity.chargeback.CbCaseResultLog;
    import cloud.wconnect.finance.mapper.chargeback.CbCaseResultLogMapper;
    import cloud.wconnect.finance.service.chargeback.ICbCaseResultLogService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    /**
     * <p>
     * case 切换 result 时记录的操作日志 服务实现类
     * </p>
     *
     * @author yyt
     * @since 2023-08-22
     */
    @Service
    @DS("finance")
    public class CbCaseResultLogServiceImpl extends ServiceImpl<CbCaseResultLogMapper, CbCaseResultLog> implements ICbCaseResultLogService {

        /**
         * 保存记录
         *
         * @param cs     case
         * @param result result
         * @param userId 操作人
         * @author yyt
         * @date 2023/9/7
         */
        @Override
        public void save(CbCase cs, Integer result, int userId) {
            save(new CbCaseResultLog().setPropertyId(cs.getPropertyId()).setCaseId(cs.getId()).setResult(result)
                    .setCreatedBy(userId).setCreatedTime(DateTimeUtils.nowTimestamp()));
        }

        /**
         * 清空日志
         *
         * @param caseId case id
         * @author yyt
         * @date 2023/9/7
         */
        @Override
        public void clearLog(Long caseId) {
            remove(new QueryWrapper<CbCaseResultLog>().lambda().eq(CbCaseResultLog::getCaseId, caseId));
        }

    }