package com.sunda.spmsweb.overseacontroller;


import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsoversea.dto.ZPosReadCostQueryDTO;
import com.sunda.spmsoversea.service.IZPosReadCostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 成本中心移动类型 前端控制器
 * </p>
 *
 * @author Hzc
 * @since 2022-12-07
 */
@RestController
@Slf4j
@RequestMapping("/zPosReadCost")
@Api(tags = "成本中心移动类型", description = "成本中心移动类型")
public class ZPosReadCostController {


    @Autowired
    IZPosReadCostService zPosReadCostService;

    @RequestMapping("/getZPosReadCostPage")
    @ApiOperation(value = "成本中心移动类型分页", notes = "成本中心移动类型分页\n" +
            "示例参数：\n" +
            "{\n" +
            "\t\"current\": 1,\n" +
            "\t\"size\": 20,\n" +
            "\t\"werks\": \"\",\n" +
            "\t\"kostl\": \"\"\n" +
            "}", httpMethod = "POST")
    public ResponseResult getZPosReadCostPage(@RequestBody ZPosReadCostQueryDTO dto){
        try {
            return ResponseResult.success().add("zPosReadCostList", zPosReadCostService.getZPosReadCostPage(dto));
        }catch (Exception e){
            log.error("getOverseaWerksCostPage-请求数据失败:"+e.getMessage());
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/getZPosReadCost")
    @ApiOperation(value = "成本中心移动类型去重不分页", notes = "成本中心移动类型去重不分页\n" +
            "示例参数：\n" +
            "{\n" +
            "\t\"werks\": \"\",\n" +
            "\t\"kostl\": \"\"\n" +
            "}", httpMethod = "POST")
    public ResponseResult getZPosReadCost(@RequestBody ZPosReadCostQueryDTO dto){
        try {
            return ResponseResult.success().add("zPosReadCostList", zPosReadCostService.getZPosReadCost(dto));
        }catch (Exception e){
            log.error("getOverseaWerksCostPage-请求数据失败:"+e.getMessage());
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

}
