package com.younike.server.controller;

import com.younike.common.annotation.Log;
import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.common.core.page.TableDataInfo;
import com.younike.common.enums.BusinessType;
import com.younike.common.utils.StringUtils;
import com.younike.common.utils.poi.ExcelUtil;
import com.younike.framework.config.AnonymousAccess;
import com.younike.system.domain.Category;
import com.younike.system.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 分类Controller
 *
 * @author elev
 * @date 2022-01-05
 */
@Api("分类接口")
@RestController
@RequestMapping("/server/category")
public class ServerCategoryController extends BaseController {
    @Autowired
    private ICategoryService categoryService;

    /**
     * 获取首页商品分类数据
     *
     * @return 首页商品分类数据
     */
    @AnonymousAccess
    @GetMapping("/categoriesList")
    public AjaxResult getCategoriesList(@RequestParam("bizType") Integer bizType) {
        //业务类型不能为空
        if(!StringUtils.isNotNull(bizType)){
            return AjaxResult.error("参数错误(业务类型不能为空)");
        }
        return categoryService.selectCategoriesListServer(bizType);
    }

}

