package cn.reghao.tnb.file.app.zdisk.db.repository;

import cn.reghao.tnb.file.app.zdisk.db.mapper.DiskShareMapper;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author reghao
 * @date 2025-09-06 15:52:24
 */
@Repository
public class DiskShareRepository {
    private final DiskShareMapper diskShareMapper;

    public DiskShareRepository(DiskShareMapper diskShareMapper) {
        this.diskShareMapper = diskShareMapper;
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteShare(long shareId) {
        diskShareMapper.updateSetDelete(shareId);
        diskShareMapper.deleteShareToList(shareId);
    }
}
