package com.fjhx.apply.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.apply.service.ApplyPurchaseService;
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-08-04
 */
@RestController
@RequestMapping("/applyPurchase")
public class ApplyPurchaseController {

    @Autowired
    private ApplyPurchaseService applyPurchaseService;

    /**
     * 物料属性统计
     */
    @PostMapping("/technologyTypeStatistics")
    public R technologyTypeStatistics(@RequestBody Map<String, String> condition) {
        Map<String, Map<String, Object>> result = applyPurchaseService.technologyTypeStatistics(condition);
        return R.success(result);
    }

    /**
     * 状态数量统计
     */
    @PostMapping("/numStatistics")
    public R numStatistics(@RequestBody Map<String, String> condition) {
        List<Map<String, Object>> result = applyPurchaseService.numStatistics(condition);
        return R.success(result);
    }

    /**
     * 合计数量统计
     */
    @PostMapping("/totalNumStatistics")
    public R totalNumStatistics(@RequestBody Map<String, String> condition) {
        Map<String, Object> result = applyPurchaseService.totalNumStatistics(condition);
        return R.success(result);
    }

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

}

