|
|
|
@ -137,7 +137,8 @@ |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 报价单查询条件片段(供 Count 和 Data 两个查询共用) --> |
|
|
|
<!-- 报价单查询条件片段(供 Count 和 Data 两个查询共用)--> |
|
|
|
<!-- purchase/quoter 过滤通过 LEFT JOIN sys_user 后直接比较 user_display,避免逐行调用标量函数 --> |
|
|
|
<sql id="quotePageWhereConditions"> |
|
|
|
<if test="params.id != null"> |
|
|
|
and q.id = #{params.id} |
|
|
|
@ -170,10 +171,10 @@ |
|
|
|
and p.project_name like #{params.projectDesc} |
|
|
|
</if> |
|
|
|
<if test="params.purchase != null and params.purchase != ''"> |
|
|
|
and dbo.plm_get_user_display(q.site, q.purchase) like #{params.purchase} |
|
|
|
and su_purchase.user_display like #{params.purchase} |
|
|
|
</if> |
|
|
|
<if test="params.quoter != null and params.quoter != ''"> |
|
|
|
and dbo.plm_get_user_display(q.site, q.quoter) like #{params.quoter} |
|
|
|
and su_quoter.user_display like #{params.quoter} |
|
|
|
</if> |
|
|
|
<if test="params.customerInquiryNo != null and params.customerInquiryNo != ''"> |
|
|
|
and q.customer_inquiry_no like #{params.customerInquiryNo} |
|
|
|
@ -213,20 +214,27 @@ |
|
|
|
</sql> |
|
|
|
|
|
|
|
<!-- 报价单分页-总数(直接 COUNT,不经过 PaginationInterceptor) --> |
|
|
|
<!-- 仅当条件涉及 nodeId/approvalUsername 时才需要 join 审批流表,否则去掉这两个代价较高的 join --> |
|
|
|
<select id="queryQuotePageCount" resultType="long"> |
|
|
|
SELECT COUNT(1) |
|
|
|
FROM plm_quote q |
|
|
|
left join plm_customer_information c on q.customer_no = c.customer_no |
|
|
|
left join plm_project_info p on q.project_no = p.project_id and q.site = p.site |
|
|
|
left join sys_user su_purchase on q.purchase = su_purchase.username |
|
|
|
left join sys_user su_quoter on q.quoter = su_quoter.username |
|
|
|
<if test="params.nodeId != null and params.nodeId != '' or params.approvalUsername != null and params.approvalUsername != ''"> |
|
|
|
left join plm_request_header prh on q.site = prh.site and prh.menu_id = '5011' |
|
|
|
left join plm_request_node prn on q.site = prn.site and prh.classification_no = prn.classification_no |
|
|
|
and prh.workflow_id = prn.workflow_id and q.step_id = prn.step_id |
|
|
|
</if> |
|
|
|
<where> |
|
|
|
<include refid="quotePageWhereConditions"/> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 报价单分页-数据(原生 OFFSET/FETCH NEXT,按报价单号倒排,不经过 PaginationInterceptor) --> |
|
|
|
<!-- 用 LEFT JOIN sys_user 替代 plm_get_user_display 标量函数,避免逐行调用,大幅提升分页性能 --> |
|
|
|
<!-- 审批流 JOIN 仅在有 nodeId/approvalUsername 条件时才加入 --> |
|
|
|
<select id="queryQuotePageData" resultType="com.spring.modules.quote.entity.Quote"> |
|
|
|
select q.id, |
|
|
|
q.quote_no, |
|
|
|
@ -242,8 +250,7 @@ |
|
|
|
q.purchase, |
|
|
|
q.quoter, |
|
|
|
q.currency, |
|
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', q.currency, |
|
|
|
q.site) as currencyDesc, |
|
|
|
sdd_currency.dict_label as currencyDesc, |
|
|
|
q.status, |
|
|
|
q.customer_inquiry_no, |
|
|
|
q.inside_inquiry_no, |
|
|
|
@ -266,10 +273,10 @@ |
|
|
|
q.reject_flag, |
|
|
|
q.reject_step_id, |
|
|
|
q.annual_sales, |
|
|
|
dbo.plm_get_user_display(q.site, q.quoter) as quoterName, |
|
|
|
dbo.plm_get_user_display(q.site, q.purchase) as purchaseName, |
|
|
|
su_quoter.user_display as quoterName, |
|
|
|
su_purchase.user_display as purchaseName, |
|
|
|
p.final_customer_id as finalCustomerNo, |
|
|
|
dbo.plm_get_dictDataLabel('finalCustomer', p.final_customer_id, q.site) as finalCustomerDesc, |
|
|
|
sdd_final.dict_label as finalCustomerDesc, |
|
|
|
prn.node_id as nodeId, |
|
|
|
prn.node_name as nodeName, |
|
|
|
prn.is_reject as isReject, |
|
|
|
@ -281,6 +288,12 @@ |
|
|
|
from plm_quote q |
|
|
|
left join plm_customer_information c on q.customer_no = c.customer_no |
|
|
|
left join plm_project_info p on q.project_no = p.project_id and q.site = p.site |
|
|
|
left join sys_user su_purchase on q.purchase = su_purchase.username |
|
|
|
left join sys_user su_quoter on q.quoter = su_quoter.username |
|
|
|
left join sys_dict_data sdd_currency on sdd_currency.dict_type = 'plm_customer_information_customer_customer_currency' |
|
|
|
and sdd_currency.dict_value = q.currency and sdd_currency.site = q.site |
|
|
|
left join sys_dict_data sdd_final on sdd_final.dict_type = 'finalCustomer' |
|
|
|
and sdd_final.dict_value = p.final_customer_id and sdd_final.site = q.site |
|
|
|
left join plm_request_header prh on q.site = prh.site and prh.menu_id = '5011' |
|
|
|
left join plm_request_node prn on q.site = prn.site and prh.classification_no = prn.classification_no |
|
|
|
and prh.workflow_id = prn.workflow_id and q.step_id = prn.step_id |
|
|
|
@ -312,8 +325,7 @@ |
|
|
|
q.purchase, |
|
|
|
q.quoter, |
|
|
|
q.currency, |
|
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', q.currency, |
|
|
|
q.site) as currencyDesc, |
|
|
|
sdd_currency.dict_label as currencyDesc, |
|
|
|
q.status, |
|
|
|
q.customer_inquiry_no, |
|
|
|
q.inside_inquiry_no, |
|
|
|
@ -332,14 +344,19 @@ |
|
|
|
q.cost_model, |
|
|
|
q.markup, |
|
|
|
q.chip_price, |
|
|
|
dbo.plm_get_user_display(q.site, q.quoter) as quoterName, |
|
|
|
dbo.plm_get_user_display(q.site, q.purchase) as purchaseName, |
|
|
|
su_quoter.user_display as quoterName, |
|
|
|
su_purchase.user_display as purchaseName, |
|
|
|
p.final_customer_id as finalCustomerNo, |
|
|
|
dbo.plm_get_dictDataLabel('finalCustomer', p.final_customer_id, |
|
|
|
q.site) as finalCustomerDesc |
|
|
|
sdd_final.dict_label as finalCustomerDesc |
|
|
|
from plm_quote q |
|
|
|
left join plm_customer_information c on q.customer_no = c.customer_no |
|
|
|
left join plm_project_info p on q.project_no = p.project_id and q.site = p.site |
|
|
|
left join sys_user su_purchase on q.purchase = su_purchase.username |
|
|
|
left join sys_user su_quoter on q.quoter = su_quoter.username |
|
|
|
left join sys_dict_data sdd_currency on sdd_currency.dict_type = 'plm_customer_information_customer_customer_currency' |
|
|
|
and sdd_currency.dict_value = q.currency and sdd_currency.site = q.site |
|
|
|
left join sys_dict_data sdd_final on sdd_final.dict_type = 'finalCustomer' |
|
|
|
and sdd_final.dict_value = p.final_customer_id and sdd_final.site = q.site |
|
|
|
<where> |
|
|
|
<if test="id != null"> |
|
|
|
and q.id = #{id} |
|
|
|
@ -369,10 +386,10 @@ |
|
|
|
and p.project_name like #{ projectDesc} |
|
|
|
</if> |
|
|
|
<if test="purchase != null and purchase != ''"> |
|
|
|
and dbo.plm_get_user_display(q.site, q.purchase) like #{ purchase} |
|
|
|
and su_purchase.user_display like #{ purchase} |
|
|
|
</if> |
|
|
|
<if test="quoter != null and quoter != ''"> |
|
|
|
and dbo.plm_get_user_display(q.site, q.quoter) like #{ quoter} |
|
|
|
and su_quoter.user_display like #{ quoter} |
|
|
|
</if> |
|
|
|
<if test="customerInquiryNo != null and customerInquiryNo != ''"> |
|
|
|
and q.customer_inquiry_no like #{ customerInquiryNo} |
|
|
|
|