bo.java~6~
来自「一个专门用来快速开发网站的框架」· JAVA~6~ 代码 · 共 210 行
JAVA~6~
210 行
package com.ksgl.system.ini;/** * <p>Title: literature item </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: </p> * @author hj * @version 1.0 */import java.util.*;import com.core.web.Paging;import com.core.persistence.PersistenceManager;import com.core.persistence.TransactionPM;import com.core.web.*;import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.Log;import com.core.business.SequenceMng;import org.apache.commons.beanutils.BeanUtils;import com.ksgl.map.*;import org.apache.commons.logging.*;import com.opensymphony.xwork.*;import com.common.encrypt.*;import com.core.persistence.*;import javax.servlet.http.HttpServletRequest;import com.opensymphony.webwork.ServletActionContext;import javax.servlet.http.HttpSession;import com.opensymphony.xwork.ActionContext;public class BO { private static Log log = LogFactory.getLog(BO.class); PersistenceManager pm = new PersistenceManager(); TransactionPM tm = new TransactionPM(); private T_sys_webxx xx; public BO() { } /** * 增加 * 可以批量增加 */ public void add(T_sys_webxx objmap) { try { objmap.setId(new SequenceMng().getSequence("T_sys_webxx", "网站基本信息")); pm.saveObj(objmap); } catch (Exception ex) { log.error("添加add T_sys_webxx出错!"); ex.printStackTrace(); } } /** * 修改 * 修改对应id的一个记录 * */ public void update(T_sys_webxx objmap) { try { pm.updateObj(objmap); } catch (Exception ex) { log.error("修改update T_sys_webxx出错!"); ex.printStackTrace(); } } /** * 删除 * 可以批量删除。 * */ public void delete() { try { String names[] = (String[]) ActionContext.getContext().getParameters(). get("id"); for (int i = 0; i < names.length; i++) { pm.deleteObjs(pm.queryObjs(" from T_sys_webxx where id='" + names[i] + "'")); } } catch (Exception ex) { log.error("删除delete T_sys_webxx出错!"); ex.printStackTrace(); } } /** * 全部查询 */ public List queryList() { List ret = null; String hql = " from T_sys_webxx"; try { ret = pm.queryObjs(hql); } catch (Exception e) { log.error("查询queryList T_sys_webxx出错!"); e.printStackTrace(); } return ret; } /** * 查询 * 单个详细信息 * */ public T_sys_webxx queryList1(String id) { List ret = null; T_sys_webxx T_sys_webxx = new T_sys_webxx(); String hql = " from T_sys_webxx where id='" + id + "'"; try { ret = pm.queryObjs(hql); T_sys_webxx = (T_sys_webxx) ret.get(0); } catch (Exception e) { log.error("查询id = " + id + " queryLbList1 T_sys_webxx出错!"); e.printStackTrace(); } return T_sys_webxx; } /** * obj * */ public void queryObj() { try { T_sys_webxx T_sys_webxx = new T_sys_webxx(); T_sys_webxx = this.queryList1("1"); setXx(T_sys_webxx); HttpServletRequest request = ServletActionContext.getRequest(); HttpSession session = request.getSession(); if (session.getAttribute("sysobjmap") != null) { session.removeAttribute("sysobjmap"); } session.setAttribute("sysobjmap", xx); } catch (Exception e) { log.error("查询出错!"); e.printStackTrace(); } } /** * 翻页查询 */ public List queryList(Paging paging, Condition condition) { List ret = null; String hql = " from T_sys_webxx where 1=1"; if (!condition.getCondition().equals("")) { hql += " " + condition.getCondition(); } hql=hql+" order by ztbz,gglbid,ngsj DESC"; try { ret = pm.queryPageObjs(hql, paging); } catch (Exception e) { log.error("查询queryLbList T_sys_webxx出错!"); e.printStackTrace(); } return ret; } /** * 首页查询 */ public List querySyList() { List ret = null; String hql = " from T_sys_webxx where 1=1"; hql += " and kssj<getdate() and jssj>getdate() and ztbz='2'"; hql=hql+" order by ztbz,gglbid,ngsj DESC"; try { ret = pm.queryObjs(hql); } catch (Exception e) { log.error("查询queryLbList T_sys_webxx出错!"); e.printStackTrace(); } return ret; } public void backup(){ List list = null; list = tm.executeSQLQuery("backup database oa to disk='h:\\dddddddddd.BAK'"); } public static void main(String[] args) { new BO().backup(); } public T_sys_webxx getXx() { return xx; } public void setXx(T_sys_webxx xx) { this.xx = xx; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?