package com.yunzhupaas.engine.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.engine.entity.FlowRejectDataEntity;
import com.yunzhupaas.engine.mapper.FlowRejectDataMapper;
import com.yunzhupaas.engine.service.FlowRejectDataService;
import com.yunzhupaas.util.RandomUtil;
import org.springframework.stereotype.Service;

/**
 * 冻结审批
 *
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司
 * @date 2024-09-29 上午9:18
 */
@Service
public class FlowRejectDataDataServiceImpl extends SuperServiceImpl<FlowRejectDataMapper, FlowRejectDataEntity> implements FlowRejectDataService {

    @Override
    public void createOrUpdate(FlowRejectDataEntity rejectEntity) {
        this.saveOrUpdate(rejectEntity);
    }

    @Override
    public void create(FlowRejectDataEntity rejectEntity) {
        if (rejectEntity.getId() == null) {
            rejectEntity.setId(RandomUtil.uuId());
        }
        this.save(rejectEntity);
    }

    @Override
    public void update(String id, FlowRejectDataEntity rejectEntity) {
        rejectEntity.setId(id);
        this.updateById(rejectEntity);
    }

    @Override
    public FlowRejectDataEntity getInfo(String id) {
        QueryWrapper<FlowRejectDataEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(FlowRejectDataEntity::getId, id);
        return this.getOne(queryWrapper);
    }

}

