<?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.yhy.module.core.dal.mysql.resource.ResourceItemMapper">

    <!-- 将指定目录节点下，排序值 >= sortOrder 的行的排序值都加1 -->
    <update id="incrementSortOrderFrom">
        UPDATE yhy_resource_item
        SET sort_order = sort_order + 1,
            update_time = NOW()
        WHERE catalog_item_id = #{catalogItemId}
          AND sort_order >= #{sortOrder}
          AND deleted = 0
    </update>

</mapper>
