package com.fjhx.controller.product;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.product.ProductCombination;
import com.fjhx.params.product.ProductCombinationVo;
import com.fjhx.service.product.ProductCombinationService;
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.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-11-30
 */
@RestController
@RequestMapping("/productCombination")
public class ProductCombinationController {

    @Autowired
    private ProductCombinationService productCombinationService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, Object> condition){
        Page<ProductCombination> result = productCombinationService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody ProductCombinationVo productCombinationVo){
        productCombinationService.add(productCombinationVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody ProductCombinationVo productCombinationVo){
        productCombinationService.edit(productCombinationVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody ProductCombinationVo productCombinationVo){
        productCombinationService.delete(productCombinationVo);
        return R.success();
    }

}

