package com.yc.wms.controller;


import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yc.wms.bean.Liaoxiangjiankong;
import com.yc.wms.until.QueryPageUtil;
import com.yc.wms.until.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/dcx")
public class LiaoxiangjiankongController {
    @Autowired
    private com.yc.wms.service.Liaoxiangjiankong dcx;


    @PostMapping("/querydcx")
    public Result queryUser(@RequestBody String  json) {

        QueryPageUtil query =new QueryPageUtil();
        JSONObject jsonObject= JSONUtil.parseObj(json);
        query.setPageSize((int)jsonObject.get("pageSize"));
        query.setPageNum((int)jsonObject.get("pageNum"));

        JSONObject param= (JSONObject)jsonObject.get("param");

        Liaoxiangjiankong d = JSONUtil.toBean(param.toString(), Liaoxiangjiankong.class);

        return dcx.QueryJson(query,d);
    }

    @PostMapping ("/type")
    public Result Type() {
        return dcx.Type();
    }

}
