发送私信功能开发;

功能开发

数据访问层

message-mapper.xml 增加

 <insert id="insertMessage" parameterType="Message" keyProperty="id">
insert into message(<include refid="insertFields"></include>)
values(#{fromId},#{toId},#{conversationId},#{content},#{status},#{createTime})
</insert> <update id="updateStatus">
update message set status = #{status}
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>

  

MessageMapper 增加:

// 新增消息
int insertMessage(Message message); // 修改消息的状态
int updateStatus(List<Integer> ids, int status);

  

业务层开发:

 public int addMessage(Message message) {
message.setContent(HtmlUtils.htmlEscape(message.getContent()));
message.setContent(sensitiveFilter.filter(message.getContent()));
return messageMapper.insertMessage(message);
} public int readMessage(List<Integer> ids) {
return messageMapper.updateStatus(ids, 1);
}

  

表现层:

 public int addMessage(Message message) {
message.setContent(HtmlUtils.htmlEscape(message.getContent()));
message.setContent(sensitiveFilter.filter(message.getContent()));
return messageMapper.insertMessage(message);
} public int readMessage(List<Integer> ids) {
return messageMapper.updateStatus(ids, 1);
}

  

接下来就是页面处理。

SpringBoot开发二十一-发送私信的更多相关文章

  1. SpringBoot开发二十-Redis入门以及Spring整合Redis

    安装 Redis,熟悉 Redis 的命令以及整合Redis,在Spring 中使用Redis. 代码实现 Redis 内置了 16 个库,索引是 0-15 ,默认选择第 0 个 Redis 的常用命 ...

  2. SpringBoot开发二十-私信列表

    私信列表功能开发. 发送私信功能开发 首先创建一个实体类:Message package com.nowcoder.community.entity; import java.util.Date; p ...

  3. python运维开发(二十一)----文件上传和验证码+session

    内容目录: 文件上传 验证码+session 文件和图片的上传功能 HTML Form表单提交,实例展示 views 代码 HTML ajax提交 原生ajax提交,XMLHttpRequest方式上 ...

  4. SpringBoot开发二十四-Redis入门以及Spring整合Redis

    需求介绍 安装 Redis,熟悉 Redis 的命令以及整合Redis,在Spring 中使用Redis. 代码实现 Redis 内置了 16 个库,索引是 0-15 ,默认选择第 0 个 Redis ...

  5. SpringBoot开发二十二-统一处理异常

    需求介绍 首先服务端分为三层:表现层,业务层,数据层. 请求过来先到表现层,表现层调用业务层,然后业务层调用数据层. 那么数据层出现异常它会抛出异常,那异常肯定是抛给调用者也就是业务层,那么业务层会再 ...

  6. SpringBoot开发二十三-统一记录日志

    统一记录日志 AlphaAspect package com.nowcoder.community.aspect; import org.aspectj.lang.ProceedingJoinPoin ...

  7. SpringBoot开发二

    需求介绍-Spring入门 主要是理解IOC,理解容器和Bean 代码 在Test里面利用getBean方法帮助我们看一下容器的创建: 那我首先要写一个Bean对象,假设是写一个访问数据库类. Alp ...

  8. Senparc.Weixin.MP SDK 微信公众平台开发教程(二十一):在小程序中使用 WebSocket (.NET Core)

    本文将介绍如何在 .NET Core 环境下,借助 SignalR 在小程序内使用 WebSocket.关于 WebSocket 和 SignalR 的基础理论知识不在这里展开,已经有足够的参考资料, ...

  9. 【圣诞特献】Web 前端开发精华文章推荐【系列二十一】

    <Web 前端开发精华文章推荐>2013年第九期(总第二十一期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各种增强网站用户体验的 jQuery 插件,展示前沿的 HTML5 和  ...

随机推荐

  1. Docker:docker部署Sqlite3数据库

    1.依赖Ubuntu系统安装sqlite3生成镜像 dockerfile文件 FROM ubuntu:trusty RUN sudo apt-get -y update RUN sudo apt-ge ...

  2. doc系统maven打包脚本

    chcp 65001@echo off title 打包神器,龙爷造. echo ============================= echo 姓名:Long echo 日期:2020-08- ...

  3. mysql日期时间处理

      获得当前周的周一到周日 select subdate(curdate(),date_format(curdate(),'%w')-1)//获取当前日期在本周的周一 select subdate(c ...

  4. 基于Vue/React项目的移动端适配方案

    本文的目标是通过下文介绍的适配方案,使用vue或react开发移动端及H5的时候,不需要再关心移动设备的大小,只需要按照固定设计稿的px值布局,提升开发效率. 下文给出了本人分别使用create-re ...

  5. Jenkins集成SonarQube遇到的报错

    Jenkins集成Sonar过程中遇到的报错 1.jenkins中无法添加sonarqube的token凭证 因为添加的凭证类型错误,所以无法添加token,类型应该选择"Secret te ...

  6. varnish配置语言(1)

    目录 1. vcl语法 1.1 主体语法 1.2 操作符 1.3 Subroutines 1.4 关键字 2. 内置的Subroutines 2.1 client-side vcl_recv vcl_ ...

  7. C语言:按行读TXT文件

    //搂行读取TXT #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_L ...

  8. VMware workstation虚拟机配置文件不兼容无法使用解决方法

    VMware workstation虚拟机配置文件不兼容无法使用解决方法打开VMware workstation虚拟机提示:配置文件"--.vmx"是由Vmware产品创建,但该产 ...

  9. 字典get方法和setdesault方法,统计message中各元素的出现频次

    message= 'There are moments in life when you miss someone so much that you just want to pick them fr ...

  10. Python基础之魔术方法(一个序列容器的魔术方法)

    # 创建自己想要的序列容器魔术方法'''__len__():调用len(obj)函数会调用这个魔术方法__getitem__(self,key):在使用下标操作temp['key']以及切片操作的时候 ...