package com.starry.admin.modules.weichat.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.starry.admin.modules.clerk.module.entity.PlayClerkTypeInfoEntity;
import com.starry.admin.modules.clerk.service.IPlayClerkTypeInfoService;
import com.starry.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 店员等级
 *
 * @author admin
 * @since 2024/5/29 上午6:24
 **/
@Api(tags = "微信店员类型接口", description = "微信端店员类型相关接口")
@Slf4j
@RestController
@RequestMapping("/wx/clerk/type")
public class WxClerkTypeController {

    @Resource
    private IPlayClerkTypeInfoService clerkTypeInfoService;

    /**
     * 顾客查询所有店员所有等级列表
     *
     * @return 店员所有等级列表
     */
    @ApiOperation(value = "查询店员类型列表", notes = "查询所有店员类型列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayClerkTypeInfoEntity.class, responseContainer = "List")})
    @GetMapping("/list")
    public R clerkTypeList() {
        List<PlayClerkTypeInfoEntity> list = clerkTypeInfoService.list(
                Wrappers.lambdaQuery(PlayClerkTypeInfoEntity.class).eq(PlayClerkTypeInfoEntity::getHomeDisplayed, 1)
                        .orderByDesc(PlayClerkTypeInfoEntity::getSort));
        return R.ok(list);
    }

}
