package com.fjhx.supplier.controller;

import com.fjhx.base.ListPageMap;
import com.fjhx.entity.supplier.SupplierPricechange;
import com.fjhx.supplier.service.SupplierPricechangeService;
import org.springblade.core.tool.api.R;
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.List;
import java.util.Map;

/**
 * <p>
 * 供应商价格变更记录 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-07-14
 */
@RestController
@RequestMapping("/supplierPricechange")
public class SupplierPricechangeController {

    @Autowired
    private SupplierPricechangeService supplierPricechangeService;

    /**
     * 列表
     *
     * @param condition
     * @return
     */
    @PostMapping("/su/list")
    public R list(@RequestBody Map<String, Object> condition) {
        ListPageMap.getListPageMap(condition);
        List<SupplierPricechange> result = supplierPricechangeService.getListBySupplierId(condition);
        return R.success(result);
    }

    /**
     * 列表条数
     *
     * @param condition
     * @return
     */
    @PostMapping("/su/list/count")
    public R listCount(@RequestBody Map<String, Object> condition) {
        ListPageMap.getListPageMap(condition);
        Integer count = supplierPricechangeService.getListCountBySupplierId(condition);
        return R.success(count);
    }
}

