<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.css.simulation.resource.monitor.infrastructure.db.mysql.mapper.AlgorithmExpandMapper">
    <insert id="insert">
        insert into algorithm_expand(id, algorithm_id, algorithm_name, description, algorithm_type, algorithm_version,
                                     team, topic, status)
            value (#{id}, #{algorithmId}, #{algorithmName}, #{description}, #{algorithmType}, #{algorithmVersion},
                   #{team}, #{topic}, #{status})
    </insert>
    <update id="update">
        update algorithm_expand
        set algorithm_name    = #{algorithmName},
            description       = #{description},
            algorithm_type    = #{algorithmType},
            algorithm_version = #{algorithmVersion},
            team              = #{team},
            topic             = #{topic},
            status            = #{status}
        where algorithm_id = #{algorithmId}
    </update>
    <delete id="delete">
        delete from algorithm_expand where algorithm_id = #{algorithmId}
    </delete>


    <select id="select"
            resultType="com.css.simulation.resource.monitor.infrastructure.db.entity.AlgorithmExpandEntity">
        select id, algorithm_id, algorithm_name, description, algorithm_type, status
        from algorithm_expand
        where 1=1
        <if test="algorithmIds != null">
            and algorithm_id in
            <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>
                #{item}
            </foreach>
        </if>
        <if test="algorithmId != null and algorithmId != ''">
            and algorithm_id = #{algorithmId}
        </if>
    </select>
    <select id="selectAlgorithmIds" resultType="java.lang.String">
        select algorithm_id
        from algorithm_expand
        where 1=1
        <if test="algorithmIds != null">
            and algorithm_id in
            <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>
                #{item}
            </foreach>
        </if>
    </select>
</mapper>
