package com.fjhx.controller.v3;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.params.v3.V3PlanStatisticsEx;
import org.springblade.core.tool.api.R;
import com.fjhx.service.v3.V3PlanStatisticsService;
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-10-31
 */
@RestController
@RequestMapping("/v3PlanStatistics")
public class V3PlanStatisticsController {

    @Autowired
    private V3PlanStatisticsService v3PlanStatisticsService;

    /**
     * 面料使用率用户统计
     */
    @PostMapping("/userStatistics")
    public R userStatistics(@RequestBody Condition condition) {
        Map<String, JSONObject> result = v3PlanStatisticsService.userStatistics(condition);
        return R.success(result);
    }

    /**
     * 面料使用率统计
     */
    @PostMapping("/statisticsDetails")
    public R statisticsDetails(@RequestBody Condition condition) {
        V3PlanStatisticsEx result = v3PlanStatisticsService.statisticsDetails(condition);
        return R.success(result);
    }

    /**
     * 面料使用率分页
     */
    @PostMapping("/statisticsPage")
    public R statisticsPage(@RequestBody Condition condition){
        Page<V3PlanStatisticsEx> result = v3PlanStatisticsService.statisticsPage(condition);
        return R.success(result);
    }



}

