package com.ai.da.mapper.primary;

import com.ai.da.common.config.mybatis.plus.CommonMapper;
import com.ai.da.mapper.primary.entity.CollectionSort;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface CollectionSortMapper extends CommonMapper<CollectionSort> {
    @Update("UPDATE collection_sort SET sort = sort + 1 " +
            "WHERE parent_id = #{parentId} " +
            "AND relation_type != 'Design' " +
            "AND sort > #{originalSort}")
    void increaseGenerateSortAbove(
            @Param("parentId") Long parentId,
            @Param("relationType") String relationType,
            @Param("originalSort") int originalSort
    );
}
