opt:优化WQL分页查询改成selectcount(0);优化子卷包装关系页面及下载数限制
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.nl.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.github.pagehelper.parser.CountSqlParser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -12,7 +13,7 @@ import javax.sql.DataSource;
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class DataBaseConfig {
|
||||
|
||||
public static CountSqlParser countSqlParser = new CountSqlParser();
|
||||
@Primary
|
||||
@Bean(name = "dataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* 创 建 者 :yumeng
|
||||
* 创建时间:2014-07-01 14:25:35
|
||||
* 文件版本:v1.0
|
||||
* 文件版本:v1.0
|
||||
*
|
||||
*******************************************************/
|
||||
package org.nl.modules.wql.core.bean;
|
||||
@@ -110,7 +110,7 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
// */
|
||||
// public WQLData getWQLData(WQLObject wo,int value){
|
||||
// if (value < rslist.size()) {
|
||||
//
|
||||
//
|
||||
// ArrayList list = getResultSet(value);
|
||||
// try{
|
||||
// WQLData wd = null;
|
||||
@@ -127,7 +127,7 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 返回普通dataset
|
||||
// * @param value
|
||||
@@ -256,7 +256,7 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
int nTotalSize = 0;
|
||||
if (null != rows2 && rows2.size() > 0) {
|
||||
JSONObject jrow2 = this.row2jsonobject((BasicDynaBean) rows2.get(0));
|
||||
nTotalSize = jrow2.getInteger("page_totalrecordnum");
|
||||
nTotalSize = jrow2.getInteger("count(0)");
|
||||
}
|
||||
jres.put("totalElements", nTotalSize);
|
||||
return jres;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.modules.wql.core.engine.syntax;
|
||||
|
||||
import com.github.pagehelper.parser.CountSqlParser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.DataBaseConfig;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.nl.modules.wql.core.DataType;
|
||||
import org.nl.modules.wql.core.bean.ErrorBean;
|
||||
@@ -410,7 +412,8 @@ public class wqlSELECT extends IWQL {
|
||||
//对sql进行特殊处理,找出和第一个select配对的from,并把中间全部换为1
|
||||
// String page_sql = change_1(wo.wp.sSQL);
|
||||
String page_sql = wo.wp.sSQL;
|
||||
wo.wp.sSQL = "select count(*) PAGE_TOTALRECORDNUM from ( " + page_sql + ") TOTALRECORDVIEW";
|
||||
String countSql = DataBaseConfig.countSqlParser.getSmartCountSql(page_sql, "0");
|
||||
wo.wp.sSQL = countSql;
|
||||
}
|
||||
}
|
||||
//2.3、加session并执行
|
||||
@@ -658,7 +661,7 @@ public class wqlSELECT extends IWQL {
|
||||
// this.wo = wo;
|
||||
// this.cmdLine = cmdLine;
|
||||
// this.list = list;
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@@ -25,10 +25,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -99,9 +98,11 @@ public class SubpackagerelationServiceImpl implements SubpackagerelationService
|
||||
map.put("date_of_production", date_of_production);
|
||||
map.put("date_of_FG_inbound", date_of_FG_inbound);
|
||||
map.put("status", status);
|
||||
|
||||
|
||||
JSONObject json = WQL.getWO("PDM_BI_SUBPACKAGER01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time DESC");
|
||||
JSONObject json = WQL.getWO("PDM_BI_SUBPACKAGER01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page),"workorder_id desc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
String ids = content.stream().map(a -> ((JSONObject) a).getString("workorder_id")).collect(Collectors.joining("','"));
|
||||
JSONArray subs = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("workorder_id in ('" + ids + "')").getResultJSONArray(0);
|
||||
json.put("content",subs);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -199,7 +200,7 @@ public class SubpackagerelationServiceImpl implements SubpackagerelationService
|
||||
// 子卷号 是否计划外子卷 sap批次 制造完成日期 入库日期 状态
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("flag", "4");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
@@ -229,9 +230,8 @@ public class SubpackagerelationServiceImpl implements SubpackagerelationService
|
||||
map.put("date_of_production", date_of_production);
|
||||
map.put("date_of_FG_inbound", date_of_FG_inbound);
|
||||
map.put("status", status);
|
||||
|
||||
map.put("limits", "10000");
|
||||
JSONArray resultJSONArray = WQL.getWO("PDM_BI_SUBPACKAGER01").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject json = resultJSONArray.getJSONObject(i);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
输入.customer_name TYPEAS s_string
|
||||
输入.customer_description TYPEAS s_string
|
||||
输入.package_box_sn TYPEAS s_string
|
||||
输入.limits TYPEAS s_string
|
||||
输入.container_name TYPEAS s_string
|
||||
输入.is_un_plan_production TYPEAS s_string
|
||||
输入.sap_pcsn TYPEAS s_string
|
||||
@@ -52,7 +53,7 @@
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
workorder_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation
|
||||
WHERE
|
||||
@@ -112,14 +113,13 @@
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT DISTINCT
|
||||
sub.*
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
INNER JOIN pdm_bi_subpackagerelationrecord record ON sub.container_name = record.container_name
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
SELECT
|
||||
sub.workorder_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
INNER JOIN ( SELECT subre.container_name FROM pdm_bi_subpackagerelationrecord subre WHERE 1 = 1 GROUP BY subre.container_name ) c ON sub.container_name = c.container_name
|
||||
WHERE
|
||||
1 =1
|
||||
OPTION 输入.material_code <> ""
|
||||
sub.product_name LIKE 输入.material_code
|
||||
ENDOPTION
|
||||
@@ -175,13 +175,12 @@
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
sub.*
|
||||
sub.workorder_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN pdm_bi_subpackagerelationrecord record ON sub.container_name = record.container_name
|
||||
WHERE
|
||||
IFNULL(record.bill_code,'') = ''
|
||||
|
||||
record.bill_code is null
|
||||
OPTION 输入.material_code <> ""
|
||||
sub.product_name LIKE 输入.material_code
|
||||
ENDOPTION
|
||||
@@ -232,4 +231,65 @@
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
pdm_bi_subpackagerelation
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.material_code <> ""
|
||||
product_name LIKE 输入.material_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
package_box_sn LIKE 输入.package_box_sn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_name <> ""
|
||||
product_description LIKE 输入.material_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sale_order_name LIKE 输入.sale_order_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.customer_name <> ""
|
||||
customer_name LIKE 输入.customer_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.customer_description <> ""
|
||||
customer_description LIKE 输入.customer_description
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.container_name <> ""
|
||||
container_name LIKE 输入.container_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sap_pcsn LIKE 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_un_plan_production <> ""
|
||||
is_un_plan_production = 输入.is_un_plan_production
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.date_of_production <> ""
|
||||
date_of_production = 输入.date_of_production
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.date_of_FG_inbound <> ""
|
||||
date_of_FG_inbound = 输入.date_of_FG_inbound
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.status <> ""
|
||||
status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.limits <> ""
|
||||
1=1 order by workorder_id desc limit 0,输入.limits
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user