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.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.rocketmq.domain.RmPppoeConfigMain;
import com.tongran.rocketmq.service.IRmPppoeConfigMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * PPPoE配置主表Controller
 * 
 * @author tongran
 * @date 2025-12-29
 */
@RestController
@RequestMapping("/rmPppoeConfigMain")
@RequiresPermissions("system:registration")
public class RmPppoeConfigMainController extends BaseController
{
    @Autowired
    private IRmPppoeConfigMainService rmPppoeConfigMainService;


    /**
     * 获取PPPoE配置主表详细信息
     */
    @PostMapping("/getPppoeConfigMsg")
    public AjaxResult getInfo(@RequestBody RmPppoeConfigMain rmPppoeConfigMain)
    {
        return success(rmPppoeConfigMainService.selectRmPppoeConfigMainByClientId(rmPppoeConfigMain));
    }

    /**
     * 新增PPPoE配置主表
     */
    @Log(title = "PPPoE配置主表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RmPppoeConfigMain rmPppoeConfigMain)
    {
        return toAjax(rmPppoeConfigMainService.insertRmPppoeConfigMain(rmPppoeConfigMain));
    }

    /**
     * 修改PPPoE配置主表
     */
    @Log(title = "PPPoE配置主表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RmPppoeConfigMain rmPppoeConfigMain)
    {
        return toAjax(rmPppoeConfigMainService.updateRmPppoeConfigMain(rmPppoeConfigMain));
    }

    /**
     * 删除PPPoE配置主表
     */
    @Log(title = "PPPoE配置主表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(rmPppoeConfigMainService.deleteRmPppoeConfigMainByIds(ids));
    }
}
