package org.springblade.system.tool;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotation.RequiresPermissions;
import org.springblade.common.annotation.SysLog;
import org.springblade.common.core.controller.BaseController;
import org.springblade.common.core.domain.entity.KyDataClassify;
import org.springblade.common.core.domain.entity.KyDataClassifyVo;
import org.springblade.common.core.domain.entity.KyDataCollectData;
import org.springblade.common.core.page.TableDataInfo;
import org.springblade.common.enums.OperaType;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.system.service.FileShareService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：liang.chao
 * @Date：2025/10/23 - 14:07
 */
@RestController
@RequestMapping("/file/share")
@Slf4j
@NonDS
public class FileShareController extends BaseController {

    @Resource
    private FileShareService fileShareService;

    /**
     * 获取数据分类管理下拉框
     * @param kyDataClassify
     * @return
     */
    @RequiresPermissions("file:share:list")
    @PostMapping("/listAll")
    public TableDataInfo listAll(@RequestBody KyDataClassify kyDataClassify)
    {
        List<KyDataClassifyVo> list = fileShareService.listAll(kyDataClassify);
        return getDataTable(list);
    }
    /**
     * 根据数据类型数据汇集管理列表
     *
     * @param kyDataCollectData
     * @return
     */
    @SysLog(title = "档案分享管理", businessType = OperaType.QUERY, module = "档案分享管理->档案分享管理", details = "根据档案文件数据汇集管理列表")
    @RequiresPermissions("file:share:list")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody KyDataCollectData kyDataCollectData) {
        List<KyDataCollectData> list = fileShareService.selectKyDataCollectDataList(kyDataCollectData);
        return getDataTable(list);
    }

    @SysLog(title = "档案分享文件详情", businessType = OperaType.QUERY, module = "档案分享管理->档案分享管理", details = "档案分享文件详情")
    @GetMapping("/queryById")
    public void queryById(KyDataCollectData kyDataCollectData, HttpServletResponse response) {
         fileShareService.queryDetailById(kyDataCollectData,response);
    }

}
