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


import com.css.simulation.resource.scheduler.infra.entity.ClusterEntity;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface ClusterMapper {


    @Results(id = "user", value = {
            @Result(column = "id", property = "id", jdbcType = JdbcType.VARCHAR),
            @Result(column = "user_id", property = "userId", jdbcType = JdbcType.VARCHAR),
            @Result(column = "num_simulation_license", property = "numSimulationLicense", jdbcType = JdbcType.INTEGER),
            @Result(column = "num_dynamic_license", property = "numDynamicLicense", jdbcType = JdbcType.INTEGER)
    })
    @Select("select id, user_id, num_simulation_license, num_dynamic_license\n" +
            "from system_cluster\n" +
            "where is_deleted = '0'\n" +
            "  and user_id = #{userId}")
    ClusterEntity selectByUserId(@Param("userId")String userId);

}
