📄 delstaff.java
字号:
package com.doone.fj1w.fjmgr.sysmgr;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.doone.data.DacClient;
import com.doone.util.FileLogger;
import com.doone.uurm.Sys_Staff;
import com.doone.uurm.Sys_StaffAndOrg;
/**
* Created by IntelliJ IDEA. User: lizhx Date: 2005-7-16 Time: 16:41:04
* Email:lizx@doone.com.cn
*/
public class DelStaff extends HttpServlet {
static final private String CONTENT_TYPE = "text/html; charset=GBK";
public void init() throws ServletException {
}
public void doGet(HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws ServletException,
IOException {
httpRequest.setCharacterEncoding("GBK");
httpResponse.setContentType(CONTENT_TYPE);
PrintWriter out = httpResponse.getWriter();
DacClient db = new DacClient();
try {
String sStaffIds[] = httpRequest.getParameterValues("STAFFID");
if (sStaffIds == null)
return;
for (int i = 0; i < sStaffIds.length; i++) {
sStaffIds[i] = Util.Replace(sStaffIds[i]);
}
db.beginTransaction(-1);
for (int i = 0; i < sStaffIds.length; i++) {
if (sStaffIds[i] == null || sStaffIds[i].length() <= 0 ) continue;
// 清除(禁用)该员工下的所有组织关联。
Sys_StaffAndOrg sao[] = Sys_StaffAndOrg.getInstanceByStaff(db, Long.parseLong(sStaffIds[i]));
for ( int j=0; j<sao.length; j++) {
sao[j].delete();
sao[j].save();
}
Sys_Staff staff = Sys_Staff.getInstance(db, Long.parseLong(sStaffIds[i]));
staff.delete();
staff.save();
}
db.endTransaction(true);
out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperSuccess.jsp';</script>");
} catch (RuntimeException e) {
FileLogger.getLogger().info(e.getMessage(),e);
out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp?error="
+ Util.Replace(e.getMessage()) + "';</script>");
} catch (Exception e) {
FileLogger.getLogger().warn(e.getMessage(),e);
out.write("<script language=javascript>window.location.href='"+httpRequest.getContextPath()+"/view/sysmgr/OperFailure.jsp';</script>");
}
finally {
try {
db.endTransaction(false);
} catch(Exception e) {}
}
}
public void doPost(HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws ServletException,
IOException {
doGet(httpRequest, httpResponse);
}
// Clean up resources
public void destroy() {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -