@@ -29,19 +29,19 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -29,19 +29,19 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
Queryquery;
Queryquery;
StringBufferqueryString=newStringBuffer();
StringBufferqueryString=newStringBuffer();
if(isPrev){
if(isPrev){
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString.append(" and ProjectId='"+ProjectId+"'");
queryString.append(" and DepotId='"+ProjectId+"'");
}
}
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime <'"+MonthTime+"-01 00:00:00' ");
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime <'"+MonthTime+"-01 00:00:00' ");
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString.append(" and ProjectId='"+ProjectId+"'");
queryString.append(" and DepotId='"+ProjectId+"'");
}
}
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 00:00:00' ");
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 59:59:59' ");
@@ -58,16 +58,16 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -58,16 +58,16 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
if(isPrev){
if(isPrev){
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString.append(" and ProjectId='"+ProjectId+"'");
queryString.append(" and DepotId='"+ProjectId+"'");
}
}
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime <'"+MonthTime+"-01 00:00:00' ");
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime <'"+MonthTime+"-01 00:00:00' ");
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString.append(" and ProjectId='"+ProjectId+"'");
queryString.append(" and DepotId='"+ProjectId+"'");
}
}
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 00:00:00' ");
queryString.append(" and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 59:59:59' ");
@@ -81,10 +81,10 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -81,10 +81,10 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
Queryquery;
Queryquery;
if(sumType.equals("Number")){
if(sumType.equals("Number")){
query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and subType='"+subType+"' and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 00:00:00' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and subType='"+subType+"' and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 59:59:59' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
}
else{
else{
query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and subType='"+subType+"' and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 00:00:00' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
query=this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"' and subType='"+subType+"' and MaterialId ="+MId+" and jsh_depothead.OperTime >='"+MonthTime+"-01 00:00:00' and jsh_depothead.OperTime <='"+MonthTime+"-31 59:59:59' "+SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
pageUtil.setPageList(query.list());
...
@@ -103,7 +103,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -103,7 +103,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
queryString.append(" and AllocationProjectId='"+ProjectId+"'");//礼品充值时
queryString.append(" and AllocationProjectId='"+ProjectId+"'");//礼品充值时
}
}
elseif(type.equals("out")){
elseif(type.equals("out")){
queryString.append(" and ProjectId='"+ProjectId+"'");
queryString.append(" and DepotId='"+ProjectId+"'");