完成小程序通知展示和未讀數量

This commit is contained in:
little-cat-sweet 2021-08-05 16:07:30 +08:00
parent e48e29a776
commit 475ee06f7a
6 changed files with 97 additions and 0 deletions

View File

@ -90,4 +90,26 @@ public class SysNoticeController extends BaseController
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
/**
* Showing notice items in small app.
* @return
*/
@GetMapping(value = "/show")
public TableDataInfo show(){
startPage();
return getDataTable(noticeService.show());
}
@GetMapping(value = "/showNotRead")
public AjaxResult showNotRead(Integer userId){
return AjaxResult.success(noticeService.showNotRead(userId));
}
}

View File

@ -0,0 +1,12 @@
package com.xhpc.system.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
/**
* program: ruoyi
* User: HongYun
* Date:2021-08-05 16
*/
public class XhpcNoticeReadEntity extends BaseEntity {
// private
}

View File

@ -1,8 +1,10 @@
package com.xhpc.system.mapper;
import java.util.List;
import java.util.Map;
import com.xhpc.system.domain.SysNotice;
import org.apache.ibatis.annotations.Param;
/**
* 通知公告表 数据层
@ -58,4 +60,22 @@ public interface SysNoticeMapper
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
/**
* Showing notice items in the small app.
* @return
*/
List<Map<String,Object>> selectTypeContentCreateTime();
/**
* Show the number of notices which have not been read in small app.
* @param userId
* @return
*/
int countNotRead(@Param("userId") Integer userId);
List<Integer> selectNotReadIds(@Param("userId") Integer userId);
}

View File

@ -1,6 +1,7 @@
package com.xhpc.system.service;
import java.util.List;
import java.util.Map;
import com.xhpc.system.domain.SysNotice;
@ -58,4 +59,18 @@ public interface ISysNoticeService
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
/**
* Showing notice items in small app.
* @return
*/
List<Map<String,Object>> show();
/**
* Show the number of notices which have not been read in small app.
* @param userId
* @return
*/
int showNotRead(Integer userId);
}

View File

@ -1,6 +1,7 @@
package com.xhpc.system.service.impl;
import java.util.List;
import java.util.Map;
import com.xhpc.system.domain.SysNotice;
import com.xhpc.system.mapper.SysNoticeMapper;
@ -90,4 +91,17 @@ public class SysNoticeServiceImpl implements ISysNoticeService
{
return noticeMapper.deleteNoticeByIds(noticeIds);
}
@Override
public List<Map<String, Object>> show() {
return noticeMapper.selectTypeContentCreateTime();
}
@Override
public int showNotRead(Integer userId) {
return noticeMapper.countNotRead(userId);
}
}

View File

@ -95,4 +95,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectTypeContentCreateTime" resultType="map">
select notice_type as noticeType, cast(notice_content as char) as noticeContent,create_time as createTime
from sys_notice
</select>
<select id="countNotRead" resultType="java.lang.Integer">
select count(notice_id) from sys_notice  where notice_id not in  (select r.notice_id from xhpc_notice_read as r  left join sys_notice as n on r.notice_id=n.notice_id  left join xhpc_app_user as u on r.user_id=u.app_user_id where r.user_id=10)
</select>
<select id="selectNotReadIds" resultType="java.lang.Integer">
</select>
</mapper>