package com.yiboshi.science.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.dao.ComEvaluationDAO;
import com.yiboshi.science.entity.ComEvaluation;
import com.yiboshi.science.param.dto.ComEvaluationDTO;
import com.yiboshi.science.param.query.ComEvaluationQueryVO;
import com.yiboshi.science.service.ComEvaluationService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@AllArgsConstructor
public class ComEvaluationServiceImpl extends BaseServiceImpl<ComEvaluationDAO, ComEvaluationQueryVO, ComEvaluationDTO, ComEvaluation> implements ComEvaluationService {

    @Autowired
    private ComEvaluationDAO comEvaluationDAO;

    @Override
    protected void setCriteriaForQuery(ComEvaluationQueryVO vo, QueryWrapper<ComEvaluationQueryVO> criteria) {

    }

    @Override
    @Transactional
    public String save(ComEvaluationDTO dto) {
        return dto.getId();
    }

    public ComEvaluationDTO getEvaluationById(String id) {
        return this.dtoById(id);
    }

    public String insertEvaluation(ComEvaluationDTO dto) {
        ComEvaluation entity = convert2Entity(dto);
        this.insert(entity);
        return "评审表添加成功！";
    }

    public String updateEvaluation(ComEvaluationDTO dto) {
        ComEvaluation entity = convert2Entity(dto);
        this.update(entity);
        return "评审表更新成功！";
    }

    public String deleteEvaluation(String id) {
        this.deleteById(id);
        return "评审表删除成功！";
    }
}

