package com.muyu.system.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.common.system.domain.SysFirm;
import com.muyu.common.system.domain.SysMember;
import com.muyu.system.service.SysMemberService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
/**
会员等级
 */
@RestController
@RequestMapping("/member")
public class SysMemberController {
    @Resource
    private SysMemberService service;
    @Resource
    private SysFirmController firmController;

    /**
     * 查询会员等级列表
     */
    @GetMapping("/list")
    public Result<List<SysMember>> selectList(SysMember member) {
        return Result.success(service.selectSysMemberList(member));
    }

    @GetMapping("/memberId/{firmCode}")
    public Result<SysMember> selectSysMemberListById(@PathVariable("firmCode") String firmCode) {
        Result<SysFirm> info = firmController.getInfo(firmCode);
        SysFirm sysFirm = info.getData();
        return Result.success(service.selectSysMemberListById(sysFirm.getMemberId()));
    }
}
