package com.xinhua.rmp.push.dao.impl;
import java.util.ArrayList;
import java.util.List;
import com.xinhua.rmp.common.BaseSessionFactory;
import com.xinhua.rmp.common.Pager;
import com.xinhua.rmp.push.bean.AppDevice;
import com.xinhua.rmp.push.dao.AppDeviceDao;
import com.xinhua.rmp.push.domain.AppDeviceQueryConditions;
public class AppDeviceDaoImpl extends BaseSessionFactory implements AppDeviceDao {
@Override
public int add(AppDevice info) {
return (Integer) super.add(info);
}
@Override
public boolean delete(int id) {
return (Boolean) super.deleteById(AppDevice.class, id);
}
@Override
public boolean update(AppDevice info) {
return (Boolean)super.update(info);
}
@Override
public List<AppDevice> query(AppDeviceQueryConditions conditions, Pager pager) {
String hql = null;
String totalCountHql = null;
List<Object> list = new ArrayList<Object>();
if(conditions.getMessageId().equals("")){
hql = "from AppDevice where 1=1";
totalCountHql = "select count(*) from AppDevice where 1=1";
}else
if(conditions.getMessageId().equals("-1")){
hql = "from AppDevice where 1=1";
totalCountHql = "select count(*) from AppDevice where 1=1";
}else{
hql = "from AppDevice where appId in(select appId from Message where id ="+conditions.getMessageId()+")";
totalCountHql = "select count(*) from AppDevice where appId in(select appId from Message where id ="+conditions.getMessageId()+")";
}
Object[] params = list.toArray();
pager.setTotalNum(super.getTotalCount(totalCountHql, params));
return super.query(hql, pager, params);
}
}
1 个解决方案
#1
另一个表的impl和这个差不多,跪求大神指点?
#1
另一个表的impl和这个差不多,跪求大神指点?