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

import api.common.pojo.param.project.MultiSimulationProjectParam;
import api.common.pojo.po.project.MultiSimulationProjectPO;
import api.common.pojo.vo.project.MultiSimulationProjectVO;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface MultiSimulationProjectMapper {
//    @Results(id = "multiSimulationProjectRes", value = {
//        @Result(column = "id", property = "id", jdbcType = JdbcType.VARCHAR),
//        @Result(column = "project_key", property = "projectKey", jdbcType = JdbcType.VARCHAR),
//        @Result(column = "project_user_id", property = "projectUserId", jdbcType = JdbcType.VARCHAR),
//        @Result(column = "project_name", property = "projectName", jdbcType = JdbcType.VARCHAR),
//        @Result(column = "project_description", property = "projectDescription", jdbcType = JdbcType.VARCHAR),
//        @Result(column = "project_max_seconds", property = "projectMaxSeconds", jdbcType = JdbcType.INTEGER),
//        @Result(column = "project_status", property = "projectStatus", jdbcType = JdbcType.INTEGER),
//        @Result(column = "deleted", property = "deleted", jdbcType = JdbcType.INTEGER),
//        @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
//        @Result(column = "update_time", property = "updateTime", jdbcType = JdbcType.TIMESTAMP)
//    })

    @Update("update multi_simulation_project set project_status = #{projectStatus} " +
        "where id = #{projectId}")
    int updateMultiSimulationProjectStatus(MultiSimulationProjectParam param);

    @Select("select id,project_key as projectKey,project_name as projectName,project_status as projectStatus,create_time as createTime,project_description as projectDescription, " +
        "project_user_id as projectUserId from multi_simulation_project where deleted = 0 " +
        "and id = #{id} limit 1")
    MultiSimulationProjectVO selectMultiSimulationProjectById(@Param("id") String projectId);
}
