1 2 3 24 package com.geinuke.dao; 25 26 import java.util.ArrayList ; 27 import java.util.List ; 28 29 import com.geinuke.vo.CommentVO; 30 31 32 33 public class CommentDAO extends GeiDAO{ 34 35 36 public CommentDAO() throws Exception { 37 super(); 38 39 } 40 41 public void insertComment(CommentVO c) throws Exception { 42 43 try{ 44 this.sqlMap().startTransaction(); 45 this.sqlMap().insert("insComment",c); 46 this.sqlMap().commitTransaction(); 47 }finally{ 48 this.sqlMap().endTransaction(); 49 } 50 51 } 52 53 public void delCommentByCId(int cid) throws Exception { 54 55 try{ 56 this.sqlMap().startTransaction(); 57 this.sqlMap().delete("delCommentByCId",new Integer (cid)); 58 this.sqlMap().commitTransaction(); 59 }finally{ 60 this.sqlMap().endTransaction(); 61 } 62 63 } 64 65 public void delForumCommentsByXId(int xid) throws Exception { 66 67 try{ 68 this.sqlMap().startTransaction(); 69 this.sqlMap().delete("delForumCommentsByXId",new Integer (xid)); 70 this.sqlMap().commitTransaction(); 71 }finally{ 72 this.sqlMap().endTransaction(); 73 } 74 75 } 76 77 public void delForumCommentsByFId(int fid) throws Exception { 78 79 try{ 80 this.sqlMap().startTransaction(); 81 this.sqlMap().delete("delForumCommentsByFId",new Integer (fid)); 82 this.sqlMap().commitTransaction(); 83 }finally{ 84 this.sqlMap().endTransaction(); 85 } 86 87 } 88 89 90 public ArrayList getNewsCommentsByXId(int xid) throws Exception { 91 ArrayList list=null; 92 List llist=null; 93 try{ 94 this.sqlMap().startTransaction(); 95 llist=this.sqlMap().queryForList("getNewsCommentsByXId",new Integer (xid)); 96 this.sqlMap().commitTransaction(); 97 }finally{ 98 this.sqlMap().endTransaction(); 99 } 100 list=new ArrayList (llist); 101 return list; 102 } 103 104 public ArrayList getForumCommentsByXId(int xid) throws Exception { 105 ArrayList list=null; 106 List llist=null; 107 try{ 108 this.sqlMap().startTransaction(); 109 llist=this.sqlMap().queryForList("getForumCommentsByXId",new Integer (xid)); 110 this.sqlMap().commitTransaction(); 111 }finally{ 112 this.sqlMap().endTransaction(); 113 } 114 list=new ArrayList (llist); 115 return list; 116 } 117 118 public ArrayList getBlogCommentsByXId(int xid) throws Exception { 119 ArrayList list=null; 120 List llist=null; 121 try{ 122 this.sqlMap().startTransaction(); 123 llist=this.sqlMap().queryForList("getBlogCommentsByXId",new Integer (xid)); 124 this.sqlMap().commitTransaction(); 125 }finally{ 126 this.sqlMap().endTransaction(); 127 } 128 list=new ArrayList (llist); 129 return list; 130 } 131 132 public int getForumCommentsCountByXId(int xid) throws Exception { 133 Integer i=null; 134 135 try{ 136 this.sqlMap().startTransaction(); 137 i=(Integer )this.sqlMap().queryForObject("getForumCommentsCountByXId",new Integer (xid)); 138 this.sqlMap().commitTransaction(); 139 }finally{ 140 this.sqlMap().endTransaction(); 141 } 142 143 return i.intValue(); 144 } 145 146 public int getBlogCommentsCountByXId(int xid) throws Exception { 147 Integer i=null; 148 149 try{ 150 this.sqlMap().startTransaction(); 151 i=(Integer )this.sqlMap().queryForObject("getBlogCommentsCountByXId",new Integer (xid)); 152 this.sqlMap().commitTransaction(); 153 }finally{ 154 this.sqlMap().endTransaction(); 155 } 156 157 return i.intValue(); 158 } 159 160 public CommentVO getLastForumCommentByFId(int fid) throws Exception { 161 CommentVO c=null; 162 163 try{ 164 this.sqlMap().startTransaction(); 165 c=(CommentVO)this.sqlMap().queryForObject("getLastForumCommentByFId",new Integer (fid)); 166 this.sqlMap().commitTransaction(); 167 }finally{ 168 this.sqlMap().endTransaction(); 169 } 170 171 return c; 172 } 173 174 public CommentVO getLastForumCommentByTId(int tid) throws Exception { 175 CommentVO c=null; 176 177 try{ 178 this.sqlMap().startTransaction(); 179 c=(CommentVO)this.sqlMap().queryForObject("getLastForumCommentByTId",new Integer (tid)); 180 this.sqlMap().commitTransaction(); 181 }finally{ 182 this.sqlMap().endTransaction(); 183 } 184 185 return c; 186 } 187 188 public CommentVO getNewsCommentByCId(int cid) throws Exception { 189 CommentVO res=null; 190 try{ 191 this.sqlMap().startTransaction(); 192 res=(CommentVO)this.sqlMap().queryForObject("getNewsCommentByCId",new Integer (cid)); 193 this.sqlMap().commitTransaction(); 194 }finally{ 195 this.sqlMap().endTransaction(); 196 } 197 return res; 198 } 199 200 public CommentVO getForumCommentByCId(int cid) throws Exception { 201 CommentVO res=null; 202 try{ 203 this.sqlMap().startTransaction(); 204 res=(CommentVO)this.sqlMap().queryForObject("getForumCommentByCId",new Integer (cid)); 205 this.sqlMap().commitTransaction(); 206 }finally{ 207 this.sqlMap().endTransaction(); 208 } 209 return res; 210 } 211 212 public CommentVO getBlogCommentByCId(int cid) throws Exception { 213 CommentVO res=null; 214 try{ 215 this.sqlMap().startTransaction(); 216 res=(CommentVO)this.sqlMap().queryForObject("getBlogCommentByCId",new Integer (cid)); 217 this.sqlMap().commitTransaction(); 218 }finally{ 219 this.sqlMap().endTransaction(); 220 } 221 return res; 222 } 223 224 225 } 226 | Popular Tags |