package com.ruoyi.business.service.impl;

import java.util.List;

import cn.hutool.core.date.DateTime;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TbUserMemberMapper;
import com.ruoyi.business.domain.TbUserMember;
import com.ruoyi.business.service.ITbUserMemberService;
import com.ruoyi.common.core.text.Convert;

/**
 * 我的套餐
Service业务层处理
 * 
 * @author xiatao
 * @date 2022-01-18
 */
@Service
public class TbUserMemberServiceImpl implements ITbUserMemberService 
{
    @Autowired
    private TbUserMemberMapper tbUserMemberMapper;

    /**
     * 查询我的套餐

     * 
     * @param userMemId 我的套餐
主键
     * @return 我的套餐

     */
    @Override
    public TbUserMember selectTbUserMemberByUserMemId(Long userMemId)
    {
        return tbUserMemberMapper.selectTbUserMemberByUserMemId(userMemId);
    }

    /**
     * 查询我的套餐
列表
     * 
     * @param tbUserMember 我的套餐

     * @return 我的套餐

     */
    @Override
    public List<TbUserMember> selectTbUserMemberList(TbUserMember tbUserMember)
    {
        return tbUserMemberMapper.selectTbUserMemberList(tbUserMember);
    }

    /**
     * 新增我的套餐

     * 
     * @param tbUserMember 我的套餐

     * @return 结果
     */
    @Override
    public int insertTbUserMember(TbUserMember tbUserMember)
    {
        tbUserMember.setCreateTime(DateUtils.getNowDate());
        return tbUserMemberMapper.insertTbUserMember(tbUserMember);
    }

    /**
     * 修改我的套餐

     * 
     * @param tbUserMember 我的套餐

     * @return 结果
     */
    @Override
    public int updateTbUserMember(TbUserMember tbUserMember)
    {
        tbUserMember.setUpdateTime(DateUtils.getNowDate());
        return tbUserMemberMapper.updateTbUserMember(tbUserMember);
    }

    /**
     * 批量删除我的套餐

     * 
     * @param userMemIds 需要删除的我的套餐
主键
     * @return 结果
     */
    @Override
    public int deleteTbUserMemberByUserMemIds(String userMemIds)
    {
        return tbUserMemberMapper.deleteTbUserMemberByUserMemIds(Convert.toStrArray(userMemIds));
    }

    /**
     * 删除我的套餐
信息
     * 
     * @param userMemId 我的套餐
主键
     * @return 结果
     */
    @Override
    public int deleteTbUserMemberByUserMemId(Long userMemId)
    {
        return tbUserMemberMapper.deleteTbUserMemberByUserMemId(userMemId);
    }

    @Override
    public int selectCount(DateTime yestoday, DateTime today) {
        return tbUserMemberMapper.selectCount(yestoday, today);
    }
}
