package com.seer.teach.mall.app.good.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.DecryptionAnnotation;
import com.seer.teach.common.annotation.EncryptionAnnotation;
import com.seer.teach.mall.response.CategoryResp;
import com.seer.teach.mall.service.ICategoryService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/app/user/category")
@RestController
@Tag(name = "APP - 商品类型")
@Validated
@EncryptionAnnotation
@DecryptionAnnotation
@RequiredArgsConstructor
public class AppCategoryController {

    private final ICategoryService categoryService;

    /**
     * 查詢
     */
    @Operation(summary = "查詢")
    @GetMapping("/{limit}")
    @SaCheckPermission("app:category:list")
    public ResultBean<PageListBean<CategoryResp>> list(
            @Parameter(description = "显示的条数") @PathVariable("limit") Integer limit) {
        return ResultBean.success(categoryService.queryPageList(1, limit,1,1));
    }
}