Merge pull request 'SysNotificationService中getUnreadNotificationByType' (#27) from wanjia9506/gitlink-notification-system:dev_gitlink_model into master

This commit is contained in:
baladiwei 2021-09-08 16:35:42 +08:00
commit 141e77c8bd
7 changed files with 11 additions and 9 deletions

View File

@ -23,7 +23,7 @@ public class SysNotification {
private Integer type;
private Boolean isDelete;
private Integer isDelete;
public Integer getId() {
return id;
@ -89,11 +89,11 @@ public class SysNotification {
this.type = type;
}
public Boolean getIsDelete() {
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
}

View File

@ -30,7 +30,8 @@ public interface SysNotificationMapper extends BaseMapper<SysNotification> {
List<SysNotification> getUnreadSysNotificationsList(@Param("platform") String platform,
@Param("receiver") Integer receiver,
@Param("status") Integer status,
@Param("notificationNumber") Integer notificationNumber);
@Param("notificationNumber") Integer notificationNumber,
@Param("type") Integer type);
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
@Param("platform") String platform,

View File

@ -37,9 +37,10 @@ public interface SysNotificationService extends IService<SysNotification> {
* @param platform 平台编号
* @param receiver 消息接收者
* @param size 页大小
* @param type 1 系统消息 2 @我
* @return
*/
List<SysNotification> getUnreadNotificationByType(String platform, Integer receiver, Integer size);
List<SysNotification> getUnreadNotificationByType(String platform, Integer receiver, Integer size, Integer type);
/**
*按分类获取未读消息总数

View File

@ -42,8 +42,8 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
}
@Override
public List<SysNotification> getUnreadNotificationByType(String platform, Integer receiver, Integer size) {
List<SysNotification> sysNotificationList = baseMapper.getUnreadSysNotificationsList(platform, receiver, 1, size);
public List<SysNotification> getUnreadNotificationByType(String platform, Integer receiver, Integer size, Integer type) {
List<SysNotification> sysNotificationList = baseMapper.getUnreadSysNotificationsList(platform, receiver, 1, size, type);
return sysNotificationList;
}

View File

@ -151,7 +151,7 @@
</select>
<select id="getUnreadSysNotificationsList" resultMap="BaseResultMap">
select * FROM ${platform}_sys_notification
where receiver = #{receiver} AND status = #{status} AND is_delete = -1
where receiver = #{receiver} AND status = #{status} AND `type` = #{type} AND is_delete = 1
ORDER BY id DESC limit #{notificationNumber}
</select>
<select id="getSysNotificationPageList" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification" resultMap="BaseResultMap">

View File

@ -30,7 +30,7 @@ public class ServiceTests {
@Test
public void testSysNotificationService() {
int i = sysNotificationService.getUnreadNotificationCount("gitlink", 234);
List<SysNotification> sysNotificationList = sysNotificationService.getUnreadNotificationByType("gitlink", 100, 20);
List<SysNotification> sysNotificationList = sysNotificationService.getUnreadNotificationByType("gitlink", 100, 20, 1);
Page<SysNotification> sysNotificationPage = sysNotificationService.getNotification(1, 10, "", "gitlink", 100);
NewSysNotificationVo newSysNotificationVo = new NewSysNotificationVo();
newSysNotificationVo.setSender((long) -1);