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

📄 bo.java~10~

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

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;

/**
 * <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_answers objmap1) {
    log.info("22222222222222222222222="+objmap1.getMessageid());
    log.info("111111111111111111111111="+objmap1.getAnswer());
    log.info("33333333333333333333333="+objmap1.getUpdatetime());
    log.info("44444444444444444444444="+objmap1.getUserid());
    try {
      objmap1.setId(new SequenceMng().getSequence("Message", "留言板信息"));
 //     objmap.setHj("0");
//      new com.core.log.RecLog().add(((com.ksgl.map.T_sys_gly)ActionContext.getContext().get("user")).getBm(),"信息增加操作,id:"+objmap.getId());
      pm.saveObj(objmap1);
    }
    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_answers where 1=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_answers where 1=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_answers queryList1(String id) {
    List ret = null;
    Message_answers Message_answers = new Message_answers();
    String hql = " from Message_answers where id='" + id + "'";
    try {
      ret = pm.queryObjs(hql);
      Message_answers = (Message_answers) ret.get(0);
    }
    catch (Exception e) {
      log.error("查询id = " + id + " queryList1 Message出错!");
      e.printStackTrace();
    }
    return Message_answers;
  }

  /**
   * update one
   * */

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

}

⌨️ 快捷键说明

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