礼品卡管理模块

This commit is contained in:
季圣华
2017-07-15 00:33:28 +08:00
parent 8f4cac02ef
commit 883890eb00
21 changed files with 1402 additions and 52 deletions

View File

@@ -23,15 +23,26 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
String queryString;
if(isPrev) {
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 MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
else {
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 MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(OperNumber) as OperNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
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' " ;
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
@@ -39,15 +50,26 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Integer ProjectId,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
String queryString;
if(isPrev) {
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 MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
queryString += " and ProjectId='" + ProjectId +"'";
}
queryString += " and MaterialId ="+ MId + " and jsh_depothead.OperTime <'"+ MonthTime +"-01 00:00:00' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + 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 MaterialId ="+ MId + " and jsh_depothead.OperTime >='"+ MonthTime +"-01 00:00:00' and jsh_depothead.OperTime <='"+ MonthTime +"-31 00:00:00' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString = "select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='" + type +"'";
if(ProjectId!=null) {
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' ";
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());