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

import com.starry.admin.common.aspect.CustomUserLogin;
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
import com.starry.admin.modules.weichat.entity.vo.PlayCustomLevelInfoReturnVo;
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.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author admin
 */
@Api(tags = "微信等级接口", description = "微信端用户等级相关接口")
@Slf4j
@RestController
@RequestMapping("/wx/level/")
public class WxLevelController {

    @Resource
    private IPlayCustomLevelInfoService levelInfoService;

    /**
     * 顾客查询登记列表
     */
    @ApiOperation(value = "查询等级列表", notes = "查询所有顾客等级列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayCustomLevelInfoReturnVo.class, responseContainer = "List")})
    @CustomUserLogin
    @GetMapping("/custom/queryAll")
    public R queryById() {
        List<PlayCustomLevelInfoEntity> list = levelInfoService.selectAll();
        List<PlayCustomLevelInfoReturnVo> result = new ArrayList<>();
        for (PlayCustomLevelInfoEntity entity : list) {
            PlayCustomLevelInfoReturnVo vo = new PlayCustomLevelInfoReturnVo();
            BeanUtils.copyProperties(entity, vo);
            result.add(vo);
        }
        return R.ok(result);
    }

}
