📄 loginaction.java
字号:
package com.csu.crm.login.action;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.csu.crm.common.dao.original.CrmBulletinDAO;
import com.csu.crm.common.vo.CrmEmployee;
import com.csu.crm.common.vo.CrmRight;
import com.csu.crm.login.dao.LoginCrmEmpRoleDAO;
import com.csu.crm.login.dao.LoginCrmEmployeeDAO;
import com.csu.crm.login.form.LoginForm;
public class LoginAction extends Action {
private LoginCrmEmployeeDAO logincrmEmployeeDAO;
private LoginCrmEmpRoleDAO logincrmEmpRoleDAO;
private CrmBulletinDAO crmBulletinDAO;
public LoginCrmEmployeeDAO getLogincrmEmployeeDAO() {
return logincrmEmployeeDAO;
}
public void setLogincrmEmployeeDAO(LoginCrmEmployeeDAO logincrmEmployeeDAO) {
this.logincrmEmployeeDAO = logincrmEmployeeDAO;
}
public LoginCrmEmpRoleDAO getLogincrmEmpRoleDAO() {
return logincrmEmpRoleDAO;
}
public void setLogincrmEmpRoleDAO(LoginCrmEmpRoleDAO logincrmEmpRoleDAO) {
this.logincrmEmpRoleDAO = logincrmEmpRoleDAO;
}
public CrmBulletinDAO getCrmBulletinDAO() {
return crmBulletinDAO;
}
public void setCrmBulletinDAO(CrmBulletinDAO crmBulletinDAO) {
this.crmBulletinDAO = crmBulletinDAO;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
System.out.println("sdf");
LoginForm loginf = (LoginForm)form;
String username = loginf.getUsername();
String pass = loginf.getPassword();
System.out.println(username);
System.out.println(pass);
CrmEmployee crmEmployee =findEmployee(username, pass,request);
if(crmEmployee!=null){
System.out.println("if begin");
findBullent(crmEmployee,request);
System.out.println("findBullent end");
findEmpRple(crmEmployee,request);
System.out.println("findEmpRple end");
return null;
}
request.setAttribute("loginEmployee",crmEmployee);
return mapping.findForward("");
}
public CrmEmployee findEmployee(String loginid,String pass,HttpServletRequest request){
System.out.println("findEmployee begin");
CrmEmployee crmEmployee=logincrmEmployeeDAO.findbyidandpass(loginid, pass);
System.out.println("findEmployee end");
return crmEmployee;
}
public void findEmpRple(CrmEmployee crmEmployee,HttpServletRequest request){
System.out.println("findEmpRple begin");
String id = crmEmployee.getEmployeeId();
System.out.println(id);
List list = logincrmEmpRoleDAO.findbyid(id);
Iterator it=list.iterator();
while(it.hasNext()){
System.out.println(" begin while");
CrmRight right = (CrmRight)it.next();
System.out.println(right.getRightId());
System.out.println(right.getNode());
System.out.println(right.getLinkAddr());
System.out.println(right.getCrmRight().getNode());
System.out.println(right.getIsleaf());
System.out.println(right.getIsusable());
}
request.setAttribute("treeList",list);
}
public void findBullent(CrmEmployee crmEmployee,HttpServletRequest request){
List list = crmBulletinDAO.findByProperty("crmEmployee", crmEmployee);
if(!list.isEmpty()){
System.out.println(list.size());
}
request.setAttribute("loginBulletinList",list);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -