//模型驱动
private UserInfo model = new UserInfo();
private List<Dictionary> list;
private List<Role> rolelist;
private PageModel pageModel;
private int statusCode = 200;
private String tipsMessage;
public String forwardUrl;
public String rel;
public String navTabId;
public String callbackType;
private int pageNum=1;
private int numPerPage=10 ;
public String qureypage(){
UserDao dao = new UserDao();
pageModel = dao.query(model, this.pageNum, this.numPerPage);
return "list";
}
public String addpage(){
DictionaryDao dicdao = new DictionaryDao();
list = dicdao.getDic();
RoleDao roledao = new RoleDao();
rolelist = roledao.getRole();
return "addpage";
}
public String updatepage() throws IllegalAccessException, InvocationTargetException{
UserDao dao = new UserDao();
UserInfo user = dao.qureyByid(model.getId());
BeanUtils.copyProperties(model, user);
DictionaryDao dicdao = new DictionaryDao();
list = dicdao.getDic();
RoleDao roledao = new RoleDao();
rolelist = roledao.getRole();
return "addpage";
}
public String deletesave(){
UserDao dao = new UserDao();
int i = dao.delete(model);
if(i>0){
return returnCommand();
}else{
return returnCommand("失败了,请重新操作");
}
}
public String updatesave(){
UserDao dao = new UserDao();
int i = dao.update(model);
if(i>0){
return returnCommand();
}else{
return returnCommand("失败了,请重新操作");
}
}
public String addupdate(){
UserDao dao = new UserDao();
if(model.getId()==null||model.getId().trim().equals("")){
int i = dao.add(model);
if(i>0){
return returnCommand();
}else{
return returnCommand("失败了,请重新操作");
}
}else{
int j = dao.update(model);
if(j>0){
return returnCommand();
}else{
return returnCommand("失败了,请重新操作");
}
}
}