结组作业,第二次冲刺(6)
今天是第二次冲刺的第六天,昨天完成了广告功能,今天我们准备增加聊天功能,能够实现在软件中直接点击对应的兼职信息,就能和其用户聊天,管理员能够对聊天内容进行审核。以下为今日部分代码:
package com.work.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.work.common.utils.BaseUtil; import com.work.common.utils.JsonUtil; import com.work.pojo.Chat; import com.work.service.ChatService; @Controller @RequestMapping(value="/server/chat") public class ChatController extends BaseUtil{ @Autowired private ChatService chatService; //去聊天列表 @RequestMapping("/goChatList") public ModelAndView goChatList(ModelAndView mv){ mv.setViewName("server/chatManage/chatList"); return mv; } //获取聊天列表 @RequestMapping("/getChatList") public void getChatList(HttpServletResponse response,Chat chat,Integer page,Integer limit){ if(page == null){ page = 1; } if(limit == null){ limit = 10; } int totalCount = chatService.getChatListCount(chat); List<Chat> list = chatService.getChatList(chat,(page-1) * limit, limit); output(response,JsonUtil.buildJsonByTotalCount(list, totalCount)); } //去编辑聊天 @RequestMapping("/goUpdateChat") public ModelAndView goUpdateChat(ModelAndView mv,Integer id){ Chat chat = chatService.getChatById(id); mv.addObject("chat", chat); mv.setViewName("server/chatManage/updateChat"); return mv; } //编辑聊天 @RequestMapping("/updateChat") public void updateChat(HttpServletResponse response,Chat chat){ chatService.updateChat(chat); output(response,JsonUtil.buildFalseJson(0, "编辑成功!")); } //删除聊天 @RequestMapping("/deleteChat") public void deleteChat(HttpServletResponse response,Integer id){ chatService.deleteChatByChatId(id); output(response,JsonUtil.buildFalseJson(0, "删除成功!")); } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 【杂谈】分布式事务——高大上的无用知识?