常熟吴彦祖 4 weeks ago
parent
commit
50b0cfa2d8
  1. 6
      src/main/java/com/xujie/modules/srm/service/impl/SrmSupplierServiceImpl.java
  2. 13
      src/main/resources/mapper/srm/SrmSupplierMapper.xml

6
src/main/java/com/xujie/modules/srm/service/impl/SrmSupplierServiceImpl.java

@ -33,7 +33,11 @@ public class SrmSupplierServiceImpl extends ServiceImpl<SrmSupplierMapper, SrmSu
@Override @Override
public PageUtils searchSrmSupplierList(SrmSupplierData data){ public PageUtils searchSrmSupplierList(SrmSupplierData data){
IPage<SrmSupplierData> resultList = srmSupplierMapper.searchSrmSupplierList(new Page<SrmSupplierData>(data.getPage(), data.getLimit()), data);
Page<SrmSupplierData> page = new Page<>(data.getPage(), data.getLimit());
// 自定义 SQL多表 LEFT JOIN + 动态 WHERE自动生成 count 常会裁掉 WHERE 仍保留占位符
// 导致 SQL Server 参数超出范围关闭 count SQL 优化使用子查询包一层统计总量
IPage<SrmSupplierData> resultList = srmSupplierMapper.searchSrmSupplierList(page, data);
return new PageUtils(resultList); return new PageUtils(resultList);
} }
@Override @Override

13
src/main/resources/mapper/srm/SrmSupplierMapper.xml

@ -18,7 +18,7 @@
s.supplier_no AS supplierNo, s.supplier_no AS supplierNo,
s.supplier_name AS supplierName, s.supplier_name AS supplierName,
s.supplier_group AS supplierGroup, s.supplier_group AS supplierGroup,
sg.GroupDesc AS groupDesc,
sg.dict_label AS groupDesc,
s.supplier_doc_type AS supplierDocType, s.supplier_doc_type AS supplierDocType,
s.create_date AS createDate, s.create_date AS createDate,
s.create_by AS createBy, s.create_by AS createBy,
@ -51,9 +51,12 @@
s.Other_contact2 AS otherContact2, s.Other_contact2 AS otherContact2,
s.Other_contact3 AS otherContact3, s.Other_contact3 AS otherContact3,
s.Memo AS memo, s.c_short_office,s.c_short_npc s.Memo AS memo, s.c_short_office,s.c_short_npc
FROM srm_supplier s LEFT JOIN SupplierGroup sg ON sg.supplier_group = s.supplier_group
AND sg.Site = s.site LEFT JOIN Currency c ON c.Currency = s.Currency
AND c.Site = s.site LEFT JOIN Tax t ON t.tax_code = s.TaxCode
FROM srm_supplier s
LEFT JOIN sys_dict_data sg ON sg.dict_value = s.supplier_group
AND sg.dict_type='supplier_group'
LEFT JOIN Currency c ON c.Currency = s.Currency
AND c.Site = s.site
LEFT JOIN Tax t ON t.tax_code = s.TaxCode
AND t.Site = s.site AND t.Site = s.site
LEFT JOIN DeliveryTerm dt LEFT JOIN DeliveryTerm dt
ON dt.delivery_term_id = s.DeliveryTerm ON dt.delivery_term_id = s.DeliveryTerm
@ -88,7 +91,7 @@
</foreach> </foreach>
</if> </if>
</where> </where>
ORDER BY s.id
ORDER BY s.supplier_no
</select> </select>
<select id="checkSrmSupplierList" resultType="SrmSupplierData"> <select id="checkSrmSupplierList" resultType="SrmSupplierData">
SELECT SELECT

Loading…
Cancel
Save