修改pc消息已读、未读接口
This commit is contained in:
@@ -63,6 +63,9 @@ public class EmployeeConfirm extends BaseEntity {
|
|||||||
@ApiModelProperty("工作id")
|
@ApiModelProperty("工作id")
|
||||||
private Long jobId;
|
private Long jobId;
|
||||||
|
|
||||||
|
@ApiModelProperty("移动端用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请id
|
* 申请id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class Notice extends BaseEntity
|
|||||||
private Integer notReadCount;
|
private Integer notReadCount;
|
||||||
|
|
||||||
@ApiModelProperty("是否阅读 0未读 1已读")
|
@ApiModelProperty("是否阅读 0未读 1已读")
|
||||||
private Integer isRead;
|
private String isRead;
|
||||||
|
|
||||||
@JsonFormat(pattern = "MM-dd")
|
@JsonFormat(pattern = "MM-dd")
|
||||||
@ApiModelProperty("日期")
|
@ApiModelProperty("日期")
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ package com.ruoyi.cms.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.ruoyi.cms.domain.Notice;
|
import com.ruoyi.cms.domain.Notice;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface NoticeMapper extends BaseMapper<Notice>
|
public interface NoticeMapper extends BaseMapper<Notice>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
List<Notice> getNoticlist(Notice notice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
|
|||||||
Notice notice = new Notice();
|
Notice notice = new Notice();
|
||||||
notice.setUserId(appUser.getUserId());
|
notice.setUserId(appUser.getUserId());
|
||||||
notice.setTitle("职位上新");
|
notice.setTitle("职位上新");
|
||||||
notice.setIsRead(0);
|
notice.setIsRead(StringUtil.NOTICE_WD);
|
||||||
notice.setDate(new Date());
|
notice.setDate(new Date());
|
||||||
//todo update number of job
|
//todo update number of job
|
||||||
notice.setSubTitle("这里有10个岗位很适合你,快来看看吧");
|
notice.setSubTitle("这里有10个岗位很适合你,快来看看吧");
|
||||||
@@ -169,14 +169,14 @@ public class AppNoticeServiceImpl implements IAppNoticeService
|
|||||||
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
||||||
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
||||||
notices.forEach(notice -> {
|
notices.forEach(notice -> {
|
||||||
notice.setIsRead(1);
|
notice.setIsRead(StringUtil.NOTICE_YD);
|
||||||
noticeInfoMapper.updateById(notice);
|
noticeInfoMapper.updateById(notice);
|
||||||
});
|
});
|
||||||
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, SiteSecurityUtils.getUserId()).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
|
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, SiteSecurityUtils.getUserId()).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
|
||||||
Notice notice = notices1.get(0);
|
Notice notice = notices1.get(0);
|
||||||
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
|
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
|
||||||
if(notice.getNotReadCount()==0){
|
if(notice.getNotReadCount()==0){
|
||||||
notice.setIsRead(1);
|
notice.setIsRead(StringUtil.NOTICE_YD);
|
||||||
}
|
}
|
||||||
noticeInfoMapper.updateById(notice);
|
noticeInfoMapper.updateById(notice);
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
|
|||||||
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
||||||
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
||||||
notices.forEach(notice -> {
|
notices.forEach(notice -> {
|
||||||
notice.setIsRead(1);
|
notice.setIsRead(StringUtil.NOTICE_YD);
|
||||||
notice.setNotReadCount(0);
|
notice.setNotReadCount(0);
|
||||||
noticeInfoMapper.updateById(notice);
|
noticeInfoMapper.updateById(notice);
|
||||||
});
|
});
|
||||||
@@ -201,8 +201,10 @@ public class AppNoticeServiceImpl implements IAppNoticeService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Notice> selectListAppNotRead(Notice notice) {
|
public List<Notice> selectListAppNotRead(Notice notice) {
|
||||||
List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, notice.getUserId()).eq(Notice::getRemark,"notice_bar").eq(Notice::getIsRead,0).orderByDesc(Notice::getCreateTime));
|
notice.setRemark(StringUtil.NOTICE_TYPE);
|
||||||
return sysNoticeList;
|
notice.setIsRead(StringUtil.NOTICE_WD);
|
||||||
|
//List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, notice.getUserId()).eq(Notice::getRemark,"notice_bar").eq(Notice::getIsRead,0).orderByDesc(Notice::getCreateTime));
|
||||||
|
return noticeInfoMapper.getNoticlist(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -210,22 +212,22 @@ public class AppNoticeServiceImpl implements IAppNoticeService
|
|||||||
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
||||||
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
||||||
notices.forEach(notice -> {
|
notices.forEach(notice -> {
|
||||||
notice.setIsRead(1);
|
notice.setIsRead(StringUtil.NOTICE_YD);
|
||||||
noticeInfoMapper.updateById(notice);
|
noticeInfoMapper.updateById(notice);
|
||||||
});
|
});
|
||||||
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
|
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
|
||||||
Notice notice = notices1.get(0);
|
Notice notice = notices1.get(0);
|
||||||
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
|
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
|
||||||
if(notice.getNotReadCount()==0){
|
if(notice.getNotReadCount()==0){
|
||||||
notice.setIsRead(1);
|
notice.setIsRead(StringUtil.NOTICE_YD);
|
||||||
}
|
}
|
||||||
noticeInfoMapper.updateById(notice);
|
noticeInfoMapper.updateById(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Notice> selectListAppNotics(Notice notice) {
|
public List<Notice> selectListAppNotics(Notice notice) {
|
||||||
List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, notice.getUserId()).eq(Notice::getRemark,"notice_bar").orderByDesc(Notice::getCreateTime));
|
notice.setRemark(StringUtil.NOTICE_TYPE);
|
||||||
return sysNoticeList;
|
return noticeInfoMapper.getNoticlist(notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ public class StringUtil {
|
|||||||
* pc端-企业
|
* pc端-企业
|
||||||
*/
|
*/
|
||||||
public static final String SYS_QY = "100";
|
public static final String SYS_QY = "100";
|
||||||
|
/**
|
||||||
|
* 消息已读
|
||||||
|
*/
|
||||||
|
public static final String NOTICE_YD="1";
|
||||||
|
/**
|
||||||
|
* 消息未读
|
||||||
|
*/
|
||||||
|
public static final String NOTICE_WD="0";
|
||||||
|
|
||||||
|
public static final String NOTICE_TYPE="notice_bar";
|
||||||
|
|
||||||
public static Boolean isEmptyOrNull(String s){
|
public static Boolean isEmptyOrNull(String s){
|
||||||
if(Objects.isNull(s)){return true;}
|
if(Objects.isNull(s)){return true;}
|
||||||
|
|||||||
@@ -3,6 +3,21 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.cms.mapper.NoticeMapper">
|
<mapper namespace="com.ruoyi.cms.mapper.NoticeMapper">
|
||||||
|
|
||||||
|
<sql id="selectNoticeleVo">
|
||||||
|
select notice_id, title,sub_title, notice_type, notice_content, is_read,user_id,not_read_count,date, del_flag, create_by, create_time, update_by, remark,bussiness_id from notice
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getNoticlist" parameterType="com.ruoyi.cms.domain.Notice" resultType="com.ruoyi.cms.domain.Notice">
|
||||||
|
<include refid="selectNoticeleVo"/>
|
||||||
|
<where> del_flag = '0'
|
||||||
|
<if test="noticeType != null "> and notice_type = #{noticeType}</if>
|
||||||
|
<if test="isRead != null "> and is_read = #{isRead}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="bussinessId != null "> and bussiness_id = #{bussinessId}</if>
|
||||||
|
<if test="remark != null "> and remark = #{remark}</if>
|
||||||
|
</where>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user