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

import api.common.pojo.po.scene.SceneRiskPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface SceneRiskMapper {

    List<SceneRiskPO> selectSceneIdsByEvaluation(SceneRiskPO sceneRiskPO);

    List<SceneRiskPO> selectSceneRiskEvaluationForExport(@Param("taskId") String taskId, @Param("list") List<String> list);


    @Select("select sr.risk_id, sr.scene_id, sr.scene_type,sr.rule_id ,ser.rule_name, sr.task_id ,sr.risk, sr.risk_level, mv.config_name as vehicle_name, a.algorithm_name \n" +
            "from scene_risk sr LEFT JOIN scene_evaluation_rule ser  ON ser.rule_id = sr.rule_id \n" +
            "LEFT JOIN algorithm a  ON sr.algorithm_id = a.id LEFT JOIN model_config mv ON mv.id = sr.vehicle_id  \n" +
            "where sr.scene_id = #{sceneId} order by sr.create_time desc" )
    List<SceneRiskPO> querySceneEvaluationRiskDetail(@Param("sceneId") String sceneId);

}
