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

import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
import com.starry.admin.modules.weichat.entity.level.PlayClerkLevelReturnVo;
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.ArrayList;
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/level/")
public class WxClerkLeveController {

    @Resource
    private IPlayClerkLevelInfoService playClerkLevelInfoService;

    /**
     * 顾客查询所有店员所有等级列表
     *
     * @return 店员所有等级列表
     */
    @ApiOperation(value = "查询店员等级列表", notes = "顾客查询所有店员等级列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayClerkLevelReturnVo.class, responseContainer = "List")})
    @GetMapping("/custom/queryClerkAllLevel")
    public R customQueryClerkAllLevel() {
        List<PlayClerkLevelInfoEntity> list = playClerkLevelInfoService.selectAll();
        List<PlayClerkLevelReturnVo> returnVoList = new ArrayList<>(list.size());
        for (PlayClerkLevelInfoEntity entity : list) {
            PlayClerkLevelReturnVo vo = new PlayClerkLevelReturnVo();
            vo.setId(entity.getId());
            vo.setLevelName(entity.getName());
            returnVoList.add(vo);
        }
        return R.ok(returnVoList);
    }

}
