/**
* @author mxl
* @param SysCard 查询条件
* @return 成功返回true,失败false
* 批量修改充值卡状态
**/
public boolean updateSysCardState(final SysCard sysCard){
boolean bool=false;
bool = (Boolean)hibernateTemplate.execute(new HibernateCallback(){
public Object doInHibernate(Session session) throws HibernateException, SQLException {
boolean updatebool=true;
try{
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuffer hql=new StringBuffer("update SysCard t set t.cstate=:cstate where 1=1");
if(BJFYSystemUtil.checkNullString(sysCard.getVchcode()).length()>0){
hql.append(" and t.vchcode like '%"+sysCard.getVchcode()+"%'");
}
if(sysCard.getNummoney()!=null && sysCard.getNummoney()>0)
hql.append(" and t.nummoney = "+sysCard.getNummoney());
if(sysCard.getDatavailability()!=null)
hql.append(" and t.datavailability>=to_date('"+sdf.format(BJFYSystemUtil.getDayBeginTime(sysCard.getDatavailability()))+"','yyyy-MM-dd HH24:mi:ss')");
if(sysCard.getDatcreate()!=null)
hql.append(" and t.datavailability<=to_date('"+sdf.format(BJFYSystemUtil.getDayBeginTime(sysCard.getDatcreate()))+"','yyyy-MM-dd HH24:mi:ss')");
if(BJFYSystemUtil.checkNullString(sysCard.getVchtype()).length()>0){
hql.append(" and t.vchtype ='"+sysCard.getVchtype()+"'");
}
if(BJFYSystemUtil.checkNullString(sysCard.getBeginCard()).length()>0)
hql.append(" and t.vchcode>='"+sysCard.getVchcode()+"'");
if(BJFYSystemUtil.checkNullString(sysCard.getEndCard()).length()>0)
hql.append(" and t.vchcode<='"+sysCard.getEndCard()+"'");
Query query = session.createQuery(hql.toString());
if(sysCard.getNumscale()!=null)
query.setParameter("cstate",sysCard.getNumscale()==null?"00":sysCard.getNumscale());
query.executeUpdate();
}catch(Exception e){
updatebool=false;
}
return updatebool;
}
},true);
return bool;
}
分享到:
相关推荐
Struts2 Spring Hiberante IBatis jar (1) 与上面上传的资源是同一的 jar的第一部分
Struts2 Spring Hiberante IBatis jar (2) 与上面上传的资源是同一的 jar的第一部分
spring4+hiberante4+struts2+maven最新框架
疯狂Ajax讲义2+Spring+hiberante
疯狂Ajax讲义3+Spring+hiberante
疯狂Ajax讲义5+Spring+hiberante
疯狂Ajax讲义4+Spring+hiberante
本Demo采用Struts2.1.8+Spring2.5.6(Annotation注解)+Hiberante3.3.2(Annotation注解)+ExtJS(Struts2-json)
Strust2.0+Spring+hiberante小例子,整合.
spring整合
Struts2+hiberante+Spring+Extjs+OA办公系统,完整包正常运行
struts2.0 +spring2.0+hiberante3所需jar包
Struts2、 Hiberante、 Spring、 Extjs、 OA办公系统,完整包
spring,Struts,Hiberante整合的小例子,源代码,没有开发包(因为太大了)
源码+数据库+jsp页面+html页面设计 初学者
使用MAVEN 结合SPRING DWR hiberante validation
hiberante3 注解帮助文档hiberante3 注解帮助文档hiberante3 注解帮助文档hiberante3 注解帮助文档hiberante3 注解帮助文档
学习struts2+hiberanate3.5+spring3.0 (annotation)的好项目
DAO层中对Hiberante实例,大家交流一下