Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
79acd695
Commit
79acd695
authored
May 30, 2022
by
季圣华
Browse files
优化出入库汇总的接口,提高查询速度
parent
8b8a5c71
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
79acd695
...
...
@@ -187,20 +187,13 @@ public class DepotHeadController {
depotList
.
add
(
object
.
getLong
(
"id"
));
}
}
List
<
DepotHeadVo4InOutMCount
>
resList
=
new
ArrayList
<>();
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
List
<
DepotHeadVo4InOutMCount
>
list
=
depotHeadService
.
findInOutMaterialCount
(
beginTime
,
endTime
,
type
,
materialParam
,
depotList
,
oId
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
int
total
=
depotHeadService
.
findInOutMaterialCountTotal
(
beginTime
,
endTime
,
type
,
materialParam
,
depotList
,
oId
);
map
.
put
(
"total"
,
total
);
//存放数据json数组
if
(
null
!=
list
)
{
for
(
DepotHeadVo4InOutMCount
dhc
:
list
)
{
resList
.
add
(
dhc
);
}
}
map
.
put
(
"rows"
,
resList
);
map
.
put
(
"rows"
,
list
);
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
){
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
79acd695
...
...
@@ -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, m
e
.bar_code, m.
name
mName,m.Model,m.standard,m
c.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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment