package cn.iocoder.yudao.module.system.service.biz;

import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.EvaluationTemplatesConfigDO;
import cn.iocoder.yudao.module.system.dal.mysql.biz.EvaluationTemplatesConfigMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;

import java.util.List;

/**
 * 评估问卷能力得分配置 Service 实现类
 *
 * @author 系统管理员
 */
@Service
@Validated
public class EvaluationTemplatesConfigServiceImpl implements EvaluationTemplatesConfigService {

    @Resource
    private EvaluationTemplatesConfigMapper evaluationTemplatesConfigMapper;


    @Override
    public Long createEvaluationTemplatesConfig(EvaluationTemplatesConfigDO createReqVO) {
        evaluationTemplatesConfigMapper.insert(createReqVO);
        return createReqVO.getId();
    }

    @Override
    public void deleteEvaluationTemplatesConfig(Long id) {
//        EvaluationTemplatesConfigDO evaluationTemplatesConfigDO = evaluationTemplatesConfigMapper.selectById(id);
//        evaluationTemplatesConfigDO.setDeleted(Boolean.TRUE);
//        evaluationTemplatesConfigMapper.updateById(evaluationTemplatesConfigDO);
        evaluationTemplatesConfigMapper.deleteById(id);
    }

    @Override
    public void updateEvaluationTemplatesConfig(EvaluationTemplatesConfigDO updateReqVO) {
        evaluationTemplatesConfigMapper.updateById(updateReqVO);
    }

    @Override
    public EvaluationTemplatesConfigDO getEvaluationTemplatesConfig(Long id) {
        return evaluationTemplatesConfigMapper.selectById(id);
    }

    @Override
    public List<EvaluationTemplatesConfigDO> getEvaluationTemplatesConfigList(Long evaluationTemplateId) {
        return evaluationTemplatesConfigMapper.selectList(new LambdaQueryWrapperX<EvaluationTemplatesConfigDO>()
                .eq(EvaluationTemplatesConfigDO::getEvaluationTemplateId,evaluationTemplateId)
                .eq(EvaluationTemplatesConfigDO::getDeleted,Boolean.FALSE));
    }
}