package com.dgtly.member.service.impl;

import java.util.List;
import com.dgtly.common.utils.DateUtils;
import com.dgtly.member.service.IMemberInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dgtly.member.mapper.MemberInfoMapper;
import com.dgtly.member.domain.MemberInfo;
import com.dgtly.common.core.text.Convert;

import javax.annotation.Resource;
/**
 * 会员信息Service业务层处理
 * 
 * @author dgtly
 * @date 2020-02-13
 */
@Service
public class MemberInfoServiceImpl implements IMemberInfoService
{
    @Autowired
    private MemberInfoMapper memberInfoMapper;

    /**
     * 查询会员信息
     * 
     * @param id 会员信息ID
     * @return 会员信息
     */
    @Override
    public MemberInfo selectMemberInfoById(Long id)
    {
        return memberInfoMapper.selectMemberInfoById(id);
    }

    /**
     * 查询会员信息列表
     * 
     * @param memberInfo 会员信息
     * @return 会员信息
     */
    @Override
    public List<MemberInfo> selectMemberInfoList(MemberInfo memberInfo)
    {
        return memberInfoMapper.selectMemberInfoList(memberInfo);
    }

    /**
     * 新增会员信息
     * 
     * @param memberInfo 会员信息
     * @return 结果
     */
    @Override
    public int insertMemberInfo(MemberInfo memberInfo)
    {
        memberInfo.setCreateTime(DateUtils.getNowDate());
        return memberInfoMapper.insertMemberInfo(memberInfo);
    }

    /**
     * 修改会员信息
     * 
     * @param memberInfo 会员信息
     * @return 结果
     */
    @Override
    public int updateMemberInfo(MemberInfo memberInfo)
    {
        memberInfo.setUpdateTime(DateUtils.getNowDate());
        return memberInfoMapper.updateMemberInfo(memberInfo);
    }

    /**
     * 删除会员信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberInfoByIds(String ids)
    {
        return memberInfoMapper.deleteMemberInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除会员信息信息
     * 
     * @param id 会员信息ID
     * @return 结果
     */
    @Override
    public int deleteMemberInfoById(Long id)
    {
        return memberInfoMapper.deleteMemberInfoById(id);
    }


    @Override
    public MemberInfo checkMemberUnique(String loginAccount) {
        return memberInfoMapper.checkMemberUnique(loginAccount);
    }

    @Override
    public MemberInfo checkMemberPhoneUnique(String phone) {
        return memberInfoMapper.checkMemberPhoneUnique(phone);
    }


    @Override
    public MemberInfo memberLogin(MemberInfo info) {
        return memberInfoMapper.memberLogin(info);
    }

    @Override
    public int countMemberInfo() {
        return memberInfoMapper.countMemberInfo();
    }
}
