package com.zxdmy.excite.admin.controller.cloud.space;


import cn.dev33.satoken.stp.StpUtil;
import com.zxdmy.excite.common.base.BaseController;
import com.zxdmy.excite.common.base.BaseResult;
import com.zxdmy.excite.common.entity.PageList;
import com.zxdmy.excite.framework.aop.AnnotationSaveReLog;
import com.zxdmy.excite.system.entity.cloud.role.CloudRole;
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
import com.zxdmy.excite.system.entity.cloud.space.CloudFileRole;
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
import com.zxdmy.excite.system.entity.req.space.ReqCloudFileRole;
import com.zxdmy.excite.system.entity.vo.space.CloudFileRoleVo;
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
import com.zxdmy.excite.system.entity.vo.space.CloudFilleUserVo;
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleUserService;
import com.zxdmy.excite.system.service.cloud.space.ICloudFileRoleService;
import com.zxdmy.excite.system.service.cloud.space.ICloudFileService;
import lombok.AllArgsConstructor;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 文件表 前端控制器
 * </p>
 *
 * @author ss
 * @since 2026-01-28
 */
@Controller
@AllArgsConstructor
@RequestMapping("/cloud/fileRole")
public class CloudFileRoleController extends BaseController {

    private ICloudFileRoleService iCloudFileRoleService;


    @GetMapping("/getData")
    @ResponseBody
    public BaseResult getData(ReqCloudFileRole reqCloudFileRole) {
        try {
            reqCloudFileRole.setUserId(StpUtil.getLoginIdAsInt());
            CloudFileRole cloudFileRole = iCloudFileRoleService.getData(reqCloudFileRole);
            if(null!=cloudFileRole){
                return success("获取数据成功",cloudFileRole);
            }else{
                return error(400, "暂无权限！");
            }
        } catch (Exception e) {
            return error(500, "发生错误:" + e.getMessage());
        }
    }


}
