package com.om.controller.admin;


import com.om.entity.dto.BrandDTO;
import com.om.entity.dto.BrandQueryPageDTO;
import com.om.entity.vo.BrandQueryPageVO;
import com.om.entity.vo.BrandVO;
import com.om.service.IBrandService;
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-07
 */
@RestController
@RequestMapping("/web/diagnostic-brand")
@Api(tags = "品牌管理相关接口")
public class BrandController {

    @Resource
    private IBrandService brandService;

    @PostMapping("/create")
    @ApiOperation("新增品牌信息")
    public Result createBrand(@RequestBody BrandDTO dto){
        return brandService.createBrand(dto);
    }


    @GetMapping("/delete")
    @ApiOperation("删除品牌信息")
    public Result deleteBrand(@RequestParam Integer id){
        return brandService.deleteBrand(id);
    }

    @GetMapping("/getById")
    @ApiOperation("根据id品牌信息")
    public Result<BrandVO>  queryById(@RequestParam Integer id){
        return brandService.queryById(id);
    }


    @PostMapping("/update")
    @ApiOperation("修改品牌信息")
    public Result updateBrand(@RequestBody BrandDTO dto){
        return brandService.updateBrand(dto);
    }

    @GetMapping("/getList")
    @ApiOperation("查询品牌信息列表")
    public Result<List<BrandVO>> queryList(){
        return brandService.queryList();
    }


    @PostMapping("/getPageList")
    @ApiOperation("分页查询品牌信息列表")
    public Result<BrandQueryPageVO> queryPageList(@RequestBody BrandQueryPageDTO dto) {
        return brandService.queryPageList(dto);
    }




}
