package com.iformall.service.invest.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.iformall.domain.po.invest.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.mapper.InvestOperateRecordDao;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestOperateRecordService;
import org.springframework.stereotype.Service;


@Service
public class InvestOperateRecordServiceImpl extends InvestBaseServiceImpl<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService {

    @Override
    public boolean save(InvestOperateRecordEntity entity) {
        return super.saveAction(entity, this::checkBeforeSaveOrUpdate);
    }

    void checkBeforeSaveOrUpdate(InvestOperateRecordEntity entity) {
        InvestHelper.notNull(entity.getTbl());
        InvestHelper.notNull(entity.getTid());
        entity.setOperator(InvestUserContext.getUserId());
    }

    @Deprecated
    @Override
    public boolean update(InvestOperateRecordEntity entity, Wrapper<InvestOperateRecordEntity> updateWrapper) {
        notSupport();
        return false;
    }

    @Deprecated
    @Override
    public boolean saveOrUpdate(InvestOperateRecordEntity entity) {
        notSupport();
        return false;
    }

    @Deprecated
    @Override
    public boolean updateById(InvestOperateRecordEntity entity) {
        notSupport();
        return false;
    }

}
