package com.diaoyun.zion.chinafrica.controller;

import com.diaoyun.zion.chinafrica.service.TbCfExpCatRelService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
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.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 快递模板与商品种类关联表Controller
 *
 * @author lipengjun
 * @date 2019-08-30 09:47:20
 */
//@Api
@RestController
@RequestMapping("expcatrel")
@Deprecated
public class TbCfExpCatRelController {
    @Autowired
    private TbCfExpCatRelService tbCfExpCatRelService;

    @ApiOperation("关联运费模板和商品种类")
    @PostMapping("/buildRelate")

    public Result buildRelate(@ApiParam("包含分类id数组和模板id") @RequestBody Map<String,Object> param) {
        List<String> categoryIdArray= (List<String>) param.get("categoryIds");
        String tempalteId= (String) param.get("tempalteId");
        String[] categoryIds=categoryIdArray.toArray(new String[categoryIdArray.size()]);
        Result result=tbCfExpCatRelService.buildRelate(tempalteId, categoryIds);
        return result;
    }


}
