package com.fjhx.controller.contract;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.service.contract.ContractDetailsService;
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-09-19
 */
@RestController
@RequestMapping("/contractDetails")
public class ContractDetailsController {

    @Autowired
    private ContractDetailsService contractDetailsService;

    /**
     * 入库分页记录
     */
    @PostMapping("/inPage")
    public R inPage(@RequestBody Condition condition) {
        Page<Map<String, Object>> result = contractDetailsService.getInPage(condition);
        return R.success(result);
    }

    /**
     * 出库统计
     */
    @PostMapping("/outStatistics")
    public R outStatistics(@RequestBody Condition condition) {
        Map<String, Object> result = contractDetailsService.outStatistics(condition);
        return R.success(result);
    }

    /**
     * 出库分页记录
     */
    @PostMapping("/outPage")
    public R outPage(@RequestBody Condition condition) {
        Page<Map<String, Object>> result = contractDetailsService.getOutPage(condition);
        return R.success(result);
    }

    /**
     * 出库件数
     */
    @PostMapping("/outCount")
    public R outCount(@RequestBody Condition condition) {
        List<Map<String, Object>> result = contractDetailsService.getOutCount(condition);
        return R.success(result);
    }

}
