package com.om.controller.admin;


import com.om.entity.dto.ClientDTO;
import com.om.entity.dto.ClientQueryPageDTO;
import com.om.entity.vo.ClientQueryPageVO;
import com.om.entity.vo.ClientVO;
import com.om.service.IClientService;
import com.om.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bmmx
 * @since 2024-02-15
 */
@RestController
@Api(tags = "客户端相关模块")
@RequestMapping("/web/client")
public class ClientController {
    @Resource
    private IClientService clientService;


    @ApiOperation("新增客户端信息接口")
    @PostMapping("add")
    public Result addClient(@RequestBody ClientDTO dto){
        return clientService.addClient(dto);
    }

    @ApiOperation("编辑客户端信息接口")
    @PostMapping("edit")
    public Result editClient(@RequestBody ClientDTO dto){
        return clientService.editClient(dto);
    }

    @ApiOperation("根据id删除客户端信息接口")
    @GetMapping("delete")
    public Result deleteClient(@RequestParam Integer id){
        return clientService.deleteClient(id);
    }


    @ApiOperation("根据id查询客户端信息接口")
    @GetMapping("getById")
    public Result<ClientVO> getClient(@RequestParam Integer id){
        return clientService.getClient(id);
    }

    @ApiOperation("查询客户端信息集合接口")
    @GetMapping("getList")
    public Result<List<ClientVO>> getList(){
        return clientService.getList();
    }

    @ApiOperation("分页查询客户端信息")
    @PostMapping("getPageList")
    public Result<ClientQueryPageVO> queryPageClient(@RequestBody ClientQueryPageDTO dto){
        return clientService.queryPageClient(dto);
    }
}
