@ResponseBody @RequestMapping("getMessageById") public String getMessageById(int id) { Message message = (Message) messageService.getById("Message", id); JSONObject json = JSONObject.fromObject(message); json.put("ctime", message.getCtime().toString()); json.put("utime", message.getUtime().toString()); json.put("btime", message.getBtime().toString()); json.put("etime", message.getEtime().toString()); return JsonUtil.getJson(json); }
@RequestMapping("updateMessage") public String updateProduct( String ctime_es, String utime_es, String btime_es, String etime_es, Message message, HttpServletRequest request) { message.setCtime(DateUtil.getDateFromStr(ctime_es, "yyyy-MM-dd hh:mm:ss")); message.setUtime(DateUtil.getDateFromStr(utime_es, "yyyy-MM-dd hh:mm:ss")); message.setBtime(DateUtil.getDateFromStr(btime_es, "yyyy-MM-dd hh:mm:ss")); message.setEtime(DateUtil.getDateFromStr(etime_es, "yyyy-MM-dd hh:mm:ss")); messageService.update(message); return "redirect:message.html"; }
@RequestMapping("saveMessage") public String saveMessage( String ctime_as, String utime_as, String btime_as, String etime_as, Message message, HttpServletRequest request) { message.setCtime(DateUtil.getDateFromStr(ctime_as, "yyyy-MM-dd hh:mm:ss")); message.setUtime(DateUtil.getDateFromStr(utime_as, "yyyy-MM-dd hh:mm:ss")); message.setBtime(DateUtil.getDateFromStr(btime_as, "yyyy-MM-dd hh:mm:ss")); message.setEtime(DateUtil.getDateFromStr(etime_as, "yyyy-MM-dd hh:mm:ss")); if (message.getSsid() == null || message.getSsid() == 0) message.setSsid(messageService.getMaxSsid("Message") + 1); messageService.save(message); return "redirect:message.html"; }