package com.ics.admin.service.impl.meeting;

import java.util.List;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ics.admin.mapper.meeting.StaffOpenMapper;
import com.ics.admin.domain.meeting.StaffOpen;
import com.ics.admin.service.meeting.IStaffOpenService;

/**
 * 用户和小程序关联Service业务层处理
 * 
 * @author ics
 * @date 2024-06-25
 */
@Service
public class StaffOpenServiceImpl extends ServiceImpl<StaffOpenMapper, StaffOpen> implements IStaffOpenService {
    @Autowired
    private StaffOpenMapper staffOpenMapper;

    /**
     * 查询用户和小程序关联
     * 
     * @param id 用户和小程序关联ID
     * @return 用户和小程序关联
     */
    @Override
    public StaffOpen selectStaffOpenById(Long id) {
        return staffOpenMapper.selectById(id);
    }

    /**
     * 查询用户和小程序关联列表
     * 
     * @param staffOpen 用户和小程序关联
     * @return 用户和小程序关联
     */
    @Override
    public List<StaffOpen> selectStaffOpenList(StaffOpen staffOpen) {
        QueryWrapper queryWrapper = new QueryWrapper();
        return staffOpenMapper.selectList(queryWrapper);
    }

    /**
     * 新增用户和小程序关联
     * 
     * @param staffOpen 用户和小程序关联
     * @return 结果
     */
    @Override
    public int insertStaffOpen(StaffOpen staffOpen) {
        return staffOpenMapper.insert(staffOpen);
    }

    /**
     * 修改用户和小程序关联
     * 
     * @param staffOpen 用户和小程序关联
     * @return 结果
     */
    @Override
    public int updateStaffOpen(StaffOpen staffOpen) {
        return staffOpenMapper.updateById(staffOpen);
    }

    /**
     * 删除用户和小程序关联对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStaffOpenByIds(String ids) {
        String[] idsArray = StrUtil.split(ids,",");
        return staffOpenMapper.deleteBatchIds(CollUtil.toList(idsArray));
    }

    /**
     * 删除用户和小程序关联信息
     * 
     * @param id 用户和小程序关联ID
     * @return 结果
     */
    @Override
    public int deleteStaffOpenById(Long id) {
        return staffOpenMapper.deleteStaffOpenById(id);
    }

    @Override
    public StaffOpen selectStaffOpenByOpenId(String openid) {

        return staffOpenMapper.selectStaffOpenByOpenId(openid);
    }



    @Override
    public StaffOpen selectStaffOpenByStaffIdAndOpenId(Long id, String openId) {
        return staffOpenMapper.selectStaffOpenByStaffIdAndOpenId(id,openId);
    }


}
