优化单据的额查询列表的逻辑,提高查询速度(继续优化)

This commit is contained in:
季圣华
2022-11-23 23:34:43 +08:00
parent 95ead95c8f
commit 43111edc54
9 changed files with 195 additions and 66 deletions

View File

@@ -189,10 +189,23 @@
and ifnull(delete_flag,'0') !='1'
</select>
<select id="getFinancialBillNoByBillIdList" resultType="com.jsh.erp.datasource.entities.AccountItem">
select ai.bill_id from jsh_account_head ah
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
where 1=1
<if test="idList.size()>0">
and ai.bill_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(ah.delete_flag,'0') !='1'
</select>
<select id="getFinancialBillNoByBillId" resultType="com.jsh.erp.datasource.entities.AccountHead">
select ah.bill_no from jsh_account_head ah
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
where bill_id=#{billId}
where ai.bill_id=#{billId}
and ifnull(ah.delete_flag,'0') !='1'
</select>
</mapper>

View File

@@ -243,18 +243,32 @@
and ifnull(dh.delete_Flag,'0') !='1') tb
</select>
<select id="findMaterialsListByHeaderId" resultType="java.lang.String">
select group_concat(concat(jsh_material.name,' ',ifnull(jsh_material.standard,''),' ',ifnull(jsh_material.model,''))) as mName
<select id="findMaterialsListMapByHeaderIdList" resultType="com.jsh.erp.datasource.vo.MaterialsListVo">
select jsh_depot_item.header_id, group_concat(concat(jsh_material.name,' ',ifnull(jsh_material.standard,''),' ',ifnull(jsh_material.model,''))) as materialsList
from jsh_depot_item
left join jsh_material on jsh_depot_item.material_id = jsh_material.Id and ifnull(jsh_material.delete_Flag,'0') !='1'
where jsh_depot_item.header_id = #{id}
where 1=1
<if test="idList.size()>0">
and jsh_depot_item.header_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(jsh_depot_item.delete_flag,'0') !='1'
group by jsh_depot_item.header_id
</select>
<select id="getMaterialCountByHeaderId" resultType="java.math.BigDecimal">
select sum(oper_number) from jsh_depot_item
where header_id = #{id}
<select id="getMaterialCountListByHeaderIdList" resultType="com.jsh.erp.datasource.vo.MaterialCountVo">
select header_id, sum(oper_number) materialCount from jsh_depot_item
where 1=1
<if test="idList.size()>0">
and header_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(delete_flag,'0') !='1'
group by header_id
</select>
<select id="findInOutDetail" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
@@ -965,6 +979,7 @@
</foreach>
</if>
and ifnull(dh.delete_flag,'0') !='1'
group by dh.link_number
</select>
<select id="getFinishDepositByNumberExceptCurrent" resultType="java.math.BigDecimal">