bo.java~14~
来自「一个专门用来快速开发网站的框架」· JAVA~14~ 代码 · 共 169 行
JAVA~14~
169 行
package com.ksgl.system.notice;
import com.core.web.Condition;
import java.util.List;
import com.core.web.Paging;
import java.net.*;
import java.util.*;
import com.ksgl.map.t_sys_notice;
import com.ksgl.map.UserInfo;
import com.ksgl.map.T_sys_gly;
import com.core.business.SequenceMng;
import com.core.persistence.PersistenceManager;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.webwork.ServletActionContext;
import com.core.Config;
import com.core.web.*;
import javax.servlet.http.*;
import com.core.log.RecLog;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class BO {
private static Log log = LogFactory.getLog(BO.class);
PersistenceManager pm = new PersistenceManager();
public BO() {
}
/**
* add
* */
public void add(t_sys_notice objmap) {
try {
objmap.setId(new SequenceMng().getSequence("t_sys_notice", "内部信息表"));
objmap.setUpdatetime(Config.getNowTime_long());
objmap.setServer("[人为操作]");
objmap.setIp(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getBm());
new com.core.log.RecLog().add(((com.ksgl.map.T_sys_gly)
ActionContext.getContext().
getSession().get("user")).getBm(),
"内部信息增加操作,id:" + objmap.getId());
pm.saveObj(objmap);
} catch (Exception ex) {
log.error("添加add t_sys_notice出错!");
ex.printStackTrace();
}
}
/**
* update one
* */
public void update(t_sys_notice objmap) {
try {
new com.core.log.RecLog().add(((com.ksgl.map.T_sys_gly)
ActionContext.getContext().
getSession().get("user")).getBm(),
"内部信息修改操作,id:" + objmap.getId());
pm.updateObj(objmap);
} catch (Exception ex) {
log.error("修改update t_sys_notice出错!");
ex.printStackTrace();
}
}
/**
* 翻页查询
* add session
*/
public List queryListSess(Paging paging, Condition condition) {
List ret = null;
String hql = " from t_sys_notice where 1=1";
hql+=" and name='"+((UserInfo)ActionContext.getContext().getSession().get("member")).getStrUserName()+"'";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql=hql+" order by updatetime desc";
try {
ret = pm.queryPageObjs(hql, paging);
}
catch (Exception e) {
log.error("查询queryListSess t_sys_notice出错!");
e.printStackTrace();
}
return ret;
}
/**
* 翻页查询
* admin manager
*/
public List queryList(Paging paging, Condition condition) {
List ret = null;
String hql = " from t_sys_notice where 1=1";
if(!((T_sys_gly)ActionContext.getContext().getSession().get("user")).getLbbm().equals("0")){
hql += " and ip='" +
( (T_sys_gly) ActionContext.getContext().getSession().get("user")).
getBm() + "'";
}
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql=hql+" order by updatetime desc";
try {
ret = pm.queryPageObjs(hql, paging);
}
catch (Exception e) {
log.error("查询queryList t_sys_notice出错!");
e.printStackTrace();
}
return ret;
}
/**
* delete more one
* */
public void delete() {
try {
String names[] = (String[]) ActionContext.getContext().getParameters().
get("id");
for (int i = 0; i < names.length; i++) {
new com.core.log.RecLog().add(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getBm(),"内部信息删除操作,id:"+names[i]);
pm.deleteObjs(pm.queryObjs(" from t_sys_notice where id='" + names[i] +
"'"));
}
}
catch (Exception ex) {
log.error("删除delete t_sys_notice出错!");
ex.printStackTrace();
}
}
/**
* query one
* */
public t_sys_notice queryOne(String id) {
List ret = null;
t_sys_notice t_sys_notice = new t_sys_notice();
String hql = " from t_sys_notice where id='" + id + "'";
try {
ret = pm.queryObjs(hql);
t_sys_notice = (t_sys_notice) ret.get(0);
}
catch (Exception e) {
log.error("查询id = " + id + " queryOne t_sys_notice出错!");
e.printStackTrace();
}
return t_sys_notice;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?