@RequestMapping( value = "/selectOne",method = RequestMethod.GET)
@ResponseBody
public MapselectOne(String content)throws Exception {
content=URLDecoder.decode(content,"utf-8");
System.out.print(content);
Map map=new HashMap();
Message msg=new Message();
List list=mservice.selectOne(content);
map.put("list",list);
return map;
}
@ResponseBody
@RequestMapping( value = "/selectByName",method = RequestMethod.GET)
public MapselectByName(String op,HttpSession session,HttpServletRequest request)throws Exception {
op=URLDecoder.decode(op,"utf-8");
System.out.print("jing re cha xun jie mian ");
Map map=new HashMap();
Map result =new LinkedHashMap();
result.put("101","爱理不理");
result.put("202","看一下就好");
result.put("303","十万火急");
request.setAttribute("resultMap",result);
Message msg=new Message();
if(op.equals("syyh")){
List list=mservice.getMessageList();
map.put("list",list);
}else{
String uid=op;
List list=mservice.selectByName(Integer.parseInt(uid));
map.put("list",list);
}
return map;
}
@RequestMapping(value = "/delete", method = RequestMethod.GET)
@ResponseBody
public Map delete(String mid) throws Exception {
Map map = new HashMap<>();
Message msg = new Message();
msg.setMid(Integer.parseInt(mid));
String id=mid;
mservice.delete(Integer.parseInt(id));
int count=1;
map.put("count", count);
return map;
}
@RequestMapping("batchDelete")
public String batchDelete(String[] ids){
for (String string : ids) {
mservice.delete(Integer.parseInt(string));
}
return "index";
}
@RequestMapping("selectUserList")
public String selectUserList(Model model) {
System.out.print("jint ren fang fa ");
List list = service.selectAll();
model.addAttribute("list", list);
return "insert";
}
@RequestMapping( value = "/insert",method = RequestMethod.GET)
@ResponseBody
public Map insert(String content,String chec ,int jinji)throws Exception {
Map map=new HashMap<>();
content= URLDecoder.decode(content,"utf-8");
chec=URLDecoder.decode(chec,"utf-8");
Message msg;
for (String arg:chec.split(",")) {
msg = new Message();
msg.setContent(content);
msg.setRank(jinji);
msg.setU_id(Integer.parseInt(arg));
mservice.insert(msg);
}
int count=1;
map.put("count",count);
return map;
}
/*@RequestMapping("batchInsert")
public String batchInsert(String[] ids){
for (String string : ids) {
mservice.insert(string);
}
}*/
快速高效用:SET SQL_SAFE_UPDATES = 0;下面的就不要看了!
今日用MySQL Workbench进行数据库的管理更新时,执行一个更新的语句碰到以下错误提示:
Error Code: 1175
You are using safe update mode and you tried to update a table without a WHERE that
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Note:You may assume that nums1 has enough space (size that is