package com.dgtly.member.service.impl;

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

import javax.annotation.Resource;

/**
 * 会员关注Service业务层处理
 * 
 * @author dgtly
 * @date 2020-02-13
 */
@Service
public class MemberFollowServiceImpl implements IMemberFollowService
{
    @Autowired
    private MemberFollowMapper memberFollowMapper;

    /**
     * 查询会员关注
     * 
     * @param id 会员关注ID
     * @return 会员关注
     */
    @Override
    public MemberFollow selectMemberFollowById(Long id)
    {
        return memberFollowMapper.selectMemberFollowById(id);
    }

    /**
     * 查询会员关注列表
     * 
     * @param memberFollow 会员关注
     * @return 会员关注
     */
    @Override
    public List<MemberFollow> selectMemberFollowList(MemberFollow memberFollow)
    {
        return memberFollowMapper.selectMemberFollowList(memberFollow);
    }

    /**
     * 新增会员关注
     * 
     * @param memberFollow 会员关注
     * @return 结果
     */
    @Override
    public int insertMemberFollow(MemberFollow memberFollow)
    {
        memberFollow.setCreateTime(DateUtils.getNowDate());
        return memberFollowMapper.insertMemberFollow(memberFollow);
    }

    /**
     * 修改会员关注
     * 
     * @param memberFollow 会员关注
     * @return 结果
     */
    @Override
    public int updateMemberFollow(MemberFollow memberFollow)
    {
        memberFollow.setUpdateTime(DateUtils.getNowDate());
        return memberFollowMapper.updateMemberFollow(memberFollow);
    }

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

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

    @Override
    public List<MemberFollow> getMemberFollowList(MemberFollow memberFollow) {
        return memberFollowMapper.getMemberFollowList(memberFollow);
    }

    /**
     * @descption: 根据公司ID和 用户id取消关注
     * @param:
     * @return:
     * @auther: qxp
     * @date: 2020/3/3 16:46
     */
    @Override
    public int deleteMemberFollowByCompanyMemberId(String memberId, String companyId) {
        return memberFollowMapper.deleteMemberFollowByCompanyMemberId(memberId,companyId);
    }
}
