📄 bo.java
字号:
package com.ksgl.body.index;
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(T_sys_news objmap) {
try {
objmap.setId(new SequenceMng().getSequence("t_sys_news", "信息"));
pm.saveObj(objmap);
}
catch (Exception ex) {
log.error("添加add T_sys_news出错!");
ex.printStackTrace();
}
}
/**
*
* add留言
* */
public void add1(T_sys_wytw objmap) {
try {
pm.saveObj(objmap);
}
catch (Exception ex) {
log.error("添加add T_sys_wytw出错!");
ex.printStackTrace();
}
}
/**
* turn page
* 留言
*/
public List queryListly(Paging paging, Condition condition) {
List ret = null;
String hql = " from T_sys_wytw 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("查询 留言 T_sys_wytw出错!");
e.printStackTrace();
}
return ret;
}
/**
* query one留言
* */
public T_sys_wytw queryListly2(String id) {
List ret = null;
T_sys_wytw T_sys_wytw = new T_sys_wytw();
String hql = " from T_sys_wytw where id='" + id + "'";
try {
ret = pm.queryObjs(hql);
T_sys_wytw = (T_sys_wytw) ret.get(0);
}
catch (Exception e) {
log.error("查询id = " + id + " queryList1 T_sys_wytw出错!");
e.printStackTrace();
}
return T_sys_wytw;
}
/**
* turn page
* 新闻
*/
public List queryList(Paging paging, Condition condition,String mkid) {
List ret = null;
String hql="";
if(mkid.equals("1000"))
{
hql = " from T_sys_news where 1=1 and mkid in ('22','23')";
}else
{
hql = " from T_sys_news where 1=1 and mkid in ("+mkid+")";
}
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 T_sys_news出错!");
e.printStackTrace();
}
return ret;
}
/**
* turn page
* 成果发布新闻
*/
public List queryListCg(Paging paging, Condition condition) {
List ret = null;
String hql = " from Cgk2006 ";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by GATHERDATE DESC";
try {
ret = pm.queryPageObjs(hql, paging);
}
catch (Exception e) {
log.error("查询queryListCg 成果发布list--->出错!");
e.printStackTrace();
}
return ret;
}
/**
* turn page
* 成果发布新闻查询单个数据
*/
public List queryoneCg(int id) {
List ret = null;
String hql = " from Cgk2006 where ID="+id;
try {
ret = pm.queryObjs(hql);
}
catch (Exception e) {
log.error("查询QueryOneCg.action 成果发布--->出错!");
e.printStackTrace();
}
return ret;
}
/**
* turn page
* 新闻
*/
public List queryList3(Paging paging, Condition condition) {
List ret = null;
String hql = " from T_sys_news where 1=1";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by mkid,updatetime DESC";
try {
ret = pm.queryPageObjs(hql, paging);
}
catch (Exception e) {
log.error("查询queryLbList T_sys_news出错!");
e.printStackTrace();
}
return ret;
}
/**
* turn page
* 相关研究
*/
public List queryList1(Paging paging, Condition condition) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid=2";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by mkid,updatetime DESC";
try {
ret = pm.queryPageObjs(hql, paging);
}
catch (Exception e) {
log.error("查询 相关研究queryList2 T_sys_news出错!");
e.printStackTrace();
}
return ret;
}
/**
* 首页数据
*
*/
public List queryListindex(Condition condition,String mkid,int start,int count) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid in ("+mkid+")";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by updatetime DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(start,count);
}
catch (Exception e) {
}
return ret;
}
/*合作几乎
*/
public List queryListindex2(Condition condition,String mkid,int start,int count) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid in ("+mkid+") and state='4'";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by updatetime DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(start,count);
}
catch (Exception e) {
}
return ret;
}
//图片新闻
public List queryListindextp(Condition condition) {
List ret = null;
String hql = " from T_sys_news where image<>'' and mkid=8";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by updatetime DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(0,5);
}
catch (Exception e) {
}
return ret;
}
/**
* tp数据
*
*/
public List queryListindex1(Condition condition,String mkid,int start,int count) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid="+mkid+" and image!=''";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by updatetime DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(start,count);
}
catch (Exception e) {
}
return ret;
}
public List queryListindex1(Condition condition,int start,int count) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid in ('22','23') and image!=''";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by updatetime DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(start,count);
}
catch (Exception e) {
}
return ret;
}
/**
* no turn page query
* 首页显示
* 近30天的信息
*/
public List queryList(Condition condition) {
List ret = null;
String hql = " from T_sys_news where 1=1 and mkid=0";
//and DATEDIFF(day, updatetime, getdate())<=90
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_sys_news出错!");
e.printStackTrace();
}
return ret;
}
/**
* query one
* */
public T_sys_news queryList1(String id) {
List ret = null;
T_sys_news T_sys_news = new T_sys_news();
String hql = " from T_sys_news where id='" + id + "'";
try {
ret = pm.queryObjs(hql);
T_sys_news = (T_sys_news) ret.get(0);
}
catch (Exception e) {
log.error("查询id = " + id + " queryList1 T_sys_news出错!");
e.printStackTrace();
}
return T_sys_news;
}
/**
* update one
* */
public void update(T_sys_news objmap) {
try {
pm.updateObj(objmap);
}
catch (Exception ex) {
log.error("修改update T_sys_news出错!");
ex.printStackTrace();
}
}
/**
* query one,and add 1
* */
public void updateAdd(T_sys_news objmap) {
try {
objmap.setHj(""+(Integer.parseInt(objmap.getHj())+1));
pm.updateObj(objmap);
}
catch (Exception ex) {
log.error("修改update T_sys_news出错!");
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++) {
pm.deleteObjs(pm.queryObjs(" from T_sys_news where id='" + names[i] +
"'"));
}
}
catch (Exception ex) {
log.error("删除delete T_sys_news出错!");
ex.printStackTrace();
}
}
/**
* queryListCountCg
*
* @param condition Condition
* @param i int
* @param i1 int
* @return List
*/
/**
* 获得成果发布里的共有多少条数据
*
*/
/**
* queryListindexCg
*
* @param condition Condition
* @param i int
* @param i1 int
* @return List
*/
/**
* 首页成果发布数据
*
*/
public List queryListindexCg(Condition condition, int i, int i1) {
List ret = null;
String hql = " from Cgk2006 ";
if (!condition.getCondition().equals("")) {
hql += " " + condition.getCondition();
}
hql = hql + " order by GATHERDATE DESC";
try {
ret = pm.queryObjs(hql);
ret = ret.subList(i,i1);
}
catch (Exception e) {
}
return ret;
}
/**
* 站内搜索
*
*/
public List queryListSearch(Paging paging, Condition condition,String mkid) {
List ret = null;
String hql ="";
if(mkid.equals("2")){
hql="from T_sys_news where 1=1 and mkid in (2,3,4,5,6,7)";
}else{
hql= " from T_sys_news where 1=1 and mkid in ("+mkid+")";
}
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 T_sys_news出错!");
e.printStackTrace();
}
return ret;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -