package com.fjhx.controller.data;

import com.alibaba.fastjson.JSONObject;
import com.fjhx.base.Condition;
import com.fjhx.service.data.DataPackerService;
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;

/**
 * <p>
 * 包装机数据 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-12-19
 */
@RestController
@RequestMapping("/dataPacker")
public class DataPackerController {

    @Autowired
    private DataPackerService dataPackerService;

    @PostMapping("/add")
    public R add(@RequestBody JSONObject json) {
        boolean flag = dataPackerService.add(json);
        return R.success(flag);
    }

    @PostMapping("/getData")
    public R getData(@RequestBody Condition condition) {
        JSONObject result = dataPackerService.getData(condition);
        return R.success(result);
    }

}

