优化出入库汇总的接口,提高查询速度
This commit is contained in:
@@ -303,20 +303,17 @@
|
||||
</select>
|
||||
|
||||
<select id="findInOutMaterialCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
|
||||
select di.material_id, m.bar_code, m.mName,m.Model,m.standard,m.categoryName,m.materialUnit,
|
||||
select di.material_id, me.bar_code, m.name mName,m.Model,m.standard,mc.name categoryName,concat_ws('', m.unit, u.basic_unit) materialUnit,
|
||||
sum(di.basic_number) numSum,
|
||||
sum(di.all_price) priceSum
|
||||
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 (select jsh_material.id,jsh_material.name mName, me.bar_code, Model, standard,
|
||||
jsh_material_category.`Name` categoryName, concat_ws('', jsh_material.unit, u.basic_unit) materialUnit
|
||||
from jsh_material
|
||||
left join jsh_unit u on jsh_material.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
left join jsh_material_extend me on me.material_id=jsh_material.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_category on jsh_material.category_id=jsh_material_category.Id and ifnull(jsh_material_category.delete_flag,'0') !='1'
|
||||
where me.default_flag=1 and ifnull(jsh_material.delete_Flag,'0') !='1'
|
||||
) m
|
||||
on m.Id=di.material_id where (dh.type=#{type} or dh.sub_type='调拨') and dh.oper_time >=#{beginTime} and dh.oper_time <=#{endTime}
|
||||
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
|
||||
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_category mc on m.category_id=mc.Id and ifnull(mc.delete_flag,'0') !='1'
|
||||
where me.default_flag=1
|
||||
and (dh.type=#{type} or dh.sub_type='调拨') and dh.oper_time >=#{beginTime} and dh.oper_time <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.organ_id = #{oId}
|
||||
</if>
|
||||
@@ -354,14 +351,12 @@
|
||||
|
||||
<select id="findInOutMaterialCountTotal" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
(select di.material_id, m.mName,m.bar_code,m.Model,m.standard,m.categoryName from jsh_depot_head dh
|
||||
(select di.material_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 (select jsh_material.id,jsh_material.name mName, me.bar_code, Model,standard,jsh_material_category.`Name` categoryName
|
||||
from jsh_material
|
||||
left join jsh_material_extend me on me.material_id=jsh_material.id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_category on jsh_material.category_id=jsh_material_category.Id and ifnull(jsh_material_category.delete_flag,'0') !='1'
|
||||
where me.default_flag=1 and ifnull(jsh_material.delete_Flag,'0') !='1'
|
||||
) m on m.Id=di.material_id where (dh.type=#{type} or dh.sub_type='调拨') and dh.oper_time >=#{beginTime} and dh.oper_time <=#{endTime}
|
||||
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_flag,'0') !='1'
|
||||
where me.default_flag=1
|
||||
and (dh.type=#{type} or dh.sub_type='调拨') and dh.oper_time >=#{beginTime} and dh.oper_time <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.organ_id = #{oId}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user