package com.tongran.rocketmq.controller;

import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.rocketmq.domain.RmResourceRemote;
import com.tongran.rocketmq.service.IRmResourceRemoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 资源远程管理Controller
 * 
 * @author tongran
 * @date 2025-09-15
 */
@RestController
@RequestMapping("/remote")
@RequiresPermissions("rocketmq:remote")
public class RmResourceRemoteController extends BaseController
{
    @Autowired
    private IRmResourceRemoteService rmResourceRemoteService;


    /**
     * 获取资源远程管理详细信息
     */
    @PostMapping(value = "/getScriptResultBySn")
    public AjaxResult getScriptResultBySn(@RequestBody RmResourceRemote rmResourceRemote)
    {
        return success(rmResourceRemoteService.getScriptResultBySn(rmResourceRemote));
    }

    /**
     * 获取资源远程管理详细信息 -- 分页
     */
    @PostMapping(value = "/getScriptResultByScriptId")
    public TableDataInfo getScriptResultByScriptId(@RequestBody RmResourceRemote rmResourceRemote)
    {
        PageDomain pageDomain = new PageDomain();
        pageDomain.setPageNum(rmResourceRemote.getPageNum());
        pageDomain.setPageSize(rmResourceRemote.getPageSize());
        startPage(pageDomain);
        List<RmResourceRemote> list = rmResourceRemoteService.getScriptResultByScriptId(rmResourceRemote);
        return getDataTable(list);
    }


}
