package com.cmvr.vi.service.ex;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.cmvr.evaluation.service.ExViProjectService;
import com.cmvr.vi.model.domain.ViProject;
import com.cmvr.vi.service.IViProjectService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class ExViProjectServiceImpl implements ExViProjectService {

    private final IViProjectService viProjectService;

    @Override
    public JSONObject queryById(String id) {
        ViProject project = viProjectService.getById(id);
        return null;
    }

    @Override
    public boolean updateStatus(String id) {
        LambdaUpdateWrapper<ViProject> wrapper = Wrappers.lambdaUpdate();
        wrapper.eq(ViProject::getProjectId, id)
                .eq(ViProject::getStatus, 1) // 运行中
                .set(ViProject::getStatus, 2); // 完成
        return viProjectService.update(null, wrapper);
    }
}
