package com.fdkankan.platform.agent.controller.manager;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.platform.agent.entity.AgentAudit;
import com.fdkankan.platform.agent.request.RequestNote;
import com.fdkankan.platform.agent.request.RequestSearch;
import com.fdkankan.platform.agent.service.IAgentAuditService;
import com.fdkankan.platform.agent.vo.AgentAuditVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 经销商申请模块
 */
@RestController
@RequestMapping("/service/platform/manager/agentAudit")
public class ManagerAgentAuditController {

    @Autowired
    private IAgentAuditService agentAuditService;
    /**
     * 获取申请经销商列表
     */
    @GetMapping("/list")
    public Page<AgentAudit> list(@RequestParam(value="pageNum", defaultValue="1", required = false) Integer pageNum,
                                 @RequestParam(value="pageSize", defaultValue="10", required = false) Integer pageSize){
        return agentAuditService.getPageList(pageNum,pageSize);
    }

    /**
     * 更新状态
     */
    @GetMapping("/update/active/{id}/{state}")
    private String updateActive(@PathVariable("id") Long id, @PathVariable("state") String state){
        return agentAuditService.updateStatus(id,state);
    }

    /**
     * 更新备注信息
     */
    @PostMapping("/update/note")
    private String updateNote(@RequestBody RequestNote param){
        return agentAuditService.updateNote(param);
    }

    /**
     * 搜索查询
     */
    @PostMapping("/search")
    private Page<AgentAuditVo> search(@RequestBody RequestSearch param){
        return agentAuditService.searchLike(param);
    }
}
