📄 groupuserbean.java
字号:
package com.sxit.wap.groupuser;import java.sql.*;import java.util.*;import com.sxit.wap.common.*;import com.sxit.wap.exception.*;public class GroupUserBean extends GroupUserDao{ public static Collection getAllGroupUser(int groupId,int beginRow, int endRow) throws SysException { String sql = "SELECT U.USER_MDN,U.USER_NAME,U.USER_REGDATE,G.GROUP_NAME FROM WAP_USER U,WAP_GROUP G,WAP_GROUP_USER GU WHERE U.USER_MDN=GU.USER_MDN AND GU.GROUP_ID=G.ID AND G.ID ="+groupId; return queryBySql(sql,beginRow,endRow); } public static int getRowCountByUserMdn(int groupId,String userMdn) throws SysException{ String sql = "SELECT COUNT(*) FROM " + tableName + " WHERE GROUP_ID = " + groupId + " AND USER_MDN LIKE '" + userMdn + "%'"; return getRowCountBySql(sql); } public static Collection queryByUserMdn(int groupId,String userMdn,int beginRow,int endRow) throws SysException{ String sql = "SELECT U.USER_MDN,U.USER_NAME,U.USER_REGDATE,G.GROUP_NAME FROM WAP_USER U,WAP_GROUP G,WAP_GROUP_USER GU WHERE U.USER_MDN=GU.USER_MDN AND GU.GROUP_ID=G.ID AND U.USER_MDN LIKE '" + userMdn +"%' AND G.ID =" + groupId; return queryBySql(sql,beginRow,endRow); } public static Collection queryByUserGroup(String mdn,int groupId) throws SysException{ String sql = "SELECT USER_NAME,USER_PWD FROM WAP_USER WHERE USER_MDN = '" + mdn + "' AND USER_GROUP = "+ groupId; return queryBySql(sql); } public static void deleteByUserMdn(String mdn,int groupId) throws SysException{ String sql = "DELETE FROM WAP_GROUP_USER WHERE GROUP_ID="+ groupId + " AND USER_MDN ='"+mdn + "'"; if (updateBySql(sql) != 1) { throw new SysException("ERROR in updateUserAgent !! resultCount != 1"); } } public static void updateByUserMdn(String mdn) throws SysException{ String sql = "UPDATE WAP_USER SET USER_GROUP = 0 WHERE USER_MDN ='" +mdn+"'"; if (updateBySql(sql) != 1) { throw new SysException("ERROR in updateUserAgent !! resultCount != 1"); } } public static void deleteByUserMdn(String mdn) throws SysException { String sql = "DELETE FROM " + tableName + " WHERE USER_MDN ='" + mdn + "'"; updateBySql(sql); } public static Hashtable getGroupsByUserMdn(String mdn) throws SysException { Hashtable value = new Hashtable(); String sql = "SELECT GU.GROUP_ID, G.GROUP_NAME FROM " + tableName + " GU, WAP_GROUP G WHERE GU.GROUP_ID = G.ID AND USER_MDN ='" + mdn + "'"; Collection coll = queryBySql(sql); Iterator it = coll.iterator(); int i = 0; while (it.hasNext()) { Hashtable element = (Hashtable)it.next(); String groupId = (String)element.get("groupId"); String groupName = (String)element.get("groupName"); value.put(groupId, groupName); } return value; } public static int getRowCountByGroupId(int groupId, String userMdn) throws SysException { String sql = "SELECT COUNT(*) FROM WAP_GROUP_USER G WHERE G.GROUP_ID = " + groupId; sql += StringUtil.isNotEmpty(userMdn)?" AND G.USER_MDN LIKE '%" + userMdn + "%'":""; return getRowCountBySql(sql); } public static Collection queryByGroupId(int groupId, String userMdn, int beginRow, int endRow) throws SysException { String sql = "SELECT G.USER_MDN, G.USER_NAME, G.ADD_DATE USER_REGDATE FROM WAP_GROUP_USER G WHERE G.GROUP_ID = " + groupId; sql += StringUtil.isNotEmpty(userMdn)?" AND G.USER_MDN LIKE '%" + userMdn + "%'":""; return queryBySql(sql, beginRow, endRow); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -