MCPcopy Create free account
hub / github.com/bsxj97/flower-mall / save

Method save

src/main/java/com/controller/ChatController.java:128–144  ·  view source on GitHub ↗

后端保存

(@RequestBody ChatEntity chat, HttpServletRequest request)

Source from the content-addressed store, hash-verified

126 * 后端保存
127 */
128 @RequestMapping("/save")
129 public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
130 chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
131 //ValidatorUtils.validateEntity(chat);
132 if(StringUtils.isNotBlank(chat.getAsk())) {
133 chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId")));
134 chat.setUserid((Long)request.getSession().getAttribute("userId"));
135 chat.setIsreply(1);
136 }
137 if(StringUtils.isNotBlank(chat.getReply())) {
138 chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
139 chat.setAdminid((Long)request.getSession().getAttribute("userId"));
140 }
141
142 chatService.insert(chat);
143 return R.ok();
144 }
145
146 /**
147 * 前端保存

Callers

nothing calls this directly

Calls 4

getReplyMethod · 0.80
setIdMethod · 0.45
setUseridMethod · 0.45
getUseridMethod · 0.45

Tested by

no test coverage detected