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

import api.common.pojo.param.project.MultiSimulationProjectParam;
import api.common.pojo.param.project.MultiSimulationSceneParam;
import api.common.pojo.po.project.MultiSimulationScenePO;
import api.common.pojo.vo.project.MultiSimulationProjectVO;
import api.common.pojo.vo.project.MultiSimulationSceneVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MultiSimulationSceneMapper {
    @Insert("insert into multi_simulation_scene (id,project_id) values" +
        "(#{id},#{projectId})")
    int addMultiSimulationScene(MultiSimulationScenePO scenePO);

    @Insert("insert into multi_simulation_scene (id,project_id, scene_name,map_id) values" +
        "(#{id},#{projectId},#{sceneName},#{mapId})")
    int addMultiSimulationSceneAll(MultiSimulationScenePO scenePO);

    @Update("update multi_simulation_scene set map_id = #{mapId}" +
        " where id = #{sceneId}")
    int updateMultiSimulationSceneMapId(@Param("mapId")String mapId, @Param("sceneId")String sceneId);

    @Select("select count(*) from multi_simulation_scene where project_id = #{projectId} and deleted = 0")
    int selectSceneNumsByProjectId(@Param("projectId") String projectId);

    @Update("update multi_simulation_scene set deleted = 1 where id = #{sceneId}")
    int deleteMultiSimulationScene(MultiSimulationSceneParam param);

    @Select("<script>" +
        "select id,project_id,scene_name,map_id,create_time from multi_simulation_scene where deleted = 0 " +
        "and project_id = #{projectId}" +
        "order by create_time desc" +
        "</script>")
    List<MultiSimulationSceneVO> selectSceneList(MultiSimulationSceneParam param);

    @Select("<script>" +
        "select id,project_id,scene_name,map_id,create_time,project_result_overall_url,project_result_simulation_url from multi_simulation_scene where deleted = 0 " +
        "and id = #{sceneId}" +
        "</script>")
    MultiSimulationSceneVO selectSceneDetailBySceneId(@Param("sceneId") String sceneId);

}
