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

📄 bo.java~62~

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

import java.util.*;

import org.apache.commons.logging.*;
import com.core.business.*;
import com.core.persistence.*;
import com.core.web.*;
import com.ksgl.map.*;
import com.opensymphony.xwork.*;

/**
 * <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(Message objmap) {
    try {

      objmap.setId(new SequenceMng().getSequence("message", "留言板信息"));
      pm.saveObj(objmap);
    }
    catch (Exception ex) {
      log.error("添加add  Message出错!");
      ex.printStackTrace();
    }
  }

  /**
   * turn page
   */
  public List queryList(Paging paging, Condition condition) {
    List ret = null;
    String hql = " from Message where question = '1'";
    if (!condition.getCondition().equals("")) {
      hql += " " + condition.getCondition();
    }
    hql = hql + " order by updatetime DESC";
    try {
      ret = pm.queryPageObjs(hql, paging);
    }
    catch (Exception e) {
      log.error("查询queryLbList  Message出错!");
      e.printStackTrace();
    }
    return ret;
  }

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

  /**
   * query one
   * */
  public Message queryList1(String id) {
    List ret = null;
    int kid=(int)Integer.parseInt(id);
    System.out.println("+++++++++++++++++++++++++");
    Message Message = new Message();
    String hql = " from Message where id=" + kid ;
    try {
      ret = pm.queryObjs(hql);
      Message = (Message) ret.get(0);
    }
    catch (Exception e) {
      log.error("查询id = " + id + " queryList1 Message出错!");
      e.printStackTrace();
    }
    return Message;
  }
  /**
   * query one messageid = id
   */
  public List queryList2(Paging paging,String id) {
  List ret = null;
  String hql = " from Message where messageid='" + id + "'";
  try {
    ret = pm.queryPageObjs(hql,paging);
  }
  catch (Exception e) {
    log.error("查询id = " + id + " queryList2 Message出错!");
    e.printStackTrace();
  }
  return ret;
}

  /**
   * update one
   * */

  public void update(Message 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 Message出错!");
      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.Message)ActionContext.getContext().getSession().get("user")).getBm(),"信息删除操作,id:"+names[i]);
        pm.deleteObjs(pm.queryObjs(" from Message where id='" + names[i] +
                                   "'"));
      }
    }
    catch (Exception ex) {
      log.error("删除delete  Message出错!");
      ex.printStackTrace();
    }
  }

  /*
   *删除单个messageid 信息
   */
  public void deleteMe(String id)
  {
    String hql="from Message where id="+id;

    try
    {
     pm.deleteObjs(pm.queryObjs(hql));
    }catch(Exception e)
    {
      log.error("删除单个message信息出错");
      e.printStackTrace();
    }
  }

  /**
   * queryList2
   *
   * @return List
   */

}

⌨️ 快捷键说明

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