提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.service.notify; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.PageResult; |
|
4 |
import com.iailab.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO; |
|
5 |
import com.iailab.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; |
|
6 |
import com.iailab.module.system.dal.dataobject.notify.NotifyMessageDO; |
|
7 |
import com.iailab.module.system.dal.dataobject.notify.NotifyTemplateDO; |
|
8 |
import com.iailab.module.system.dal.mysql.notify.NotifyMessageMapper; |
|
9 |
import org.springframework.stereotype.Service; |
|
10 |
import org.springframework.validation.annotation.Validated; |
|
11 |
|
|
12 |
import javax.annotation.Resource; |
|
13 |
import java.util.Collection; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
|
|
17 |
/** |
|
18 |
* 站内信 Service 实现类 |
|
19 |
* |
|
20 |
* @author xrcoder |
|
21 |
*/ |
|
22 |
@Service |
|
23 |
@Validated |
|
24 |
public class NotifyMessageServiceImpl implements NotifyMessageService { |
|
25 |
|
|
26 |
@Resource |
|
27 |
private NotifyMessageMapper notifyMessageMapper; |
|
28 |
|
|
29 |
@Override |
|
30 |
public Long createNotifyMessage(Long userId, Integer userType, |
|
31 |
NotifyTemplateDO template, String templateContent, Map<String, Object> templateParams) { |
|
32 |
NotifyMessageDO message = new NotifyMessageDO().setUserId(userId).setUserType(userType) |
|
33 |
.setTemplateId(template.getId()).setTemplateCode(template.getCode()) |
|
34 |
.setTemplateType(template.getType()).setTemplateNickname(template.getNickname()) |
|
35 |
.setTemplateContent(templateContent).setTemplateParams(templateParams).setReadStatus(false); |
|
36 |
notifyMessageMapper.insert(message); |
|
37 |
return message.getId(); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) { |
|
42 |
return notifyMessageMapper.selectPage(pageReqVO); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public PageResult<NotifyMessageDO> getMyMyNotifyMessagePage(NotifyMessageMyPageReqVO pageReqVO, Long userId, Integer userType) { |
|
47 |
return notifyMessageMapper.selectPage(pageReqVO, userId, userType); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public NotifyMessageDO getNotifyMessage(Long id) { |
|
52 |
return notifyMessageMapper.selectById(id); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public List<NotifyMessageDO> getUnreadNotifyMessageList(Long userId, Integer userType, Integer size) { |
|
57 |
return notifyMessageMapper.selectUnreadListByUserIdAndUserType(userId, userType, size); |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public Long getUnreadNotifyMessageCount(Long userId, Integer userType) { |
|
62 |
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, userType); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public int updateNotifyMessageRead(Collection<Long> ids, Long userId, Integer userType) { |
|
67 |
return notifyMessageMapper.updateListRead(ids, userId, userType); |
|
68 |
} |
|
69 |
|
|
70 |
@Override |
|
71 |
public int updateAllNotifyMessageRead(Long userId, Integer userType) { |
|
72 |
return notifyMessageMapper.updateListRead(userId, userType); |
|
73 |
} |
|
74 |
|
|
75 |
} |