package com.ff.member.service.impl;

import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.member.mapper.MemberMapper;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;

/**
 * 会员Service业务层处理
 *
 * @author shi
 * @date 2025-02-10
 */
@Service
public class MemberServiceImpl implements IMemberService
{
    @Autowired
    private MemberMapper memberMapper;

    /**
     * 查询会员
     *
     * @param id 会员主键
     * @return 会员
     */
    @Override
    public Member selectMemberById(Long id)
    {
        return memberMapper.selectMemberById(id);
    }

    /**
     * 查询会员列表
     *
     * @param member 会员
     * @return 会员
     */
    @Override
    public List<Member> selectMemberList(Member member)
    {
        return memberMapper.selectMemberList(member);
    }

    /**
     * 新增会员
     *
     * @param member 会员
     * @return 结果
     */
    @Override
    public int insertMember(Member member)
    {
        member.setCreateTime(DateUtils.getNowDate());
        return memberMapper.insertMember(member);
    }

    /**
     * 修改会员
     *
     * @param member 会员
     * @return 结果
     */
    @Override
    public int updateMember(Member member)
    {
        member.setUpdateTime(DateUtils.getNowDate());
        return memberMapper.updateMember(member);
    }

    /**
     * 批量删除会员
     *
     * @param ids 需要删除的会员主键
     * @return 结果
     */
    @Override
    public int deleteMemberByIds(Long[] ids)
    {
        return memberMapper.deleteMemberByIds(ids);
    }

    /**
     * 删除会员信息
     *
     * @param id 会员主键
     * @return 结果
     */
    @Override
    public int deleteMemberById(Long id)
    {
        return memberMapper.deleteMemberById(id);
    }


    /**
     * 按成员帐户选择成员
     *
     * @param memberAccount 会员帐户
     * @return {@link Member }
     */
    @Override
    public Member selectMemberByMemberAccount(String memberAccount) {
        return memberMapper.selectMemberByMemberAccount(memberAccount);
    }

    /**
     * 按游戏帐户选择成员
     *
     * @param gameAccount 游戏账号
     * @return {@link Member }
     */
    @Override
    public Member selectMemberByGameAccount(String gameAccount) {
        return memberMapper.selectMemberByGameAccount(gameAccount);
    }
}
