如果我要查詢單個女神的信息,那map.put("value", "???");這個要怎么寫
因為""里面是字符串,填任何值的話都變成字符串了,該怎么做呢。。
else if (OPERATION_GET.equals(in.toUpperCase()) || OPERATION_GET.substring(0, 1).equals(in.toUpperCase())){
?? ??? ??? ??? ?List<Map<String, Object>> params = new ArrayList<>();
?? ??? ??? ??? ?Map<String, Object> map = new HashMap<>();
?? ??? ??? ??? ?
?? ??? ??? ??? ?System.out.println("請輸入您要查詢女神的id:");
?? ??? ??? ??? ?String s = scan.nextLine().toString();
?? ??? ??? ??? ?
?? ??? ??? ??? ?map.put("name","user_name");
?? ??? ??? ??? ?map.put("rela","=");
?? ??? ??? ??? ?map.put("value", "???");
?? ??? ??? ??? ?
?? ??? ??? ??? ?params.add(map);
?? ??? ??? ??? ?
?? ??? ??? ??? ?List<Goddess> list;
?? ??? ??? ??? ?try {
?? ??? ??? ??? ??? ?list = action.query(params);
?? ??? ??? ??? ??? ?for (int i = 0; i < list.size(); i++) {
?? ??? ??? ??? ??? ??? ?System.out.println(list.get(i).getId() + " " + list.get(i).getUser_name());
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?} catch (Exception e) {
?? ??? ??? ??? ??? ?e.printStackTrace();
?? ??? ??? ??? ?}?
?? ??? ??? ?}
2016-04-16
我改成了圖書的,你在稍微改一下就可以咯
??? else if(OPERATION_GET.equals(in.toUpperCase())||OPERATION_GET.substring(0,1).equals(in.toUpperCase()))
?? ??? ??? ?{
?? ??? ??? ??? ?System.out.println("請輸入要查詢的圖書的 [編號]");
?? ??? ??? ??? ?Integer i=scan.nextInt();
?? ??? ??? ??? ?try {
?? ??? ??? ??? ??? ?Goddess go=action.get(i);
?? ??? ??? ??? ??? ?System.out.println(go.getId()+"? "+go.getBook_name()+"??? "+go.getAuthor()+"??? "+go.getPublish());
?? ??? ??? ??? ?} catch (SQLException e) {
?? ??? ??? ??? ??? ?// TODO Auto-generated catch block
?? ??? ??? ??? ??? ?e.printStackTrace();
?? ??? ??? ??? ??? ?System.out.println("查詢圖書失敗");
?? ??? ??? ??? ?}
?? ??? ??? ?}
2016-04-16
單個女神,只要定義一個變量,用來做ID,調用action.get(ID),在輸出結果就可以了呢
2016-04-16
你這個好像不是GET,寫的應該是SEARCH
2016-04-09
把user_name 換成 id
2016-04-09
傳入單個女神的ID呀!