package com.tashow.cloud.user.service.user;

import com.tashow.cloud.user.dal.dataobject.user.UserMemberLevelDO;
import com.tashow.cloud.user.dal.mysql.user.UserMemberLevelMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 会员等级 Service 实现类
 *
 * @author 芋道源码
 */
@Service
@Validated
public class UserMemberLevelServiceImpl implements UserMemberLevelService {

    @Resource
    private UserMemberLevelMapper memberLevelMapper;


    @Override
    public void deleteMemberLevel(Long id) {
        // 校验存在
        validateMemberLevelExists(id);
        // 删除
        memberLevelMapper.deleteById(id);
    }

    private void validateMemberLevelExists(Long id) {
        if (memberLevelMapper.selectById(id) == null) {
//            throw exception(MEMBER_LEVEL_NOT_EXISTS);
        }
    }

    @Override
    public UserMemberLevelDO getMemberLevel(Long id) {
        return memberLevelMapper.selectById(id);
    }

}