package com.sf.system.service.impl;

import java.util.List;
import com.sf.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sf.system.mapper.UserMemberMapper;
import com.sf.system.domain.UserMember;
import com.sf.system.service.IUserMemberService;

/**
 * 会员Service业务层处理
 * 
 * @author ztzh
 * @date 2024-04-16
 */
@Service
public class UserMemberServiceImpl implements IUserMemberService 
{
    @Autowired
    private UserMemberMapper userMemberMapper;

    /**
     * 查询会员
     * 
     * @param id 会员主键
     * @return 会员
     */
    @Override
    public UserMember selectUserMemberById(Long id)
    {
        return userMemberMapper.selectUserMemberById(id);
    }

    /**
     * 查询会员列表
     * 
     * @param userMember 会员
     * @return 会员
     */
    @Override
    public List<UserMember> selectUserMemberList(UserMember userMember)
    {
        return userMemberMapper.selectUserMemberList(userMember);
    }

    /**
     * 新增会员
     * 
     * @param userMember 会员
     * @return 结果
     */
    @Override
    public int insertUserMember(UserMember userMember)
    {
        userMember.setCreateTime(DateUtils.getNowDate());
        return userMemberMapper.insertUserMember(userMember);
    }

    /**
     * 修改会员
     * 
     * @param userMember 会员
     * @return 结果
     */
    @Override
    public int updateUserMember(UserMember userMember)
    {
        userMember.setUpdateTime(DateUtils.getNowDate());
        return userMemberMapper.updateUserMember(userMember);
    }

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

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

    @Override
    public UserMember selectUserMemberByUserId(Long userId) {
        return userMemberMapper.selectUserMemberByUserId(userId);
    }
}
