1 2 3 24 package com.geinuke.dao; 25 26 import java.util.HashMap ; 27 import java.util.List ; 28 29 import com.geinuke.vo.ForumVO; 30 31 public class ForumDAO extends GeiDAO{ 32 33 34 public ForumDAO() throws Exception { 35 super(); 36 37 } 38 39 public List getVisibleForums()throws Exception { 40 List list=null; 41 try{ 42 Integer v=new Integer (ForumVO.STATE_VISIBLE); 43 this.sqlMap().startTransaction(); 44 list=this.sqlMap().queryForList("getForumsByState",v); 45 this.sqlMap().commitTransaction(); 46 }finally{ 47 this.sqlMap().endTransaction(); 48 } 49 return list; 50 51 } 52 53 public ForumVO getForumByFId(int fid)throws Exception { 54 ForumVO res=null; 55 try{ 56 57 this.sqlMap().startTransaction(); 58 res=(ForumVO)this.sqlMap().queryForObject("getForumByFId",new Integer (fid)); 59 this.sqlMap().commitTransaction(); 60 }finally{ 61 this.sqlMap().endTransaction(); 62 } 63 return res; 64 65 } 66 67 public void delForumByFId(int fid)throws Exception { 68 69 try{ 70 71 this.sqlMap().startTransaction(); 72 this.sqlMap().delete("delForumByFId",new Integer (fid)); 73 this.sqlMap().commitTransaction(); 74 }finally{ 75 this.sqlMap().endTransaction(); 76 } 77 78 79 } 80 81 public void insForum(ForumVO mod)throws Exception { 82 try{ 83 this.sqlMap().startTransaction(); 84 this.sqlMap().insert("insForum",mod); 85 this.sqlMap().commitTransaction(); 86 }finally{ 87 this.sqlMap().endTransaction(); 88 } 89 90 } 91 92 public void updateForum(ForumVO mod)throws Exception { 93 try{ 94 this.sqlMap().startTransaction(); 95 this.sqlMap().update("updateForum",mod); 96 this.sqlMap().commitTransaction(); 97 }finally{ 98 this.sqlMap().endTransaction(); 99 } 100 101 } 102 103 public void insForumModerator(int fid,int uid)throws Exception { 104 try{ 105 HashMap map=new HashMap (); 106 map.put("euid",new Integer (uid)); 107 map.put("efid",new Integer (fid)); 108 this.sqlMap().startTransaction(); 109 this.sqlMap().insert("insForumModerator",map); 110 this.sqlMap().commitTransaction(); 111 }finally{ 112 this.sqlMap().endTransaction(); 113 } 114 115 } 116 117 public void insCategoryForum(int fid,int catid)throws Exception { 118 try{ 119 HashMap map=new HashMap (); 120 map.put("eecatid",new Integer (catid)); 121 map.put("eefid",new Integer (fid)); 122 this.sqlMap().startTransaction(); 123 this.sqlMap().insert("insCategoryForum",map); 124 this.sqlMap().commitTransaction(); 125 }finally{ 126 this.sqlMap().endTransaction(); 127 } 128 129 } 130 131 132 public ForumVO getForumByTId(int tid)throws Exception { 133 ForumVO res=null; 134 try{ 135 136 this.sqlMap().startTransaction(); 137 res=(ForumVO)this.sqlMap().queryForObject("getForumByTId",new Integer (tid)); 138 this.sqlMap().commitTransaction(); 139 }finally{ 140 this.sqlMap().endTransaction(); 141 } 142 return res; 143 144 } 145 146 } 147 | Popular Tags |