package com.yc.wms.controller;


import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yc.wms.bean.Modeldcx;
import com.yc.wms.service.Zwdcx;
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 dcxController {
    @Autowired
    private Zwdcx 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");

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

        return dcx.QueryJson(query,d);
    }

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

}
