package com.dgtly.goods.controller;

import com.dgtly.common.annotation.ApiNoCheckSign;
import com.dgtly.common.annotation.ApiPassToken;
import com.dgtly.common.core.controller.ApiBaseController;
import com.dgtly.common.core.domain.AjaxResult;
import com.dgtly.common.core.domain.ParameterObject;
import com.dgtly.common.core.domain.Ztree;
import com.dgtly.goods.service.IGoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/goods/type")
@ApiPassToken/* 不用验证token  方法上可用*/
@ApiNoCheckSign/* 不用验证 签名 方法上可用*/
public class GoodsTypeController extends ApiBaseController {

    @Autowired
    private IGoodsTypeService goodsTypeService;

    @PostMapping("/treeData")
    public Object getTreeData(){
        ParameterObject obj =  getParameterObject();
        //obj.checkParameterNotNull("name,id,type");/*检测参数中是否包含所需参数，如若缺少直接会返回缺少参数返回值*/
        List<Ztree> list=  goodsTypeService.selectGoodsTypeTree(null);
        return AjaxResult.success().putKV("tree",list);

    }
}
