📄 usermanagecontrol.java
字号:
package cn.com.iaspec.workflow.manage.business;
import java.util.*;
import cn.com.iaspec.workflow.manage.*;
import cn.com.iaspec.workflow.manage.dao.*;
import cn.com.iaspec.workflow.util.*;
import cn.com.iaspec.workflow.vo.workflow.*;
/**
* <p>Title:用户信息控制类 </p>
*
* <p>Description: 深圳市劳动仲裁信息管理系统</p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: 永泰软件工程有限公司</p>
*
* @author syj
* @version 1.0
*/
public class UserManageControl{
PurviewManageControl manageControl=new PurviewManageControl();
GetUserManageDAO userManageDAO=new GetUserManageDAO();
/**
* 添加人员信息
* @param userinfo UserInfo
* @param la_org_user La_Org_User_Role
*/public int addUserInfo(UserInfo userinfo,WfOrgUserRole la_org_user)
throws PurviewManageException{
int i=0;
try{
String user_id=GetTableSequenceId.getTableId("wf_user");
//System.out.println("user_id====="+user_id);
userinfo.setUserId(user_id);
int flag=userManageDAO.insertUserInfo(userinfo);
if(flag!=0&flag!=-2){
la_org_user.setUser_id(user_id);
la_org_user.setRole("0");
userManageDAO.inserRelatingOrganiztion(la_org_user);
i=1;
}
else{
i=flag;
}
}
catch(Exception e){
e.printStackTrace();
throw new PurviewManageException("--添加人员信息异常---");
}
return i;
}
/**
* 更新用户信息
* @param userinfo UserInfo
* @return int
*/
public int updateUserInfo(UserInfo userinfo)
throws PurviewManageException{
int i=0;
try{
i=userManageDAO.updateUserInfo(userinfo);
}
catch(Exception e){
e.printStackTrace();
throw new PurviewManageException("---更新用户信息异常---");
}
return i;
}
/**
* 用户信息查询(user_id)
* @param user_id String
* @return UserInfo
* @throws PurviewManageException
*/
public UserInfo queryUserInfo(String user_id)
throws PurviewManageException{
UserInfo userinfo=new UserInfo();
try{
userinfo=userManageDAO.queryUserInfo(user_id);
}
catch(Exception e){
e.printStackTrace();
throw new PurviewManageException("--用户信息查询异常--");
}
return userinfo;
}
/**
* 删除用户和组织的关联信息
* @param user_id String
* @return int
* @throws PurviewManageException
*/
public int delete_org_user(String user_id,String org_id)
throws PurviewManageException{
int i=0;
try{
i=userManageDAO.deleteLa_org_user(org_id,user_id);
}
catch(Exception e){
e.printStackTrace();
throw new PurviewManageException("--删除用户和组织的关系异常--");
}
return i;
}
/**
* 用户信息查询(根据行政区号来查询,或者是查询所有的用户信息)
* @param username String
* @param area_id String
* @return ArrayList
* @throws PurviewManageException
*/
public ArrayList queryUserInfo_area_id(String username,String area_id)
throws PurviewManageException{
ArrayList list=new ArrayList();
try{
if(username.equals("系统管理员")){
list=userManageDAO.queryUserInfo();
}
else{
list=userManageDAO.queryUserInfo_areaid(area_id);
}
}
catch(Exception e){
e.printStackTrace();
throw new PurviewManageException("--用户信息查询异常--");
}
return list;
}
/**
*添加人员和组织的关系(已经存在的人员)
* @param m_ID String
* @param userarray String[]
* @return int
*/
public int inserRelatingOrganiztion(String m_ID,String[] userarray)
throws PurviewManageException{
int i=0;
WfOrgUserRole org_User_Role=new WfOrgUserRole();
org_User_Role.setOrg_id(m_ID);
org_User_Role.setRole("0");
for(int j=0;j<userarray.length;j++){
org_User_Role.setUser_id(userarray[j]);
i=userManageDAO.inserRelatingOrganiztion(org_User_Role);
}
return i;
}
/**
* 删除人员(从人员表中)
* @param userarray String[]
* @return int
*/
public int deleteUserInfo(String[] userarray)
throws PurviewManageException{
int i=0;
String st="";
for(int j=0;j<userarray.length;j++){
if(!userarray[j].equals("10001")){
st=st+",'"+userarray[j]+"'";
}
}
st=st.substring(1);
//System.out.println("------------userinfo="+st);
i=userManageDAO.delete(st);
return i;
}
public static void main(String[] args)
throws PurviewManageException{
UserManageControl usermanagecontrol=new UserManageControl();
UserInfo userinfo=new UserInfo();
userinfo.setUserName("syj");
String[] st={
"112","2145","2457","547"};
usermanagecontrol.deleteUserInfo(st);
//System.out.println(usermanagecontrol.queryUserInfo_area_id("系统管理员","02").size());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -