package com.css.simulation.resource.server.infra.db.mysql.mapper;

import api.common.pojo.po.project.SimulationMptFirstTargetScorePO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SimulationMptFirstTargetScoreMapper {

    SimulationMptFirstTargetScorePO selectFirstTargetScore(SimulationMptFirstTargetScorePO po);

    @Select("select sum(score * weight / 100.0)\n" +
            "from simulation_mpt_first_target_score\n" +
            "where is_deleted = '0'\n" +
            "  and p_id = #{pId,jdbcType=VARCHAR}")
    Double selectScoreOfProject(String projectId);

    List<SimulationMptFirstTargetScorePO> selectFirstTargetByPid(SimulationMptFirstTargetScorePO po);


}
