@@ -27,23 +27,23 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -27,23 +27,23 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
{
{
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
Queryquery;
Queryquery;
StringqueryString;
StringBufferqueryString=newStringBuffer();
if(isPrev){
if(isPrev){
queryString="select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'";
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString+=" and ProjectId='"+ProjectId+"'";
queryString.append(" and ProjectId='"+ProjectId+"'");
}
}
queryString+=" 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="select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'";
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='"+type+"'");
if(ProjectId!=null){
if(ProjectId!=null){
queryString+=" and ProjectId='"+ProjectId+"'";
queryString.append(" and ProjectId='"+ProjectId+"'");
}
}
queryString+=" 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 00:00:00' ");
@@ -54,21 +54,20 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
...
@@ -54,21 +54,20 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
{
{
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
Queryquery;
Queryquery;
StringqueryString;
StringBufferqueryString=newStringBuffer();
if(isPrev){
if(isPrev){
queryString="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+=" and ProjectId='"+ProjectId+"'";
queryString.append(" and ProjectId='"+ProjectId+"'");
}
}
queryString+=" 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="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+=" and ProjectId='"+ProjectId+"'";
}
}
queryString+=" 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 00:00:00' ");
queryString.append("select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and SubType='"+subType+"'");
if(ProjectId!=null){
if(type.equals("in")){
queryString.append(" and AllocationProjectId='"+ProjectId+"'");//礼品充值时
}
elseif(type.equals("out")){
queryString.append(" and ProjectId='"+ProjectId+"'");