package com.pnkx.service.impl;

import com.pnkx.domain.po.PxSubscribe;
import com.pnkx.mapper.PxSubscribeMapper;
import com.pnkx.service.IPxSubscribeService;
import com.pnkx.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author by PHY
 * @Classname PxAdminSubscribeServiceImpl
 * @date 2021-06-17 15:34
 */
@Service
public class PxSubscribeServiceImpl implements IPxSubscribeService {

    @Resource
    private PxSubscribeMapper pxSubscribeMapper;

    /**
     * 查询订阅
     *
     * @param id 订阅ID
     * @return 订阅
     */
    @Override
    public PxSubscribe selectPxSubscribeById(Long id) {
        return pxSubscribeMapper.selectPxSubscribeById(id);
    }

    /**
     * 查询订阅列表
     *
     * @param pxSubscribe 订阅
     * @return 订阅
     */
    @Override
    public List<PxSubscribe> selectPxSubscribeList(PxSubscribe pxSubscribe) {
        return pxSubscribeMapper.selectPxSubscribeList(pxSubscribe);
    }

    /**
     * 新增订阅
     *
     * @param pxSubscribe 订阅
     * @return 结果
     */
    @Override
    public int insertPxSubscribe(PxSubscribe pxSubscribe) {
        pxSubscribe.setCreateTime(DateUtils.getNowDate());
        return pxSubscribeMapper.insertPxSubscribe(pxSubscribe);
    }

    /**
     * 修改订阅
     *
     * @param pxSubscribe 订阅
     * @return 结果
     */
    @Override
    public int updatePxSubscribe(PxSubscribe pxSubscribe) {
        pxSubscribe.setUpdateTime(DateUtils.getNowDate());
        return pxSubscribeMapper.updatePxSubscribe(pxSubscribe);
    }

    /**
     * 批量删除订阅
     *
     * @param ids 需要删除的订阅ID
     * @return 结果
     */
    @Override
    public int deletePxSubscribeByIds(Long[] ids) {
        return pxSubscribeMapper.deletePxSubscribeByIds(ids);
    }

    /**
     * 删除订阅信息
     *
     * @param id 订阅ID
     * @return 结果
     */
    @Override
    public int deletePxSubscribeById(Long id) {
        return pxSubscribeMapper.deletePxSubscribeById(id);
    }
}
