package com.srs.staff.service.impl;

import java.util.List;

import com.srs.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.staff.mapper.SrsStaffOneStopCommunityActivitiesMapper;
import com.srs.staff.domain.SrsStaffOneStopCommunityActivities;
import com.srs.staff.service.ISrsStaffOneStopCommunityActivitiesService;

/**
 * 一站式社区模块-社区活动Service业务层处理
 *
 * @author chc
 * @date 2024-07-16
 */
@Service
public class SrsStaffOneStopCommunityActivitiesServiceImpl extends ServiceImpl<SrsStaffOneStopCommunityActivitiesMapper, SrsStaffOneStopCommunityActivities> implements ISrsStaffOneStopCommunityActivitiesService {
    @Autowired
    private SrsStaffOneStopCommunityActivitiesMapper srsStaffOneStopCommunityActivitiesMapper;

    /**
     * 查询一站式社区模块-社区活动
     *
     * @param activityId 一站式社区模块-社区活动主键
     * @return 一站式社区模块-社区活动
     */
    @Override
    public SrsStaffOneStopCommunityActivities selectSrsStaffOneStopCommunityActivitiesByActivityId(Long activityId) {
        return srsStaffOneStopCommunityActivitiesMapper.selectSrsStaffOneStopCommunityActivitiesByActivityId(activityId);
    }

    /**
     * 查询一站式社区模块-社区活动列表
     *
     * @param srsStaffOneStopCommunityActivities 一站式社区模块-社区活动
     * @return 一站式社区模块-社区活动
     */
    @Override
    public List<SrsStaffOneStopCommunityActivities> selectSrsStaffOneStopCommunityActivitiesList(SrsStaffOneStopCommunityActivities srsStaffOneStopCommunityActivities) {
        return srsStaffOneStopCommunityActivitiesMapper.selectSrsStaffOneStopCommunityActivitiesList(srsStaffOneStopCommunityActivities);
    }

    /**
     * 新增一站式社区模块-社区活动
     *
     * @param srsStaffOneStopCommunityActivities 一站式社区模块-社区活动
     * @return 结果
     */
    @Override
    public int insertSrsStaffOneStopCommunityActivities(SrsStaffOneStopCommunityActivities srsStaffOneStopCommunityActivities) {
        if (srsStaffOneStopCommunityActivities.getEventPromoter() == null) {
            srsStaffOneStopCommunityActivities.setEventPromoter(SecurityUtils.getLoginUser().getUser().getNickName());
        }
        return srsStaffOneStopCommunityActivitiesMapper.insertSrsStaffOneStopCommunityActivities(srsStaffOneStopCommunityActivities);
    }

    /**
     * 修改一站式社区模块-社区活动
     *
     * @param srsStaffOneStopCommunityActivities 一站式社区模块-社区活动
     * @return 结果
     */
    @Override
    public int updateSrsStaffOneStopCommunityActivities(SrsStaffOneStopCommunityActivities srsStaffOneStopCommunityActivities) {
        return srsStaffOneStopCommunityActivitiesMapper.updateSrsStaffOneStopCommunityActivities(srsStaffOneStopCommunityActivities);
    }

    /**
     * 批量删除一站式社区模块-社区活动
     *
     * @param activityIds 需要删除的一站式社区模块-社区活动主键
     * @return 结果
     */
    @Override
    public int deleteSrsStaffOneStopCommunityActivitiesByActivityIds(Long[] activityIds) {
        return srsStaffOneStopCommunityActivitiesMapper.deleteSrsStaffOneStopCommunityActivitiesByActivityIds(activityIds);
    }

    /**
     * 删除一站式社区模块-社区活动信息
     *
     * @param activityId 一站式社区模块-社区活动主键
     * @return 结果
     */
    @Override
    public int deleteSrsStaffOneStopCommunityActivitiesByActivityId(Long activityId) {
        return srsStaffOneStopCommunityActivitiesMapper.deleteSrsStaffOneStopCommunityActivitiesByActivityId(activityId);
    }
}
