From d582384b4408011a175b8861d3c56a6bfa5e1326 Mon Sep 17 00:00:00 2001 From: "768863620@qq.com" <768863620@qq.com> Date: Thu, 19 Jun 2025 16:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=88=E5=93=88=E5=93=88=E5=93=88=E5=93=88?= =?UTF-8?q?=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/energy/server/action/QueryAction.java | 33 +++- .../server/service/ValueListQueryManager.java | 18 ++ .../pojo/DefaultValueListQueryManager.java | 64 ++++++ .../adapter/hib3/Hibernate30Adapter.java | 184 +++++++++++++++++- .../adapter/hib3/ValueListAdapter.java | 30 +++ 5 files changed, 323 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/dev/energy/server/service/ValueListQueryManager.java create mode 100644 src/main/java/com/dev/energy/server/service/pojo/DefaultValueListQueryManager.java create mode 100644 src/main/java/com/dev/energy/server/valuelist/adapter/hib3/ValueListAdapter.java diff --git a/src/main/java/com/dev/energy/server/action/QueryAction.java b/src/main/java/com/dev/energy/server/action/QueryAction.java index 3d04e5e..a36dc8e 100644 --- a/src/main/java/com/dev/energy/server/action/QueryAction.java +++ b/src/main/java/com/dev/energy/server/action/QueryAction.java @@ -41,6 +41,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -53,6 +54,8 @@ import net.mlw.vlh.ValueList; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.hql.ast.QueryTranslatorImpl; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -134,6 +137,7 @@ public class QueryAction extends AbstractAction implements ApplicationContextAwa return StringUtils.isEmpty(value) ? "-" : value; } } + private String convertGlobalParamToHql(String hql, Map params) { //log.info("开始查询: " + hql); @@ -290,11 +294,10 @@ public class QueryAction extends AbstractAction implements ApplicationContextAwa Assert.notNull(hql, String.valueOf(tableConfig.getPageId()) + "'s hql is null!"); String hql2 = removeHqlWithNullParam(convertGlobalParamToHql(appendHql(hql, params), params), params); TableConfig result = null; - if (this.logger.isDebugEnabled()) { - this.logger.debug("buildGrid with hql[" + hql2 + "] and params[" + params + "]"); - } - + String hql3 = formateHql(hql2); + + if (tableConfig.getDataSourceType().equals(DataSource.HQL_TYPE)) { int index = containOrderBy(hql3); if (index == -1) { @@ -305,6 +308,9 @@ public class QueryAction extends AbstractAction implements ApplicationContextAwa result = buildHqlGrid(tableConfig, hql3, params); } else if (tableConfig.getDataSourceType().equals(DataSource.JAVA_TYPE)) { result = buildJavaGrid(tableConfig, hql3, params); + }else{ + result = buildSqlGrid(tableConfig, hql3, params); + } params.clear(); return result; @@ -387,6 +393,25 @@ public class QueryAction extends AbstractAction implements ApplicationContextAwa tableConfig.setTableRows(list); return tableConfig; } + protected TableConfig buildSqlGrid(TableConfig tableConfig, String hql, Map params) { + try { + ValueList valueList = this.valueListQueryManager.queryBySqlValueList(hql, params); + Assert.notNull(valueList, "valueList is null by hql [" + hql + "]"); + if (valueList == null) { + throw new EnergyServerRuntimeException("Cann't query datas from DataBase! "); + } + initGridInfo(tableConfig, valueList); + return tableConfig; + } catch (Exception e) { + if (this.logger.isErrorEnabled()) { + this.logger.error(e); + } + String mess = LocalizedMessage.getLocalizedMessage("build.exception.message", this.referenceModel, this.localeName); + throw new BaseException(mess); + } + } + + protected TableConfig buildHqlGrid(TableConfig tableConfig, String hql, Map params) { try { diff --git a/src/main/java/com/dev/energy/server/service/ValueListQueryManager.java b/src/main/java/com/dev/energy/server/service/ValueListQueryManager.java new file mode 100644 index 0000000..e93db51 --- /dev/null +++ b/src/main/java/com/dev/energy/server/service/ValueListQueryManager.java @@ -0,0 +1,18 @@ +package com.dev.energy.server.service; + +import java.util.List; +import java.util.Map; +import net.mlw.vlh.ValueList; + +/* loaded from: high-server-1.1.3.jar:com/dev/energy/server/service/ValueListQueryManager.class */ +public interface ValueListQueryManager { + ValueList queryByValueList(String str, Map map); + + ValueList queryValueList(String str, Map map); + + ValueList queryBySqlValueList(String str, Map map); + + ValueList scrollableQuery(String str, Map map, Map map2); + + List query(String str, Map map); +} \ No newline at end of file diff --git a/src/main/java/com/dev/energy/server/service/pojo/DefaultValueListQueryManager.java b/src/main/java/com/dev/energy/server/service/pojo/DefaultValueListQueryManager.java new file mode 100644 index 0000000..0051111 --- /dev/null +++ b/src/main/java/com/dev/energy/server/service/pojo/DefaultValueListQueryManager.java @@ -0,0 +1,64 @@ +package com.dev.energy.server.service.pojo; + +import com.dev.energy.server.dao.CommonDao; +import com.dev.energy.server.service.ValueListQueryManager; +import com.dev.energy.server.valuelist.adapter.hib3.ValueListAdapter; +import java.util.List; +import java.util.Map; +import net.mlw.vlh.ValueList; +import net.mlw.vlh.ValueListInfo; + +/* loaded from: high-server-1.1.3.jar:com/dev/energy/server/service/pojo/DefaultValueListQueryManager.class */ +public class DefaultValueListQueryManager implements ValueListQueryManager { + protected CommonDao commonDao; + protected ValueListAdapter valueListAdapter; + + public DefaultValueListQueryManager(CommonDao commonDao, ValueListAdapter valueListAdapter) { + this.commonDao = commonDao; + this.valueListAdapter = valueListAdapter; + } + + @Override // com.dev.energy.server.service.ValueListQueryManager + public ValueList queryByValueList(String hql, Map pageParams) { + ValueListInfo info = new ValueListInfo(pageParams); + return this.valueListAdapter.getValueList(hql, info); + } + + + + + @Override // com.dev.energy.server.service.ValueListQueryManager + public ValueList scrollableQuery(String hql, Map params, Map queryParams) { + ValueListInfo info = new ValueListInfo(params); + return this.valueListAdapter.scrollableQuery(hql, info, queryParams); + } + + @Override // com.dev.energy.server.service.ValueListQueryManager + public List query(String hql, Map params) { + String[] parameters = new String[params.size()]; + Object[] values = new Object[params.size()]; + int index = 0; + for (Object obj : params.entrySet()) { + Map.Entry entry = (Map.Entry) obj; + parameters[index] = (String) entry.getKey(); + values[index] = entry.getValue(); + index++; + } + return this.commonDao.findByQuery(hql, parameters, values); + } + + @Override // com.dev.energy.server.service.ValueListQueryManager + public ValueList queryValueList(String hql, Map pageParams) { + ValueListInfo info = new ValueListInfo(pageParams); + return this.valueListAdapter.getValueListNoCount(hql, info); + } + + @Override // com.dev.energy.server.service.ValueListQueryManager + public ValueList queryBySqlValueList(String hql, Map pageParams) { + ValueListInfo info = new ValueListInfo(pageParams); + return this.valueListAdapter.getValueListBySQL(hql, info); + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/Hibernate30Adapter.java b/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/Hibernate30Adapter.java index 400c0da..d3f0bf6 100644 --- a/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/Hibernate30Adapter.java +++ b/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/Hibernate30Adapter.java @@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException; import java.text.ParseException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -24,12 +25,16 @@ import org.hibernate.Query; import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.hql.ast.QueryTranslatorImpl; import org.springframework.orm.hibernate3.SessionFactoryUtils; import com.dev.energy.server.model.DomainModel; import com.dev.energy.server.util.HqlCountParserSupport; import com.dev.energy.server.valuelist.adapter.hib3.util.ScrollableResultsDecorator; import com.dev.energy.server.valuelist.adapter.hib3.util.StatementBuilder; +import com.dev.swms.server.utils.interfaceUtil; +import com.itextpdf.text.pdf.PdfStructTreeController.returnType; /** * This adapter wraps the functionality of Hibernate. @@ -167,6 +172,179 @@ public class Hibernate30Adapter extends AbstractValueListAdapter implements Valu * @see net.mlw.vlh.ValueListAdapter#getValueList(java.lang.String, * net.mlw.vlh.ValueListInfo) */ + public static String convertHqlWithParamsToSql(SessionFactory sessionFactory, + String hql, + Map params) { + +QueryTranslatorImpl translator = new QueryTranslatorImpl( +hql, +hql, +Collections.EMPTY_MAP, +(SessionFactoryImplementor)sessionFactory); +translator.compile(params, false); +return translator.getSQLString(); +} + + + public ValueList getValueListBySQL(String hql, ValueListInfo info) + { + LOGGER.info("-------------------------------内部SQL--22--------------------------------"); + + if (info.getSortingColumn() == null) + { + info.setPrimarySortColumn(getDefaultSortColumn()); + info.setPrimarySortDirection(getDefaultSortDirectionInteger()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("The default sort column '" + getDefaultSortColumn() + "' with direction '"+getDefaultSortDirectionInteger()+"' was set."); + } + } + + if (info.getPagingNumberPer() == Integer.MAX_VALUE) + { + info.setPagingNumberPer(getDefaultNumberPerPage()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("The paging number per page '" + getDefaultNumberPerPage() + "' was set."); + } + } + + Session session = SessionFactoryUtils.getSession(getSessionFactory(),allowCreate); + try + { + + Map mmpMap=info.getFilters(); + for (Object key : mmpMap.keySet()) { + String ketstr=(String)key; + String parm= mmpMap.get(key).toString(); + hql=hql.replace("{"+ketstr+"}", parm.replaceAll(" ", "")); + } + + + Query query; + + boolean doFocus = ((getAdapterType() & DO_FOCUS) == 0) && info.isFocusEnabled() && info.isDoFocus() && (namedQuery == null); + + if (doFocus) + { + ScrollableResults results = getScrollableResults(getQueryForFocus(info, session), info); + results.beforeFirst(); + doFocusFor(info, results); + } + if(LOGGER.isDebugEnabled()){ + LOGGER.debug("Query hql = " + hql); + } + + //query = getQuery(hql,info, session); + //String s = "select task0_.ID as col_0_0_, pickticket2_.CODE as col_1_0_, pickticket2_.ORDER_DATE as col_2_0_, task0_.END_REGION as col_3_0_, seedwall6_.name as col_4_0_, agvtask17_.robotJobId as col_5_0_, agvtask17_.status as col_6_0_, agvtask17_.createTime as col_7_0_, agvtask17_.createTime as col_8_0_, agvtask17_.dateTime2 as col_9_0_, agvtask17_.dateTime3 as col_10_0_, agvtask17_.jobPriorityType as col_11_0_, task0_.OLD_GZZ as col_12_0_, task0_.OLD_ZRW as col_13_0_, warehousea9_.NAME as col_14_0_, pickticket2_.sourceType as col_15_0_, billtype3_.NAME as col_16_0_, task0_.BILLCODE as col_17_0_, item11_.CODE as col_18_0_, item11_.NAME as col_19_0_, item11_.UNIT as col_20_0_, item11_.SHIP_RULES as col_21_0_, location8_.CODE as col_22_0_, stock18_.REMARK as col_23_0_, warehousea7_.NAME as col_24_0_, location5_.CODE as col_25_0_, task0_.strBill4 as col_26_0_, task0_.yc_qty as col_27_0_, task0_.PLAN_QUANTITY_MU as col_28_0_, task0_.MOVED_QUANTITY_MU as col_29_0_, case when task0_.PLAN_QUANTITY-task0_.MOVED_QUANTITY_MU<=0 then '处理完成' when task0_.MOVED_QUANTITY_MU=0 then '未处理' else '处理中' end as col_30_0_, itemkey10_.PROP_C1 as col_31_0_, itemkey10_.PROP_C2 as col_32_0_, itemkey10_.PROP_C3 as col_33_0_, itemkey10_.PROP_C5 as col_34_0_, itemkey10_.PROP_C9 as col_35_0_, pickticket2_.equated_Quantity as col_36_0_, task0_.BAR_CODE as col_37_0_, pickticket1_.strBill12 as col_38_0_, task0_.INVENTORY_STATUS as col_39_0_, task0_.strBill10 as col_40_0_, task0_.NCR_CODE as col_41_0_, pickticket1_.LINE_NUMBER as col_42_0_, task0_.small_Unit as col_43_0_, pickticket2_.UPDATE_TIME as col_44_0_, pickticket2_.UPDATE_TIME as col_45_0_, task0_.strBill1 as col_46_0_, task0_.dateBill1 as col_47_0_, task0_.dateBill1 as col_48_0_, task0_.dateBill4 as col_49_0_, task0_.dateBill4 as col_50_0_, worker14_.NAME as col_51_0_, worker13_.NAME as col_52_0_, task0_.OPERATE_TIME as col_53_0_, task0_.OPERATE_TIME as col_54_0_, task0_.operator as col_55_0_, wavedoc12_.CODE as col_56_0_, task0_.CREATE_TIME as col_57_0_, task0_.CREATE_TIME as col_58_0_, worker15_.NAME as col_59_0_, task0_.ARRIVAL_TIME as col_60_0_, task0_.ARRIVAL_TIME as col_61_0_, task0_.dateBill5 as col_62_0_, task0_.dateBill5 as col_63_0_, task0_.strBill5 as col_64_0_, task0_.dateBill3 as col_65_0_, task0_.dateBill3 as col_66_0_, case when task0_.positionStatus='1' then task0_.operator when task0_.positionStatus='0' then '' end as col_67_0_, case when task0_.positionStatus='1' then task0_.dateline when task0_.positionStatus='0' then '' end as col_68_0_, case when task0_.positionStatus='1' then task0_.dateline when task0_.positionStatus='0' then '' end as col_69_0_, DATEDIFF(second, pickticket2_.UPDATE_TIME, task0_.dateBill1)/60 as col_70_0_, DATEDIFF(second, task0_.dateBill1, task0_.OPERATE_TIME)/60 as col_71_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.dateBill3)/60 as col_72_0_, DATEDIFF(second, task0_.dateBill3, task0_.dateline)/60 as col_73_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.ARRIVAL_TIME)/60 as col_74_0_, DATEDIFF(second, task0_.ARRIVAL_TIME, task0_.dateBill3)/60 as col_75_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.dateline)/60 as col_76_0_, task0_.statusCode as col_77_0_, task0_.agv_Status as col_78_0_, task0_.popular as col_79_0_, task0_.CODE as col_80_0_, task0_.strBill6 as col_81_0_, pickticket2_.RELATED_BILL3 as col_82_0_, pickticket2_.LOGISTICS_COMPANY as col_83_0_ from TASK task0_ left outer join PICK_TICKET_DETAIL pickticket1_ on task0_.PICK_TICKET_DETAIL_ID=pickticket1_.ID left outer join PICK_TICKET pickticket2_ on pickticket1_.PICK_TICKET_ID=pickticket2_.ID left outer join BILL_TYPE billtype3_ on pickticket2_.BILL_TYPE_ID=billtype3_.ID left outer join ZONE warehousea4_ on task0_.warehouse_Area_ID=warehousea4_.ID left outer join LOCATION location5_ on task0_.DST_LOC_ID=location5_.ID left outer join ZONE warehousea7_ on location5_.ZONE_ID=warehousea7_.ID left outer join Seed_Wall seedwall6_ on task0_.Seed_Wall_ID=seedwall6_.ID left outer join LOCATION location8_ on task0_.SRC_LOC_ID=location8_.ID left outer join ZONE warehousea9_ on location8_.ZONE_ID=warehousea9_.ID left outer join ITEM_KEY itemkey10_ on task0_.ITEM_KEY_ID=itemkey10_.ID left outer join ITEM item11_ on itemkey10_.ITEM_ID=item11_.ID left outer join WAVE_DOC wavedoc12_ on task0_.WAVE_DOC_ID=wavedoc12_.ID left outer join WORKER worker13_ on task0_.WORKER4_ID=worker13_.ID left outer join WORKER worker14_ on task0_.WORKER1_ID=worker14_.ID left outer join WORKER worker15_ on task0_.WORKER2_ID=worker15_.ID left outer join WORKER worker16_ on task0_.WORKER3_ID=worker16_.ID left outer join agvtask agvtask17_ on task0_.agvTask_ID=agvtask17_.id left outer join STOCK stock18_ on task0_.DST_LP=stock18_.ID where 1=1 and task0_.TYPE='MV_PICKTICKET' and task0_.PLAN_QUANTITY>0 and (task0_.INVENTORY_STATUS not in ('交单完成') or 1=1) and (warehousea7_.ID<>1787 or warehousea7_.NAME is null or 1=1) and (pickticket2_.sourceType<>'411' and task0_.PLAN_QUANTITY<=task0_.MOVED_QUANTITY_MU or task0_.PLAN_QUANTITY>task0_.MOVED_QUANTITY_MU or 1=1) and 1=1 and 1=1 and 1=1 and (item11_.CODE like '835-00378-000-000%') order by task0_.ID desc"; + + + + boolean doPage = ((getAdapterType() & DO_PAGE) == 0); + List list; + list = new ArrayList(info.getPagingNumberPer()); + if (doPage) + { + int numberPerPage = (info.getPagingNumberPer() > 0) ? info.getPagingNumberPer() : getDefaultNumberPerPage(); + int start = (info.getPagingPage() - 1) * numberPerPage; + + String hql2=hql +" OFFSET "+start+" ROWS FETCH NEXT "+numberPerPage+" ROWS ONLY"; + LOGGER.info("-------------------------------开始内部SQL-2222222222222222----------------------------------"); + LOGGER.info("---"+hql2); + query=session.createSQLQuery(hql2); + + Long st_Time=System.currentTimeMillis(); + + List results = query.list(); + Long ed_Time=System.currentTimeMillis(); + LOGGER.info("22查询数据用时:"+(ed_Time-st_Time)); + for (int i = 0; i < results.size(); i++) + { + if(i == results.size()){ + break; + } + Object result = results.get(i); + if (result instanceof Object[]) { + Object[] objs = (Object[]) result; + if(objs.length == 1 && objs[0] instanceof DomainModel){ + list.add(objs[0]); + } + else{ + list.add(result); + } + } + else { + if(result instanceof DomainModel){ + list.add(result); + } + else{ + list.add(result); + } + } + } + ed_Time=System.currentTimeMillis(); + LOGGER.info("22处理数据用时:"+(ed_Time-st_Time)); + + + String countHql =getCountSql(hql); + LOGGER.info("生成countHql:"+countHql); + + ed_Time=System.currentTimeMillis(); + LOGGER.info("22生成总条数用时:"+(ed_Time-st_Time)); + Query countQuery =session.createSQLQuery(countHql); + // Query countQuery = getStatementBuilder().generate(session, new StringBuffer(countHql), info.getFilters(), _isRemoveEmptyStrings); + List result = countQuery.list(); + ed_Time=System.currentTimeMillis(); + LOGGER.info("22查询总条数用时:"+(ed_Time-st_Time)); + if (result.size() > 0){ + int lastRowNumber = Integer.parseInt(result.get(0).toString());//((Integer) result.get(0)).intValue(); + info.setTotalNumberOfEntries(lastRowNumber); + }else{ + info.setTotalNumberOfEntries(0); + } + } + else + { + String hql2=hql +" OFFSET "+0+" ROWS FETCH NEXT "+35+" ROWS ONLY"; + LOGGER.info("-------------------------------开始内部SQL-2222222222222222----------------------------------"); + LOGGER.info("---"+hql2); + query=session.createSQLQuery(hql2); + list = query.list(); + info.setTotalNumberOfEntries(list.size()); + } + ValueList returnValueList = getListBackedValueList(info, list); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Retrieved list was wrapped in valuelist, info=" + info); + } + return returnValueList; + } + catch (HibernateException e) + { + e.printStackTrace(); + throw SessionFactoryUtils.convertHibernateAccessException(e); + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + finally + { + //SessionFactoryUtils.closeSessionIfNecessary(session, getSessionFactory()); + SessionFactoryUtils.releaseSession(session, getSessionFactory()); + } + } + + + public String getCountSql(String sql){ + sql=sql.substring(0,sql.indexOf("order by")); + int st=sql.indexOf("select")+6; + int ed=sql.indexOf("from"); + + String ret=sql.substring(0,st)+" count(*) "+sql.substring(ed); + return ret; + + } + public ValueList getValueList(String hql, ValueListInfo info) { if (LOGGER.isDebugEnabled()) @@ -211,12 +389,14 @@ public class Hibernate30Adapter extends AbstractValueListAdapter implements Valu } LOGGER.info("-------------------------------开始内部SQL-----------------------------------"); query = getQuery(hql,info, session); - if(cacheRegion != null){ + //String s = "select task0_.ID as col_0_0_, pickticket2_.CODE as col_1_0_, pickticket2_.ORDER_DATE as col_2_0_, task0_.END_REGION as col_3_0_, seedwall6_.name as col_4_0_, agvtask17_.robotJobId as col_5_0_, agvtask17_.status as col_6_0_, agvtask17_.createTime as col_7_0_, agvtask17_.createTime as col_8_0_, agvtask17_.dateTime2 as col_9_0_, agvtask17_.dateTime3 as col_10_0_, agvtask17_.jobPriorityType as col_11_0_, task0_.OLD_GZZ as col_12_0_, task0_.OLD_ZRW as col_13_0_, warehousea9_.NAME as col_14_0_, pickticket2_.sourceType as col_15_0_, billtype3_.NAME as col_16_0_, task0_.BILLCODE as col_17_0_, item11_.CODE as col_18_0_, item11_.NAME as col_19_0_, item11_.UNIT as col_20_0_, item11_.SHIP_RULES as col_21_0_, location8_.CODE as col_22_0_, stock18_.REMARK as col_23_0_, warehousea7_.NAME as col_24_0_, location5_.CODE as col_25_0_, task0_.strBill4 as col_26_0_, task0_.yc_qty as col_27_0_, task0_.PLAN_QUANTITY_MU as col_28_0_, task0_.MOVED_QUANTITY_MU as col_29_0_, case when task0_.PLAN_QUANTITY-task0_.MOVED_QUANTITY_MU<=0 then '处理完成' when task0_.MOVED_QUANTITY_MU=0 then '未处理' else '处理中' end as col_30_0_, itemkey10_.PROP_C1 as col_31_0_, itemkey10_.PROP_C2 as col_32_0_, itemkey10_.PROP_C3 as col_33_0_, itemkey10_.PROP_C5 as col_34_0_, itemkey10_.PROP_C9 as col_35_0_, pickticket2_.equated_Quantity as col_36_0_, task0_.BAR_CODE as col_37_0_, pickticket1_.strBill12 as col_38_0_, task0_.INVENTORY_STATUS as col_39_0_, task0_.strBill10 as col_40_0_, task0_.NCR_CODE as col_41_0_, pickticket1_.LINE_NUMBER as col_42_0_, task0_.small_Unit as col_43_0_, pickticket2_.UPDATE_TIME as col_44_0_, pickticket2_.UPDATE_TIME as col_45_0_, task0_.strBill1 as col_46_0_, task0_.dateBill1 as col_47_0_, task0_.dateBill1 as col_48_0_, task0_.dateBill4 as col_49_0_, task0_.dateBill4 as col_50_0_, worker14_.NAME as col_51_0_, worker13_.NAME as col_52_0_, task0_.OPERATE_TIME as col_53_0_, task0_.OPERATE_TIME as col_54_0_, task0_.operator as col_55_0_, wavedoc12_.CODE as col_56_0_, task0_.CREATE_TIME as col_57_0_, task0_.CREATE_TIME as col_58_0_, worker15_.NAME as col_59_0_, task0_.ARRIVAL_TIME as col_60_0_, task0_.ARRIVAL_TIME as col_61_0_, task0_.dateBill5 as col_62_0_, task0_.dateBill5 as col_63_0_, task0_.strBill5 as col_64_0_, task0_.dateBill3 as col_65_0_, task0_.dateBill3 as col_66_0_, case when task0_.positionStatus='1' then task0_.operator when task0_.positionStatus='0' then '' end as col_67_0_, case when task0_.positionStatus='1' then task0_.dateline when task0_.positionStatus='0' then '' end as col_68_0_, case when task0_.positionStatus='1' then task0_.dateline when task0_.positionStatus='0' then '' end as col_69_0_, DATEDIFF(second, pickticket2_.UPDATE_TIME, task0_.dateBill1)/60 as col_70_0_, DATEDIFF(second, task0_.dateBill1, task0_.OPERATE_TIME)/60 as col_71_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.dateBill3)/60 as col_72_0_, DATEDIFF(second, task0_.dateBill3, task0_.dateline)/60 as col_73_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.ARRIVAL_TIME)/60 as col_74_0_, DATEDIFF(second, task0_.ARRIVAL_TIME, task0_.dateBill3)/60 as col_75_0_, DATEDIFF(second, task0_.OPERATE_TIME, task0_.dateline)/60 as col_76_0_, task0_.statusCode as col_77_0_, task0_.agv_Status as col_78_0_, task0_.popular as col_79_0_, task0_.CODE as col_80_0_, task0_.strBill6 as col_81_0_, pickticket2_.RELATED_BILL3 as col_82_0_, pickticket2_.LOGISTICS_COMPANY as col_83_0_ from TASK task0_ left outer join PICK_TICKET_DETAIL pickticket1_ on task0_.PICK_TICKET_DETAIL_ID=pickticket1_.ID left outer join PICK_TICKET pickticket2_ on pickticket1_.PICK_TICKET_ID=pickticket2_.ID left outer join BILL_TYPE billtype3_ on pickticket2_.BILL_TYPE_ID=billtype3_.ID left outer join ZONE warehousea4_ on task0_.warehouse_Area_ID=warehousea4_.ID left outer join LOCATION location5_ on task0_.DST_LOC_ID=location5_.ID left outer join ZONE warehousea7_ on location5_.ZONE_ID=warehousea7_.ID left outer join Seed_Wall seedwall6_ on task0_.Seed_Wall_ID=seedwall6_.ID left outer join LOCATION location8_ on task0_.SRC_LOC_ID=location8_.ID left outer join ZONE warehousea9_ on location8_.ZONE_ID=warehousea9_.ID left outer join ITEM_KEY itemkey10_ on task0_.ITEM_KEY_ID=itemkey10_.ID left outer join ITEM item11_ on itemkey10_.ITEM_ID=item11_.ID left outer join WAVE_DOC wavedoc12_ on task0_.WAVE_DOC_ID=wavedoc12_.ID left outer join WORKER worker13_ on task0_.WORKER4_ID=worker13_.ID left outer join WORKER worker14_ on task0_.WORKER1_ID=worker14_.ID left outer join WORKER worker15_ on task0_.WORKER2_ID=worker15_.ID left outer join WORKER worker16_ on task0_.WORKER3_ID=worker16_.ID left outer join agvtask agvtask17_ on task0_.agvTask_ID=agvtask17_.id left outer join STOCK stock18_ on task0_.DST_LP=stock18_.ID where 1=1 and task0_.TYPE='MV_PICKTICKET' and task0_.PLAN_QUANTITY>0 and (task0_.INVENTORY_STATUS not in ('交单完成') or 1=1) and (warehousea7_.ID<>1787 or warehousea7_.NAME is null or 1=1) and (pickticket2_.sourceType<>'411' and task0_.PLAN_QUANTITY<=task0_.MOVED_QUANTITY_MU or task0_.PLAN_QUANTITY>task0_.MOVED_QUANTITY_MU or 1=1) and 1=1 and 1=1 and 1=1 and (item11_.CODE like '835-00378-000-000%') order by task0_.ID desc"; + // query=session.createSQLQuery(s); + /* if(cacheRegion != null){ query.setCacheable(true); query.setCacheRegion(cacheRegion); query.setCacheMode(CacheMode.NORMAL); } - +*/ boolean doPage = ((getAdapterType() & DO_PAGE) == 0); List list; list = new ArrayList(info.getPagingNumberPer()); diff --git a/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/ValueListAdapter.java b/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/ValueListAdapter.java new file mode 100644 index 0000000..16d5c91 --- /dev/null +++ b/src/main/java/com/dev/energy/server/valuelist/adapter/hib3/ValueListAdapter.java @@ -0,0 +1,30 @@ +package com.dev.energy.server.valuelist.adapter.hib3; + +import java.util.Map; + +import net.mlw.vlh.ValueList; +import net.mlw.vlh.ValueListInfo; + +/** + * @author dev + */ +public interface ValueListAdapter +{ + /** The name that should be used to bind this service to + * a JNDI tree or the like **/ + static String DEFAULT_SERVICE_NAME = "valueListHandler"; + + /** Gets a ValueList with the given name. + * + * @param valuelistHql The hql statment clause + * @param info The ValueListInfo information. + * @return The ValueList. + */ + ValueList getValueListNoCount(String hql , ValueListInfo info); + + ValueList getValueList(String valuelistHql, ValueListInfo info); + + ValueList getValueListBySQL(String valuelistHql, ValueListInfo info); + + ValueList scrollableQuery(String hql, ValueListInfo info, Map queryParams); +}