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

import api.common.pojo.param.algorithm.AlgorithmParameter;
import api.common.pojo.po.algorithm.AlgorithmPO;
import api.common.pojo.vo.algorithm.AlgorithmVO;
import api.common.pojo.vo.algorithm.RunningProjectVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AlgorithmMapper {

    List<AlgorithmVO> selectAlgorithmList(AlgorithmParameter param);

    int add(AlgorithmPO po);

    int update(AlgorithmPO po);

    void deleteById(@Param("algorithmId") String algorithmId);

    AlgorithmPO selectDetailsById(@Param("algorithmId") String algorithmId);

    @Select("        select is_deleted\n" +
            "        from algorithm\n" +
            "        where id = #{algorithmId}")
    String selectIsDeletedById(@Param("algorithmId") String algorithmId);

    @Select("select algorithm_name\n" +
            "from algorithm\n" +
            "where is_deleted = '1'\n" +
            " and id = #{algorithmId}")
    String selectDeletedById(@Param("algorithmId") String algorithmId);

    List<AlgorithmPO> selectAlgorithmName(AlgorithmParameter param);

    List<AlgorithmPO> selectSharedAlgorithmName(@Param("algorithmName") String algorithmName);

    List<RunningProjectVO> selectRunningProject(@Param("id") String id);

    List<RunningProjectVO> selectRunningProjectParent(@Param("id") String id);

    List<RunningProjectVO> selectAutoProjectIdByAlgorithmId(@Param("algorithmId") String algorithmId);

    List<AlgorithmVO> selectSharedAlgorithmList(AlgorithmParameter param);

    int  selectDetailsBySy(AlgorithmParameter param);

    String selectAlgorithmNameByAlgorithmId(@Param("algorithmId") String algorithmId);
}
