package com.yc.ship.module.miniapplet.controller.app.menu;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.miniapplet.controller.admin.menu.vo.AppletMenuRespVO;
import com.yc.ship.module.miniapplet.dal.dataobject.menu.AppletMenuDO;
import com.yc.ship.module.miniapplet.service.menu.AppletMenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

import static com.yc.ship.framework.common.pojo.CommonResult.success;


@Tag(name = "用户 APP - 小程序菜单")
@RestController
@RequestMapping("/applet/menu")
@Validated
public class AppAppletMenuController {

    @Resource
    private AppletMenuService menuService;


    // 获取菜单列表
    @GetMapping("/list")
    @Operation(summary = "获取菜单列表")
    public CommonResult<List<AppletMenuRespVO>> getAppMenuList() {
        List<AppletMenuDO> list = menuService.getAppMenuList();
        return success(BeanUtils.toBean(list, AppletMenuRespVO.class));
    }





}