/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.workflow.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codvision.webcore.bean.QueryPage;
import com.codvision.webcore.util.QueryPageUtil;
import com.codvision.workflow.entity.QuestionnaireModule;
import com.codvision.workflow.mapper.QuestionnaireModuleMapper;
import com.codvision.workflow.service.QuestionnaireModuleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author codvision
 */
@Service
public class QuestionnaireModuleServiceImpl extends ServiceImpl<QuestionnaireModuleMapper, QuestionnaireModule> implements QuestionnaireModuleService {

    @Override
    public IPage<QuestionnaireModule> getPageResult(QueryPage<Map<String, Object>> queryPage) {
        return getBaseMapper().getPageResult(queryPage.getPage(), QueryPageUtil.queryMap(queryPage));
    }

    @Transactional(rollbackFor = Exception.class)
    public void batchInsert(List<QuestionnaireModule> questionnaireModules) {
        this.saveBatch(questionnaireModules);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void batchUpdate(List<QuestionnaireModule> questionnaireModules) {
        this.updateBatchById(questionnaireModules);
    }

    @Override
    public Integer checkFillIn(String uuid, String webId) {
        return getBaseMapper().checkFillIn(uuid, webId);
    }

}
