更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
接下来需要进行点击消息进行操作的动作。
1、首先先导入这个更新用户消息的一些菜单与权限,以便后面进行配置
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620993, '用户公告阅读标记', '3', '1', 'noticeSend', 'system/noticeSend/index', 1, 0, 'C', '0', '0', 'system:noticeSend:list', '#', 'admin', sysdate(), '', null, '用户公告阅读标记菜单'); -- 按钮 SQL insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620994, '用户公告阅读标记查询', 1704735607761620993, '1', '#', '', 1, 0, 'F', '0', '0', 'system:noticeSend:query', '#', 'admin', sysdate(), '', null, ''); insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620995, '用户公告阅读标记新增', 1704735607761620993, '2', '#', '', 1, 0, 'F', '0', '0', 'system:noticeSend:add', '#', 'admin', sysdate(), '', null, ''); insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620996, '用户公告阅读标记修改', 1704735607761620993, '3', '#', '', 1, 0, 'F', '0', '0', 'system:noticeSend:edit', '#', 'admin', sysdate(), '', null, ''); insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620997, '用户公告阅读标记删除', 1704735607761620993, '4', '#', '', 1, 0, 'F', '0', '0', 'system:noticeSend:remove', '#', 'admin', sysdate(), '', null, ''); insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) values(1704735607761620998, '用户公告阅读标记导出', 1704735607761620993, '5', '#', '', 1, 0, 'F', '0', '0', 'system:noticeSend:export', '#', 'admin', sysdate(), '', null, '');
2、因为要点击进行流程的处理,所以需要进行yml配置,所以下面的flowable配置移到dev与prod里了
flowable: # 关闭定时任务 job async-executor-activate: false # 库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。 database-schema-update: true idm: # 关闭idm引擎 数据库不会创建act_id_*表,流程流转不会使用act_id_*相关的表 enabled: false # 关闭流程定义文件自动检查 check-process-definitions: false # 关闭历史任务定时任务job async-history-executor-activate: false #消息链接基地址 message-base-url: http://localhost:9666/workflow/process/detail/
3、更新用户公告阅读状态标记,后端代码如下:
/** * 更新用户公告阅读状态标记 */ @SaCheckPermission("system:noticeSend:edit") @Log(title = "更新用户公告阅读状态标记", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping(value = "/updateUserIdAndNotice") public R<Void> updateUserIdAndNotice(@RequestBody JSONObject json) { Long noticeId = json.getLong("noticeId"); LoginUser loginUser = commonService.getLoginUser(); Long userId = loginUser.getUserId(); LambdaUpdateWrapper<SysNoticeSend> updateWrapper = new UpdateWrapper().lambda(); updateWrapper.set(SysNoticeSend::getReadFlag, Constants.HAS_READ_FLAG); updateWrapper.set(SysNoticeSend::getReadTime, new Date()); updateWrapper.last("where notice_id ="+noticeId+" and user_id ="+userId); SysNoticeSend noticeSend = new SysNoticeSend(); iSysNoticeSendService.update(noticeSend, updateWrapper); return R.ok("更新用户公告阅读状态标记成功"); }
4、前端主要调用更新标记同时显示详细动作信息
showNotice(record) { updateUserIdAndNotice({ noticeId: record.noticeId }).then((res) => { if (res.code == 200) { this.loadData(); } }); this.hovered = false; if (record.openType === 'component') { this.openPath = record.openPage; this.formData = { id: record.busId }; this.$refs.showDynamNotice.detail(record.openPage); } else { this.$refs.ShowNotice.detail(record); } },
5、效果图如下: