优化采购统计和销售统计报表的查询条件
This commit is contained in:
@@ -233,6 +233,67 @@
|
||||
group by m.id) cc
|
||||
</select>
|
||||
|
||||
<select id="getListWithBugOrSale" 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,
|
||||
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
|
||||
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.id=di.material_extend_id and ifnull(me.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'
|
||||
where 1=1
|
||||
<if test="materialParam != null and 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})
|
||||
</if>
|
||||
<if test="billType =='buy'">
|
||||
and (dh.sub_type = '采购' or dh.sub_type = '采购退货')
|
||||
</if>
|
||||
<if test="billType =='sale'">
|
||||
and (dh.sub_type = '销售' or dh.sub_type = '销售退货' or dh.sub_type = '零售' or dh.sub_type = '零售退货')
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and dh.oper_time >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and dh.oper_time <= #{endTime}
|
||||
</if>
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
group by m.id
|
||||
order by m.id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListWithBugOrSaleCount" resultType="java.lang.Integer">
|
||||
select count(1) from (select m.id
|
||||
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.id=di.material_extend_id and ifnull(me.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
|
||||
<if test="materialParam != null and 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})
|
||||
</if>
|
||||
<if test="billType =='buy'">
|
||||
and (dh.sub_type = '采购' or dh.sub_type = '采购退货')
|
||||
</if>
|
||||
<if test="billType =='sale'">
|
||||
and (dh.sub_type = '销售' or dh.sub_type = '销售退货' or dh.sub_type = '零售' or dh.sub_type = '零售退货')
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and dh.oper_time >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and dh.oper_time <= #{endTime}
|
||||
</if>
|
||||
and ifnull(di.delete_flag,'0') !='1'
|
||||
group by m.id) cc
|
||||
</select>
|
||||
|
||||
<select id="buyOrSaleNumber" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(basic_number),0) as BasicNumber from jsh_depot_item di,jsh_depot_head dh
|
||||
where di.header_id = dh.id
|
||||
|
||||
Reference in New Issue
Block a user