优化单据的查询sql

This commit is contained in:
季圣华
2023-08-07 22:22:46 +08:00
parent 79490f18a5
commit fa407541f9

View File

@@ -54,7 +54,7 @@
<select id="selectByConditionDepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select jdh.*, s.supplier OrganName, u.username userName, a.name AccountName
from (select distinct dh.id
from (select dh.id
from jsh_depot_head dh
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
@@ -148,6 +148,7 @@
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
</if>
and ifnull(dh.delete_flag,'0') !='1'
group by dh.id
order by dh.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}