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
e8fdc839
Commit
e8fdc839
authored
May 30, 2022
by
季圣华
Browse files
优化进销存统计报表的查询逻辑
parent
c24fdc71
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
e8fdc839
...
@@ -237,16 +237,13 @@
...
@@ -237,16 +237,13 @@
<select
id=
"findByAll"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultByMaterial"
>
<select
id=
"findByAll"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultByMaterial"
>
select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,
select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, u.name unit_name,
concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, u.name unit_name, ifnull(me.purchase_decimal,0) purchase_decimal
(select ifnull(purchase_decimal,0) from jsh_material_extend me
where me.material_id=m.id and me.default_flag=1 and ifnull(me.delete_Flag,'0') !='1' limit 0,1)
purchase_decimal
from jsh_material m
from jsh_material m
left join jsh_
depot_item di
on
di
.material_id=m.id
and ifnull(
di
.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_extend me on me.id=
di.material_
extend_
id
and ifnull(
me
.delete_Flag,'0') !='1'
left join jsh_
depot_item di on
di.material_
id=m.
id and ifnull(
di
.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id
and ifnull(dh.delete_flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.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_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
where 1=1
and me.default_flag=1
<if
test=
"materialParam != null and materialParam !=''"
>
<if
test=
"materialParam != null and materialParam !=''"
>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
...
@@ -265,10 +262,10 @@
...
@@ -265,10 +262,10 @@
<select
id=
"findByAllCount"
resultType=
"java.lang.Integer"
>
<select
id=
"findByAllCount"
resultType=
"java.lang.Integer"
>
select count(1) from (select m.id
select count(1) from (select m.id
from jsh_material m
from jsh_material m
left join jsh_
depot_item di
on
di
.material_id=m.id
and ifnull(m.delete_Flag,'0') !='1'
left join jsh_
material_extend me
on
me
.material_id=m.id and ifnull(m
e
.delete_Flag,'0') !='1'
left join jsh_
material_extend me on me.id=
di.material_
extend_
id
and ifnull(
me
.delete_Flag,'0') !='1'
left join jsh_
depot_item di on
di.material_
id=m.
id and ifnull(
di
.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id
and ifnull(dh.delete_flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
where 1=1
where 1=1
and me.default_flag=1
<if
test=
"materialParam != null and materialParam !=''"
>
<if
test=
"materialParam != null and materialParam !=''"
>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
...
@@ -276,7 +273,7 @@
...
@@ -276,7 +273,7 @@
<if
test=
"endTime != null"
>
<if
test=
"endTime != null"
>
and dh.oper_time
<
= #{endTime}
and dh.oper_time
<
= #{endTime}
</if>
</if>
and ifnull(
di
.delete_flag,'0') !='1'
and ifnull(
m
.delete_flag,'0') !='1'
group by m.id) cc
group by m.id) cc
</select>
</select>
...
...
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