package com.qingyun.service.service.impl;

import org.apache.commons.lang3.StringUtils;

import com.qingyun.common.utils.MapstructUtils;
import com.qingyun.mybatisplus.page.TableDataInfo;
import com.qingyun.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.qingyun.service.domain.bo.ContractReviewResultBo;
import com.qingyun.service.domain.vo.ContractReviewResultVo;
import com.qingyun.service.domain.ContractReviewResult;
import com.qingyun.service.mapper.ContractReviewResultMapper;
import com.qingyun.service.service.IContractReviewResultService;

import com.qingyun.mybatisplus.core.ServicePlusImpl;
import java.util.List;
import java.util.Map;
import java.util.Collection;

/**
 * 审查结果Service业务层处理
 *
 * @author jianlu
 * @date 2025-07-11
 */
@RequiredArgsConstructor
@Service
public class ContractReviewResultServiceImpl extends ServicePlusImpl<ContractReviewResultMapper, ContractReviewResult, ContractReviewResultVo> implements IContractReviewResultService {


    /**
     * 查询审查结果
     */
    @Override
    public ContractReviewResultVo queryById(String resultId){
        return baseMapper.selectVoById(resultId);
    }

    /**
     * 查询审查结果列表
     */
    @Override
    public List<ContractReviewResultVo> queryList(Long taskId) {
        List<ContractReviewResult> resultList = this.baseMapper.selectList(Wrappers.lambdaQuery(ContractReviewResult.class)
            .eq(ContractReviewResult::getTaskId, taskId)
            .orderByAsc(ContractReviewResult::getPageNum)
        );
        return MapstructUtils.convert(resultList, ContractReviewResultVo.class);
    }
}
