01: package com.bostechcorp.cbesb.common.util.runtimedb;
02:
03: import java.sql.Timestamp;
04: import java.util.List;
05:
06: import com.bostechcorp.cbesb.common.util.runtimedb.vo.ConsoleUserVO;
07: import com.ibatis.sqlmap.client.SqlMapClient;
08:
09: public class ConsoleUserDB extends AbstractRuntimeDB {
10:
11: /* (non-Javadoc)
12: * @see com.bostechcorp.cbesb.console.rpc.SecurityOperations#getUserList()
13: */
14: static public List getUserList() throws Exception {
15: SqlMapClient sqlMap = null;
16: DaoConfig DaoConfig = new DaoConfig();
17: sqlMap = DaoConfig.getSqlMapInstance();
18: List l;
19:
20: l = sqlMap.queryForList("selectAll", null);
21: return l;
22: }
23:
24: /* (non-Javadoc)
25: * @see com.bostechcorp.cbesb.console.rpc.SecurityOperations#add(com.bostechcorp.cbesb.console.rpc.ConsoleUserVO)
26: */
27: static public boolean add(ConsoleUserVO user) throws Exception {
28: SqlMapClient sqlMap = null;
29:
30: DaoConfig DaoConfig = new DaoConfig();
31: sqlMap = DaoConfig.getSqlMapInstance();
32: sqlMap.insert("insertUser", user);
33:
34: return true;
35: }
36:
37: /* (non-Javadoc)
38: * @see com.bostechcorp.cbesb.console.rpc.SecurityOperations#delete(com.bostechcorp.cbesb.console.rpc.ConsoleUserVO)
39: */
40: static public boolean delete(ConsoleUserVO user) throws Exception {
41: SqlMapClient sqlMap = null;
42:
43: DaoConfig DaoConfig = new DaoConfig();
44: sqlMap = DaoConfig.getSqlMapInstance();
45: sqlMap.update("delteUser", user);
46:
47: return true;
48: }
49:
50: /* (non-Javadoc)
51: * @see com.bostechcorp.cbesb.console.rpc.SecurityOperations#getUserByNickname(java.lang.String)
52: *
53: */
54: static public ConsoleUserVO getUserByNickname(String nickname)
55: throws Exception {
56: SqlMapClient sqlMap = null;
57:
58: DaoConfig daoConfig = new DaoConfig();
59: sqlMap = daoConfig.getSqlMapInstance();
60: ConsoleUserVO userVO = (ConsoleUserVO) sqlMap.queryForObject(
61: "selectUserByLogin", nickname);
62: return userVO;
63:
64: }
65:
66: /* (non-Javadoc)
67: * @see com.bostechcorp.cbesb.console.rpc.SecurityOperations#update(com.bostechcorp.cbesb.console.rpc.ConsoleUserVO)
68: */
69: static public boolean update(ConsoleUserVO user) throws Exception {
70: SqlMapClient sqlMap = null;
71:
72: DaoConfig DaoConfig = new DaoConfig();
73: sqlMap = DaoConfig.getSqlMapInstance();
74: user.setLastUpdated(new Timestamp(System.currentTimeMillis()));
75: sqlMap.update("updateUserById", user);
76:
77: return true;
78: }
79:
80: }
|