package com.xjrsoft.module.system.service.impl;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.toolkit.MPJWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.system.entity.Menu;
import com.xjrsoft.module.system.entity.Subsystem;
import com.xjrsoft.module.system.entity.SystemUpdateMessageNotice;
import com.xjrsoft.module.system.mapper.SystemUpdateMessageNoticeMapper;
import com.xjrsoft.module.system.service.ISystemUpdateMessageNoticeService;
import com.xjrsoft.module.system.vo.MenuTreeVo;
import com.xjrsoft.module.system.vo.SystemUpdateMessagePageTempVo;
import com.xjrsoft.module.system.vo.SystemUpdateMessagePageVo;
import com.xjrsoft.module.teacher.entity.BaseTeacher;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @title: 系统消息通知表
* @Author brealinxx
* @Date: 2024-04-17
* @Version 1.0
*/
@Service
@AllArgsConstructor
public class SystemUpdateMessageNoticeServiceImpl extends MPJBaseServiceImpl<SystemUpdateMessageNoticeMapper, SystemUpdateMessageNotice> implements ISystemUpdateMessageNoticeService {
    private final SystemUpdateMessageNoticeMapper systemUpdateMessageNoticeMapper;

    @Override
    public String[] getTeacherUserId() {
        List<SystemUpdateMessagePageTempVo> temp = systemUpdateMessageNoticeMapper.GetTeacherUserID();
        String[] teacherIds = temp.stream().map(SystemUpdateMessagePageTempVo::getUserId).toArray(String[]::new);
        return teacherIds;
    }

    @Override
    public String[] getStudentUserId() {
        List<SystemUpdateMessagePageTempVo> temp = systemUpdateMessageNoticeMapper.GetStudentUserID();
        String[] studentTeacherIds = temp.stream().map(SystemUpdateMessagePageTempVo::getUserId).toArray(String[]::new);
        return studentTeacherIds;
    }

    @Override
    public Boolean updateStatus(Long messageId, Long userId) {
        return systemUpdateMessageNoticeMapper.updateStatus(messageId, userId);
    }
}
