format code

This commit is contained in:
AlanGao
2018-04-07 13:09:49 +08:00
parent 546aa7ec40
commit 458409b463
3 changed files with 449 additions and 445 deletions

View File

@@ -10,6 +10,9 @@ import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import com.jsh.util.SearchConditionUtil; import com.jsh.util.SearchConditionUtil;
/**
* @author alan
*/
public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadIDAO public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadIDAO
{ {
/** /**
@@ -23,6 +26,7 @@ public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadI
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override
public void find(PageUtil<AccountHead> pageUtil,String maxid) throws JshException public void find(PageUtil<AccountHead> pageUtil,String maxid) throws JshException
{ {
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from AccountHead accountHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from AccountHead accountHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
@@ -31,6 +35,7 @@ public class AccountHeadDAO extends BaseDAO<AccountHead> implements AccountHeadI
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override
public void findAllMoney(PageUtil<AccountHead> pageUtil, Integer supplierId, String type, String mode) throws JshException public void findAllMoney(PageUtil<AccountHead> pageUtil, Integer supplierId, String type, String mode) throws JshException
{ {
Query query; Query query;

View File

@@ -1,188 +1,176 @@
package com.jsh.dao.materials; package com.jsh.dao.materials;
import org.hibernate.Query;
import com.jsh.base.BaseDAO; import com.jsh.base.BaseDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem; import com.jsh.model.po.DepotItem;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
import com.jsh.util.SearchConditionUtil; import com.jsh.util.SearchConditionUtil;
import org.hibernate.Query;
public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO {
{ /**
/**
* 设置dao映射基类 * 设置dao映射基类
*
* @return * @return
*/ */
@Override @Override
public Class<DepotItem> getEntityClass() public Class<DepotItem> getEntityClass() {
{
return DepotItem.class; return DepotItem.class;
} }
private final static String TYPE = "入库";
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void findByType(PageUtil<DepotItem> pageUtil,String type,Integer dId,Long MId,String MonthTime,Boolean isPrev) throws JshException { public void findByType(PageUtil<DepotItem> pageUtil, String type, Integer dId, Long MId, String MonthTime, Boolean isPrev) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便 //多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query; Query query;
StringBuffer queryString = new StringBuffer(); StringBuilder queryString = new StringBuilder();
if(type.equals("入库")) { if (TYPE.equals(type)) {
if (isPrev) { if (isPrev) {
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id "); queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " + queryString.append(" and ((type='入库' and DepotId='").append(dId).append("') ").append(" or (SubType='调拨' and AnotherDepotId='").append(dId).append("') ").append(" or (SubType='礼品充值' and AnotherDepotId='").append(dId).append("')) ");
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " + queryString.append(" and MaterialId =").append(MId).append(" and dh.OperTime <'").append(MonthTime).append("-01 00:00:00' ");
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) "); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString.append(" and MaterialId =" + MId + " and dh.OperTime <'" + MonthTime + "-01 00:00:00' "); } else {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
} else { queryString.append(" and ((type='入库' and DepotId='").append(dId).append("') ").append(" or (SubType='调拨' and AnotherDepotId='").append(dId).append("') ").append(" or (SubType='礼品充值' and AnotherDepotId='").append(dId).append("')) ");
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id "); queryString.append(" and MaterialId =").append(MId).append(" and dh.OperTime >='").append(MonthTime).append("-01 00:00:00' and dh.OperTime <='").append(MonthTime).append("-31 59:59:59' ");
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " + }
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) "); } else {
queryString.append(" and MaterialId =" + MId + " and dh.OperTime >='" + MonthTime + "-01 00:00:00' and dh.OperTime <='" + MonthTime + "-31 59:59:59' "); if (isPrev) {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
} queryString.append(" and DepotId='").append(dId).append("'");
} queryString.append(" and MaterialId =").append(MId).append(" and jsh_depothead.OperTime <'").append(MonthTime).append("-01 00:00:00' ");
else { query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
if (isPrev) { } else {
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'"); queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
queryString.append(" and DepotId='" + dId + "'"); queryString.append(" and DepotId='").append(dId).append("'");
queryString.append(" and MaterialId =" + MId + " and jsh_depothead.OperTime <'" + MonthTime + "-01 00:00:00' "); queryString.append(" and MaterialId =").append(MId).append(" and jsh_depothead.OperTime >='").append(MonthTime).append("-01 00:00:00' and jsh_depothead.OperTime <='").append(MonthTime).append("-31 59:59:59' ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
} else { }
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'"); }
queryString.append(" and DepotId='" + dId + "'");
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()); pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list()); pageUtil.setPageList(query.list());
} }
@SuppressWarnings("unchecked")
@Override
public void findPriceByType(PageUtil<DepotItem> pageUtil,String type,Integer dId,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuffer queryString = new StringBuffer();
if(type.equals("入库")) {
if (isPrev) {
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " +
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " +
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) ");
queryString.append(" and MaterialId =" + MId + " and dh.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 di,jsh_depothead dh where di.HeaderId = dh.id ");
queryString.append(" and ((type='入库' and DepotId='" + dId + "') " +
" or (SubType='调拨' and AnotherDepotId='" + dId + "') " +
" or (SubType='礼品充值' and AnotherDepotId='" + dId + "')) ");
queryString.append(" and MaterialId =" + MId + " and dh.OperTime >='" + MonthTime + "-01 00:00:00' and dh.OperTime <='" + MonthTime + "-31 59:59:59' ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
}
else {
if (isPrev) {
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
queryString.append(" and DepotId='" + dId + "'");
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='出库'");
queryString.append(" and DepotId='" + dId + "'");
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());
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
@Override
public void findByTypeAndMaterialId(PageUtil<DepotItem> pageUtil,String type,Long MId) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuffer queryString = new StringBuffer();
if(type.equals("入库")) {
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='入库'");
queryString.append(" and MaterialId ="+ MId);
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
else {
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='出库'");
queryString.append(" and SubType!='调拨' and SubType!='礼品充值' and MaterialId ="+ MId);
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
@Override
public void findDetailByTypeAndMaterialId(PageUtil<DepotItem> pageUtil,Long MId) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuffer queryString = new StringBuffer();
queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType, " +
"case when type='入库' then di.BasicNumber when type='出库' then 0-di.BasicNumber else 0 end as b_num, " +
"date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime " +
"from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type!='其它' " +
"and SubType!='调拨' and SubType!='礼品充值' ");
queryString.append(" and MaterialId ="+ MId +" ORDER BY oTime desc ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
// 分页查询
int pageNo = pageUtil.getCurPage();
int pageSize = pageUtil.getPageSize();
if (0 != pageNo && 0 != pageSize) {
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
}
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void buyOrSale(PageUtil<DepotItem> pageUtil,String type, String subType,Long MId,String MonthTime, String sumType) throws JshException public void findPriceByType(PageUtil<DepotItem> pageUtil, String type, Integer dId, Long MId, String MonthTime, Boolean isPrev) throws JshException {
{ //多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便 Query query;
Query query; StringBuilder queryString = new StringBuilder();
if(sumType.equals("Number")) { if (TYPE.equals(type)) {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(BasicNumber) as BasicNumber 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())); if (isPrev) {
} queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh where di.HeaderId = dh.id ");
else { queryString.append(" and ((type='入库' and DepotId='").append(dId).append("') ").append(" or (SubType='调拨' and AnotherDepotId='").append(dId).append("') ").append(" or (SubType='礼品充值' and AnotherDepotId='").append(dId).append("')) ");
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())); queryString.append(" and MaterialId =").append(MId).append(" and dh.OperTime <'").append(MonthTime).append("-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 di,jsh_depothead dh where di.HeaderId = dh.id ");
queryString.append(" and ((type='入库' and DepotId='").append(dId).append("') ").append(" or (SubType='调拨' and AnotherDepotId='").append(dId).append("') ").append(" or (SubType='礼品充值' and AnotherDepotId='").append(dId).append("')) ");
queryString.append(" and MaterialId =").append(MId).append(" and dh.OperTime >='").append(MonthTime).append("-01 00:00:00' and dh.OperTime <='").append(MonthTime).append("-31 59:59:59' ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
} else {
if (isPrev) {
queryString.append("select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'");
queryString.append(" and DepotId='").append(dId).append("'");
queryString.append(" and MaterialId =").append(MId).append(" and jsh_depothead.OperTime <'").append(MonthTime).append("-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='出库'");
queryString.append(" and DepotId='").append(dId).append("'");
queryString.append(" and MaterialId =").append(MId).append(" and jsh_depothead.OperTime >='").append(MonthTime).append("-01 00:00:00' and jsh_depothead.OperTime <='").append(MonthTime).append("-31 59:59:59' ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
} }
pageUtil.setTotalCount(query.list().size()); pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list()); pageUtil.setPageList(query.list());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void findGiftByType(PageUtil<DepotItem> pageUtil,String subType,Integer ProjectId,Long MId,String type) throws JshException public void findByTypeAndMaterialId(PageUtil<DepotItem> pageUtil, String type, Long MId) throws JshException {
{ //多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便 Query query;
Query query; StringBuilder queryString = new StringBuilder();
StringBuffer queryString = new StringBuffer(); if (TYPE.equals(type)) {
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and jsh_depothead.SubType='" + subType +"'"); queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='入库'");
if(ProjectId!=null) { queryString.append(" and MaterialId =").append(MId);
if(type.equals("in")){ query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
queryString.append(" and jsh_depotitem.AnotherDepotId='" + ProjectId +"'"); //礼品充值时 } else {
} queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type='出库'");
else if(type.equals("out")){ queryString.append(" and SubType!='调拨' and SubType!='礼品充值' and MaterialId =").append(MId);
queryString.append(" and jsh_depotitem.DepotId='" + ProjectId +"'"); query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
} }
} pageUtil.setTotalCount(query.list().size());
queryString.append(" and jsh_depotitem.MaterialId ="+ MId); pageUtil.setPageList(query.list());
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); }
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list()); @SuppressWarnings("unchecked")
} @Override
public void findDetailByTypeAndMaterialId(PageUtil<DepotItem> pageUtil, Long MId) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuilder queryString = new StringBuilder();
queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType, " +
"case when type='入库' then di.BasicNumber when type='出库' then 0-di.BasicNumber else 0 end as b_num, " +
"date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime " +
"from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type!='其它' " +
"and SubType!='调拨' and SubType!='礼品充值' ");
queryString.append(" and MaterialId =").append(MId).append(" ORDER BY oTime desc ");
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
// 分页查询
int pageNo = pageUtil.getCurPage();
int pageSize = pageUtil.getPageSize();
if (0 != pageNo && 0 != pageSize) {
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
}
pageUtil.setPageList(query.list());
}
private final static String SUM_TYPE = "Number";
@SuppressWarnings("unchecked")
@Override
public void buyOrSale(PageUtil<DepotItem> pageUtil, String type, String subType, Long MId, String MonthTime, String sumType) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
if (SUM_TYPE.equals(sumType)) {
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select sum(BasicNumber) as BasicNumber 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 59:59:59' " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
}
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
private final static String IN = "in";
private final static String OUT = "out";
@SuppressWarnings("unchecked")
@Override
public void findGiftByType(PageUtil<DepotItem> pageUtil, String subType, Integer ProjectId, Long MId, String type) throws JshException {
//多表联查,多表连查此处用到了createSQLQuery可以随便写sql语句很方便
Query query;
StringBuilder queryString = new StringBuilder();
queryString.append("select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and jsh_depothead.SubType='").append(subType).append("'");
if (ProjectId != null) {
if (IN.equals(type)) {
queryString.append(" and jsh_depotitem.AnotherDepotId='").append(ProjectId).append("'"); //礼品充值时
} else if (OUT.equals(type)) {
queryString.append(" and jsh_depotitem.DepotId='").append(ProjectId).append("'");
}
}
queryString.append(" and jsh_depotitem.MaterialId =").append(MId);
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
pageUtil.setPageList(query.list());
}
} }

View File

@@ -2,392 +2,403 @@ package com.jsh.model.vo.materials;
import java.io.Serializable; import java.io.Serializable;
/**
* @author alan
*/
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class DepotHeadModel implements Serializable public class DepotHeadModel implements Serializable {
{
private DepotHeadShowModel showModel = new DepotHeadShowModel(); private DepotHeadShowModel showModel = new DepotHeadShowModel();
/**======开始接受页面参数=================**/ /**
private String Type = ""; * ======开始接受页面参数=================
private String SubType = ""; **/
private Long ProjectId; private String Type = "";
private String DepotIds = ""; private String SubType = "";
private String DefaultNumber = ""; private Long ProjectId;
private String Number = ""; private String DepotIds = "";
private String OperPersonName = ""; private String DefaultNumber = "";
private String OperTime; private String Number = "";
private Long OrganId; private String OperPersonName = "";
private Long HandsPersonId; private String OperTime;
private Long AccountId; private Long OrganId;
private Double ChangeAmount; private Long HandsPersonId;
private Long AllocationProjectId; private Long AccountId;
private Double TotalPrice; private Double ChangeAmount;
private String PayType = ""; private Long AllocationProjectId;
private String Remark = ""; private Double TotalPrice;
private String PayType = "";
private String Remark = "";
private String Salesman; private String Salesman;
private String AccountIdList; private String AccountIdList;
private String AccountMoneyList; private String AccountMoneyList;
private Double Discount; private Double Discount;
private Double DiscountMoney; private Double DiscountMoney;
private Double DiscountLastMoney; private Double DiscountLastMoney;
private Double OtherMoney; private Double OtherMoney;
private String OtherMoneyList; private String OtherMoneyList;
private String OtherMoneyItem; private String OtherMoneyItem;
private Integer AccountDay; private Integer AccountDay;
private Boolean Status = false; //单据状态 //单据状态
private Boolean Status = false;
private String BeginTime; //查询开始时间 //查询开始时间
private String EndTime; //查询结束时间 private String BeginTime;
private String MonthTime; //查询月份 //查询结束时间
private String EndTime;
private String supplierId; //单位Id用于查询单位的应收应付 //查询月份
private String MaterialParam; //商品参数 private String MonthTime;
private String dhIds; //单据id列表 //单位Id用于查询单位的应收应付
private String supType; //单位类型,客户、供应商 private String supplierId;
//商品参数
private String MaterialParam;
//单据id列表
private String dhIds;
//单位类型,客户、供应商
private String supType;
/**
/**
* 分类ID * 分类ID
*/ */
private Long depotHeadID = 0l; private Long depotHeadID = 0L;
/** /**
* 分类IDs 批量操作使用 * 分类IDs 批量操作使用
*/ */
private String depotHeadIDs = ""; private String depotHeadIDs = "";
/** /**
* 每页显示的个数 * 每页显示的个数
*/ */
private int pageSize = 10; private int pageSize = 10;
/** /**
* 当前页码 * 当前页码
*/ */
private int pageNo = 1; private int pageNo = 1;
/** /**
* 用户IP用户记录操作日志 * 用户IP用户记录操作日志
*/ */
private String clientIp = ""; private String clientIp = "";
public DepotHeadShowModel getShowModel() { public DepotHeadShowModel getShowModel() {
return showModel; return showModel;
} }
public void setShowModel(DepotHeadShowModel showModel) { public void setShowModel(DepotHeadShowModel showModel) {
this.showModel = showModel; this.showModel = showModel;
} }
public String getType() { public String getType() {
return Type; return Type;
} }
public void setType(String type) { public void setType(String type) {
Type = type; Type = type;
} }
public String getSubType() { public String getSubType() {
return SubType; return SubType;
} }
public void setSubType(String subType) { public void setSubType(String subType) {
SubType = subType; SubType = subType;
} }
public Long getProjectId() { public Long getProjectId() {
return ProjectId; return ProjectId;
} }
public void setProjectId(Long projectId) { public void setProjectId(Long projectId) {
ProjectId = projectId; ProjectId = projectId;
} }
public String getDepotIds() { public String getDepotIds() {
return DepotIds; return DepotIds;
} }
public void setDepotIds(String depotIds) { public void setDepotIds(String depotIds) {
DepotIds = depotIds; DepotIds = depotIds;
} }
public String getDefaultNumber() { public String getDefaultNumber() {
return DefaultNumber; return DefaultNumber;
} }
public void setDefaultNumber(String defaultNumber) { public void setDefaultNumber(String defaultNumber) {
DefaultNumber = defaultNumber; DefaultNumber = defaultNumber;
} }
public String getNumber() { public String getNumber() {
return Number; return Number;
} }
public void setNumber(String number) { public void setNumber(String number) {
Number = number; Number = number;
} }
public String getOperPersonName() { public String getOperPersonName() {
return OperPersonName; return OperPersonName;
} }
public void setOperPersonName(String operPersonName) { public void setOperPersonName(String operPersonName) {
OperPersonName = operPersonName; OperPersonName = operPersonName;
} }
public Long getOrganId() { public Long getOrganId() {
return OrganId; return OrganId;
} }
public void setOrganId(Long organId) { public void setOrganId(Long organId) {
OrganId = organId; OrganId = organId;
} }
public Long getHandsPersonId() { public Long getHandsPersonId() {
return HandsPersonId; return HandsPersonId;
} }
public void setHandsPersonId(Long handsPersonId) { public void setHandsPersonId(Long handsPersonId) {
HandsPersonId = handsPersonId; HandsPersonId = handsPersonId;
} }
public Long getAccountId() { public Long getAccountId() {
return AccountId; return AccountId;
} }
public void setAccountId(Long accountId) { public void setAccountId(Long accountId) {
AccountId = accountId; AccountId = accountId;
} }
public Double getChangeAmount() { public Double getChangeAmount() {
return ChangeAmount; return ChangeAmount;
} }
public void setChangeAmount(Double changeAmount) { public void setChangeAmount(Double changeAmount) {
ChangeAmount = changeAmount; ChangeAmount = changeAmount;
} }
public Long getAllocationProjectId() { public Long getAllocationProjectId() {
return AllocationProjectId; return AllocationProjectId;
} }
public void setAllocationProjectId(Long allocationProjectId) { public void setAllocationProjectId(Long allocationProjectId) {
AllocationProjectId = allocationProjectId; AllocationProjectId = allocationProjectId;
} }
public Double getTotalPrice() { public Double getTotalPrice() {
return TotalPrice; return TotalPrice;
} }
public void setTotalPrice(Double totalPrice) { public void setTotalPrice(Double totalPrice) {
TotalPrice = totalPrice; TotalPrice = totalPrice;
} }
public String getPayType() { public String getPayType() {
return PayType; return PayType;
} }
public void setPayType(String payType) { public void setPayType(String payType) {
PayType = payType; PayType = payType;
} }
public String getRemark() { public String getRemark() {
return Remark; return Remark;
} }
public void setRemark(String remark) { public void setRemark(String remark) {
Remark = remark; Remark = remark;
} }
public Long getDepotHeadID() { public Long getDepotHeadID() {
return depotHeadID; return depotHeadID;
} }
public void setDepotHeadID(Long depotHeadID) { public void setDepotHeadID(Long depotHeadID) {
this.depotHeadID = depotHeadID; this.depotHeadID = depotHeadID;
} }
public String getDepotHeadIDs() { public String getDepotHeadIDs() {
return depotHeadIDs; return depotHeadIDs;
} }
public void setDepotHeadIDs(String depotHeadIDs) { public void setDepotHeadIDs(String depotHeadIDs) {
this.depotHeadIDs = depotHeadIDs; this.depotHeadIDs = depotHeadIDs;
} }
public int getPageSize() { public int getPageSize() {
return pageSize; return pageSize;
} }
public void setPageSize(int pageSize) { public void setPageSize(int pageSize) {
this.pageSize = pageSize; this.pageSize = pageSize;
} }
public int getPageNo() { public int getPageNo() {
return pageNo; return pageNo;
} }
public void setPageNo(int pageNo) { public void setPageNo(int pageNo) {
this.pageNo = pageNo; this.pageNo = pageNo;
} }
public String getClientIp() { public String getClientIp() {
return clientIp; return clientIp;
} }
public void setClientIp(String clientIp) { public void setClientIp(String clientIp) {
this.clientIp = clientIp; this.clientIp = clientIp;
} }
public String getBeginTime() { public String getBeginTime() {
return BeginTime; return BeginTime;
} }
public void setBeginTime(String beginTime) { public void setBeginTime(String beginTime) {
BeginTime = beginTime; BeginTime = beginTime;
} }
public String getEndTime() { public String getEndTime() {
return EndTime; return EndTime;
} }
public void setEndTime(String endTime) { public void setEndTime(String endTime) {
EndTime = endTime; EndTime = endTime;
} }
public String getOperTime() { public String getOperTime() {
return OperTime; return OperTime;
} }
public void setOperTime(String operTime) { public void setOperTime(String operTime) {
OperTime = operTime; OperTime = operTime;
} }
public String getMonthTime() { public String getMonthTime() {
return MonthTime; return MonthTime;
} }
public void setMonthTime(String monthTime) { public void setMonthTime(String monthTime) {
MonthTime = monthTime; MonthTime = monthTime;
} }
public String getSupplierId() { public String getSupplierId() {
return supplierId; return supplierId;
} }
public void setSupplierId(String supplierId) { public void setSupplierId(String supplierId) {
this.supplierId = supplierId; this.supplierId = supplierId;
} }
public String getSalesman() { public String getSalesman() {
return Salesman; return Salesman;
} }
public void setSalesman(String salesman) { public void setSalesman(String salesman) {
Salesman = salesman; Salesman = salesman;
} }
public String getAccountIdList() { public String getAccountIdList() {
return AccountIdList; return AccountIdList;
} }
public void setAccountIdList(String accountIdList) { public void setAccountIdList(String accountIdList) {
AccountIdList = accountIdList; AccountIdList = accountIdList;
} }
public String getAccountMoneyList() { public String getAccountMoneyList() {
return AccountMoneyList; return AccountMoneyList;
} }
public void setAccountMoneyList(String accountMoneyList) { public void setAccountMoneyList(String accountMoneyList) {
AccountMoneyList = accountMoneyList; AccountMoneyList = accountMoneyList;
} }
public Double getDiscount() { public Double getDiscount() {
return Discount; return Discount;
} }
public void setDiscount(Double discount) { public void setDiscount(Double discount) {
Discount = discount; Discount = discount;
} }
public Double getDiscountMoney() { public Double getDiscountMoney() {
return DiscountMoney; return DiscountMoney;
} }
public void setDiscountMoney(Double discountMoney) { public void setDiscountMoney(Double discountMoney) {
DiscountMoney = discountMoney; DiscountMoney = discountMoney;
} }
public Double getDiscountLastMoney() { public Double getDiscountLastMoney() {
return DiscountLastMoney; return DiscountLastMoney;
} }
public void setDiscountLastMoney(Double discountLastMoney) { public void setDiscountLastMoney(Double discountLastMoney) {
DiscountLastMoney = discountLastMoney; DiscountLastMoney = discountLastMoney;
} }
public Double getOtherMoney() { public Double getOtherMoney() {
return OtherMoney; return OtherMoney;
} }
public void setOtherMoney(Double otherMoney) { public void setOtherMoney(Double otherMoney) {
OtherMoney = otherMoney; OtherMoney = otherMoney;
} }
public String getOtherMoneyList() { public String getOtherMoneyList() {
return OtherMoneyList; return OtherMoneyList;
} }
public void setOtherMoneyList(String otherMoneyList) { public void setOtherMoneyList(String otherMoneyList) {
OtherMoneyList = otherMoneyList; OtherMoneyList = otherMoneyList;
} }
public String getOtherMoneyItem() { public String getOtherMoneyItem() {
return OtherMoneyItem; return OtherMoneyItem;
} }
public void setOtherMoneyItem(String otherMoneyItem) { public void setOtherMoneyItem(String otherMoneyItem) {
OtherMoneyItem = otherMoneyItem; OtherMoneyItem = otherMoneyItem;
} }
public Integer getAccountDay() { public Integer getAccountDay() {
return AccountDay; return AccountDay;
} }
public void setAccountDay(Integer accountDay) { public void setAccountDay(Integer accountDay) {
AccountDay = accountDay; AccountDay = accountDay;
} }
public Boolean getStatus() { public Boolean getStatus() {
return Status; return Status;
} }
public void setStatus(Boolean status) { public void setStatus(Boolean status) {
Status = status; Status = status;
} }
public String getMaterialParam() { public String getMaterialParam() {
return MaterialParam; return MaterialParam;
} }
public void setMaterialParam(String materialParam) { public void setMaterialParam(String materialParam) {
MaterialParam = materialParam; MaterialParam = materialParam;
} }
public String getDhIds() { public String getDhIds() {
return dhIds; return dhIds;
} }
public void setDhIds(String dhIds) { public void setDhIds(String dhIds) {
this.dhIds = dhIds; this.dhIds = dhIds;
} }
public String getSupType() { public String getSupType() {
return supType; return supType;
} }
public void setSupType(String supType) { public void setSupType(String supType) {
this.supType = supType; this.supType = supType;
} }
} }