| | |
| | | package com.example.jz.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.AnnouncementDao; |
| | | import com.example.jz.dao.GroupDao; |
| | | import com.example.jz.dao.MessageDao; |
| | | import com.example.jz.modle.entity.Announcement; |
| | | import com.example.jz.modle.entity.Group; |
| | | import com.example.jz.modle.entity.Message; |
| | | import com.example.jz.modle.vo.GroupMessageVo; |
| | | import com.example.jz.modle.vo.GroupUserVo; |
| | | import com.example.jz.service.GroupService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 群表 |
| | | (Group)表服务实现类 |
| | | * (Group)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2022-07-11 16:35:57 |
| | | */ |
| | | @Service("groupService") |
| | | public class GroupServiceImpl extends ServiceImpl<GroupDao, Group> implements GroupService { |
| | | private MessageDao messageDao; |
| | | private AnnouncementDao announcementDao; |
| | | private GroupDao groupDao; |
| | | |
| | | @Autowired |
| | | public void setMessageDao(MessageDao messageDao) { |
| | | this.messageDao = messageDao; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setAnnouncementDao(AnnouncementDao announcementDao) { |
| | | this.announcementDao = announcementDao; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setGroupDao(GroupDao groupDao) { |
| | | this.groupDao = groupDao; |
| | | } |
| | | |
| | | @Override |
| | | public List<GroupMessageVo> getAllMessage(Integer id) { |
| | | return messageDao.getAllMessageByGroup(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<Announcement> getAllNotice(Integer id) { |
| | | return announcementDao.selectList(new LambdaQueryWrapper<>(Announcement.class).eq(Announcement::getGroupId, id)); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean sendMessage(Integer id, String text) { |
| | | // todo 动态获取当前登录用户的id |
| | | Message message = new Message().setUserId(1).setText(text).setGroupId(id).setCtime(new Date()); |
| | | return messageDao.insert(message) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<GroupUserVo> getAllUser(Integer id) { |
| | | return groupDao.getAllUser(id); |
| | | } |
| | | } |