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


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.system.entity.cloud.role.CloudRole;
import com.zxdmy.excite.system.entity.cloud.space.CloudFile;
import com.zxdmy.excite.system.entity.req.space.ReqCloudFile;
import com.zxdmy.excite.system.entity.vo.space.CloudFileVo;
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleService;
import com.zxdmy.excite.system.service.cloud.role.ICloudRoleUserService;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

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


    private ICloudFileService iCloudFileService;
    private ICloudRoleUserService iCloudRoleUserService;
    private ICloudRoleService iCloudRoleService;
    @RequestMapping("index")
    public String index() {
        return "cloud/my/index";
    }


    @GetMapping("/list")
    @ResponseBody
    public BaseResult getPageList(Integer page, Integer limit, ReqCloudFile data) {
        try {
            data.setCreatorId(StpUtil.getLoginIdAsInt());
            data.setFileFolder(1);
            PageList<CloudFileVo> dataPage = iCloudFileService.queryByPage(page, limit, data);
            return success("获取数据成功", dataPage.getList(), (int) dataPage.getTotal());
        } catch (Exception e) {
            return error(500, "发生错误:" + e.getMessage());
        }
    }



}
