hfservice.java
来自「java带进度条上传尽量不要让站长把时间都花费在为您修正说明上」· Java 代码 · 共 93 行
JAVA
93 行
package com.jmwl.biz;
import java.util.ArrayList;
import java.util.List;
import com.jmwl.common.BlogException;
import com.jmwl.dao.HFDAO;
import com.jmwl.dto.HFDTO;
import com.jmwl.vo.HFVO;
public class HFService extends BasicService
{
/**
* 插入一条留言
* @param info
* @return
* @throws BlogException
*/
public boolean addhf(HFDTO info) throws BlogException
{
boolean b=false;
HFDAO hf=new HFDAO();
this.getConn(); //开启数据库连接,让conn有连接
hf.setConn(conn);
b=hf.addhf(info);
return b;
}
/**
* 得到指定页码的留言
* @param id
* @param currpage
* @return
* @throws BlogException
*/
public List<HFVO> gethf(int id,int currpage) throws BlogException
{
List<HFVO> list=new ArrayList();
HFDAO hf=new HFDAO();
this.getConn(); //开启数据库连接,让conn有连接
hf.setConn(conn);
list=hf.gethf(id,currpage);
return list;
}
/**
* 得到留言的总数
* @param id
* @return
* @throws BlogException
*/
public int getcounthf(int id) throws BlogException
{
int n=0;
HFDAO hf=new HFDAO();
this.getConn(); //开启数据库连接,让conn有连接
hf.setConn(conn);
n=hf.getcounthf(id);
return n;
}
public int getpage(int id) throws BlogException
{
int n=0;
int page=getcounthf(id);
if(page==0)
{
page=1;
}
if(page%8==0)
{
n=page/8;
}
else
{
n=page/8+1;
}
return n;
}
public static void main(String []args) throws BlogException
{
HFService h=new HFService();
// HFDTO info=new HFDTO();
// info.setUid(1);
// info.setUser_id(1);
// info.setContext("adfasdfasdf");
// h.addhf(info);
// System.out.println(h.getcounthf(1));
List<HFVO> list=h.gethf(1, 1);
for(HFVO info:list)
{
System.out.println(info.getContext());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?