<?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.server.infra.db.mysql.mapper.AlgorithmExpandMapper">


    <select id="select" resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
        select id,
        algorithm_id algorithm_code,
        algorithm_name,
        description,
        algorithm_type,
        algorithm_version,
        team,
        topic,
        status
        from algorithm_expand
        where 1=1
        <if test="algorithmId != null and algorithmId != ''">
            and algorithm_id = #{algorithmId}
        </if>
        <if test="algorithmName != null and algorithmName != ''">
            and algorithm_name like concat('%',#{algorithmName},'%')
        </if>
        <if test="description != null and description != ''">
            and description like concat('%',#{description},'%')
        </if>
        <if test="algorithmVersion != null and algorithmVersion != ''">
            and algorithm_version like concat('%',#{algorithmVersion},'%')
        </if>
        <if test="team != null and team != ''">
            and team like concat('%',#{team},'%')
        </if>
        <if test="topic != null and topic != ''">
            and topic like concat('%',#{topic},'%')
        </if>
        <if test="status != null and status != ''">
            and status = #{status}
        </if>
        order by id desc
    </select>
    <select id="selectWithNoTeam" resultType="api.common.pojo.vo.algorithm.AlgorithmVO">
        select id,
        algorithm_id algorithm_code,
        algorithm_name,
        description,
        algorithm_type,
        algorithm_version,
        team,
        topic,
        status
        from algorithm_expand
        where team is null or team = ''
        <if test="algorithmName != null and algorithmName != ''">
            and algorithm_name like concat('%',#{algorithmName},'%')
        </if>
        <if test="description != null and description != ''">
            and description like concat('%',#{description},'%')
        </if>
        <if test="algorithmVersion != null and algorithmVersion != ''">
            and algorithm_version like concat('%',#{algorithmVersion},'%')
        </if>
        <if test="topic != null and topic != ''">
            and topic like concat('%',#{topic},'%')
        </if>
        <if test="status != null and status != ''">
            and status = #{status}
        </if>
        order by id desc
    </select>
</mapper>
