- 博客(0)
- 资源 (11)
空空如也
新闻发布系统
主要实现新闻发布,即时查询:
public List selectByPage(final PageBean pb) throws Exception {
return template.execute(new HibernateCallback<List>() {
public List doInHibernate(Session session) throws HibernateException,SQLException {
List list = null;
Query query = session.cre
2015-04-02
ssh多条件查询
类似于赶集网的租房的多条件查询,查询代码如下:
public List<FinancialProduct> select(FinancialProduct f) throws Exception {
Set<FinancialProduct> sets=new HashSet<FinancialProduct>();
StringBuffer hql=new StringBuffer();
hql.append("from FinancialProduct fp where 1=1");
if(f.getProductType()!=null){
hql.append("and fp.productType='").append(f.getProductType()).append("'");
}
if(f.getLevels()!=null){
hql.append("and fp.levels='").append(f.getLevels()).append("'");
}
if(f.getAttention()!=null){
hql.append("and fp.attention='").append(f.getAttention()).append("'");
}
if(f.getMoney()!=null){
hql.append("and fp.money='").append(f.getMoney()).append("'");
}
if(f.getServiceGroup()!=null){
hql.append("and fp.serviceGroup='").append(f.getServiceGroup()).append("'");
}
String s = hql.toString();
List<FinancialProduct> list = template.find(s);
return list;
}
2015-04-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人