更新后端代码
This commit is contained in:
@@ -20,7 +20,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
{
|
||||
return DepotItem.class;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException
|
||||
@@ -29,19 +29,19 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
Query query;
|
||||
StringBuffer queryString = new StringBuffer();
|
||||
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) {
|
||||
queryString.append(" and ProjectId='" + ProjectId +"'");
|
||||
queryString.append(" and DepotId='" + ProjectId +"'");
|
||||
}
|
||||
queryString.append(" and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ");
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
else {
|
||||
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) {
|
||||
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' ");
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
@@ -58,16 +58,16 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
if (isPrev) {
|
||||
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) {
|
||||
queryString.append(" and ProjectId='" + ProjectId + "'");
|
||||
queryString.append(" and DepotId='" + ProjectId + "'");
|
||||
}
|
||||
queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime <'" + MonthTime + "-01 00:00:00' ");
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
} else {
|
||||
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) {
|
||||
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' ");
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
}
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
@@ -81,10 +81,10 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
|
||||
Query query;
|
||||
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 {
|
||||
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.setPageList(query.list());
|
||||
@@ -103,7 +103,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
|
||||
queryString.append(" and AllocationProjectId='" + ProjectId +"'"); //礼品充值时
|
||||
}
|
||||
else if(type.equals("out")){
|
||||
queryString.append(" and ProjectId='" + ProjectId +"'");
|
||||
queryString.append(" and DepotId='" + ProjectId +"'");
|
||||
}
|
||||
}
|
||||
queryString.append(" and MaterialId ="+ MId);
|
||||
|
||||
Reference in New Issue
Block a user