📄 systemuseraction.java
字号:
package com.easyjf.news.action;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import com.easyjf.news.business.ActiveUser;
import com.easyjf.news.business.SystemUser;
import com.easyjf.news.business.UserUtil;
import com.easyjf.util.CommUtil;
import com.easyjf.util.MD5;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.DbPageList;
import com.easyjf.web.tools.IPageList;
public class SystemUserAction extends BaseAction {
public Object doBefore(WebForm form, Module module) {
ActiveUser u=(ActiveUser)this.getCurrentUser(form);
if(!"firstUser".equals(this.getCommand()) && (u==null)) return new Page("popedomError","/nologin.htm","page");
return null;
}
public Page doSetting(WebForm form,Module module)
{
SystemUser u=SystemUser.readByUserName(this.getCurrentUser(form).getUserName());
if(u!=null)
{
CommUtil.Obj2Map(u,form.getTextElement());
}
return module.findPage("edit");
}
public Page doFirstUser(WebForm form,Module module)
{
if(UserUtil.getUserNum().intValue()==0){
SystemUser u=(SystemUser)form.toPo(SystemUser.class);//.readByUserName(this.getCurrentUser(form).getUserName());
u.setPassword(MD5.encode(u.getPassword()));
if(u.save())
{
form.addResult("msg","用户添加成功!");
}
else
{
form.addResult("msg","用户添加失败!");
return new Page("firstPage","/manage/userInfoEdit.html","template");
}
}
return new Page("login","/manage.ejf","html");
}
public IPageList doQuery(WebForm form, int currentPage, int pageSize) {
//ActiveUser u=(ActiveUser)this.getCurrentUser(form);
String scope="1=1";
Collection paras=new ArrayList();
//paras.add(u.getDept());
DbPageList pList=new DbPageList(SystemUser.class,scope,paras);
pList.doList(currentPage,pageSize);
return pList;
}
public Object form2Obj(WebForm form) {
String cid=CommUtil.null2String(form.get("cid"));
//String method=CommUtil.null2String(form.get("easyJWebCommand"));
SystemUser obj=null;
if(cid.equals(""))
{
obj=(SystemUser)form.toPo(SystemUser.class);
obj.setInputTime(new Date());
obj.setInputUser(this.getCurrentUser(form).getUserName());
obj.setStatus(new Integer(0));
}
else
{
obj=SystemUser.read(cid);
form.toPo(obj);
}
return obj;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -