package com.yc.wms.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yc.wms.bean.Rukuzhengli;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/Rukuzhengli")
public class RukuzhengliController {

        @Autowired
        private com.yc.wms.service.Rukuzhengli dcxService;


        /**
         * @return
         * @param查询用户
         */
        @PostMapping("/queryUser")
        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");

           Rukuzhengli rukuzhengli = JSONUtil.toBean(param.toString(), Rukuzhengli.class);

            return dcxService.readJson(query, rukuzhengli);
        }

        //下拉列表工厂
        @PostMapping("/Plant")
        public Result Plant(){
            return dcxService.Plant();
        }

        //下拉列表LOC
        @PostMapping("/LOC")
        public Result LOC(){
            return dcxService.LOC();
        }

}
