⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bo.java~5~

📁 一个专门用来快速开发网站的框架
💻 JAVA~5~
字号:
package com.ksgl.system.book;

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 com.opensymphony.xwork.ActionContext;
import com.core.Config;

/**
 * <p>Title: 图书 期刊BO类</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author hj
 * @version 1.0
 */

public class BO {
  private static Log log = LogFactory.getLog(BO.class);
  PersistenceManager pm = new PersistenceManager();
  TransactionPM tm = new TransactionPM();
  public BO() {
  }

  /**
   * add
   * */
  public void add(T_gjdw_book objmap) {
    try {
      objmap.setId(new SequenceMng().getSequence("T_gjdw_book", "图书 期刊"));
      objmap.setCzr(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getBm());
      objmap.setDw(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getMc());
      objmap.setGcdw(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getMc());
      objmap.setTbsj(Config.getNowTime_long());
      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_gjdw_book出错!");
      ex.printStackTrace();
    }
  }

  /**
   * turn page0
   */
  public List queryList0(Paging paging, Condition condition) {
    List ret = null;
    String hql = " from T_gjdw_book where 1=1 and flag=0";
    if (!condition.getCondition().equals("")) {
      hql += " " + condition.getCondition();
    }
    /**
     * 加上权限判断
     * 是共建单位的查看自己的
     * 管理员看全部
     * */
    if(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getLbbm().equals("0")||((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getLbbm().equals("1")){
        hql += " " ;
    }else{
    hql += " and czr='"+((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getBm()+"'" ;
    }
    //hql = hql + " order by mkid,updatetime DESC";
    try {
      ret = pm.queryPageObjs(hql, paging);
    }
    catch (Exception e) {
      log.error("查询queryList  T_gjdw_book出错!");
      e.printStackTrace();
    }
    return ret;
  }


  /**
   * turn page1
   */
  public List queryList1(Paging paging, Condition condition) {
    List ret = null;
    String hql = " from T_gjdw_book where 1=1 and flag=1";
    if (!condition.getCondition().equals("")) {
      hql += " " + condition.getCondition();
    }
    /**
     * 加上权限判断
     * 是共建单位的查看自己的
     * 管理员看全部
     * */
    if(((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getLbbm().equals("0")||((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getLbbm().equals("1")){
        hql += " " ;
    }else{
    hql += " and czr='"+((com.ksgl.map.T_sys_gly)ActionContext.getContext().getSession().get("user")).getBm()+"'" ;
    }
    //hql = hql + " order by mkid,updatetime DESC";
    try {
      ret = pm.queryPageObjs(hql, paging);
    }
    catch (Exception e) {
      log.error("查询queryList  T_gjdw_book出错!");
      e.printStackTrace();
    }
    return ret;
  }


  /**
     * turn page all
     */
    public List queryListAll(Paging paging, Condition condition) {
      List ret = null;
      String hql = " from T_gjdw_book where 1=1";
      if (!condition.getCondition().equals("")) {
        hql += " " + condition.getCondition();
      }
      try {
        ret = pm.queryPageObjs(hql, paging);
      }
      catch (Exception e) {
        log.error("查询queryListAll  T_gjdw_book出错!");
        e.printStackTrace();
      }
      return ret;
    }


  /**
   * no turn page query
   */
  public List queryList(Condition condition) {
    List ret = null;
    String hql = " from T_gjdw_book where 1=1";
    if (!condition.getCondition().equals("")) {
      hql += " " + condition.getCondition();
    }
   // hql = hql + " order by mkid,updatetime DESC";
    try {
      ret = pm.queryObjs(hql);
    }
    catch (Exception e) {
      log.error("查询queryList  T_gjdw_book出错!");
      e.printStackTrace();
    }
    return ret;
  }

  /**
   * query one
   * */
  public T_gjdw_book queryList1(String id) {
    List ret = null;
    T_gjdw_book T_gjdw_book = new T_gjdw_book();
    String hql = " from T_gjdw_book where id='" + id + "'";
    try {
      ret = pm.queryObjs(hql);
      T_gjdw_book = (T_gjdw_book) ret.get(0);
    }
    catch (Exception e) {
      log.error("查询id = " + id + " queryList1 T_gjdw_book出错!");
      e.printStackTrace();
    }
    return T_gjdw_book;
  }

  /**
   * update one
   * */

  public void update(T_gjdw_book objmap) {
    try {
      T_gjdw_book temp = new T_gjdw_book();
      temp = this.queryList1(""+objmap.getId());
      objmap.setCzr(temp.getCzr());
      objmap.setDw(temp.getDw());
      objmap.setGcdw(temp.getGcdw());
      objmap.setTbsj(temp.getTbsj());
      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_gjdw_book出错!");
      ex.printStackTrace();
    }
  }

  /**
   * 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_gjdw_book where id='" + names[i] +
                                   "'"));
      }
    }
    catch (Exception ex) {
      log.error("删除delete  T_gjdw_book出错!");
      ex.printStackTrace();
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -