单据信息sql$修改为#
This commit is contained in:
@@ -50,23 +50,27 @@
|
||||
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
</if>
|
||||
<if test="subType != null">
|
||||
and dh.SubType='${subType}'
|
||||
<if test="subType != null and subType != ''">
|
||||
and dh.SubType=#{subType}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and dh.Number like '%${number}%'
|
||||
<if test="number != null and number != ''">
|
||||
<bind name="number" value="'%' + _parameter.number + '%'"/>
|
||||
and dh.Number like #{number}
|
||||
</if>
|
||||
<if test="dhIds != null">
|
||||
and dh.Id in (${dhIds})
|
||||
<if test="dhIds != null and dhIds != ''">
|
||||
and dh.Id in
|
||||
<foreach item="dhId" index="index" collection="dhIds.split(',')" open="(" separator="," close=")">
|
||||
#{dhId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and dh.OperTime >= '${beginTime}'
|
||||
<if test="beginTime != null and beginTime != ''">
|
||||
and dh.OperTime >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and dh.OperTime <= '${endTime}'
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and dh.OperTime <= #{endTime}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
order by dh.Id desc
|
||||
@@ -79,23 +83,27 @@
|
||||
COUNT(id)
|
||||
FROM jsh_depothead
|
||||
WHERE 1=1
|
||||
<if test="type != null">
|
||||
and Type='${type}'
|
||||
<if test="type != null and type != ''">
|
||||
and Type=#{type}
|
||||
</if>
|
||||
<if test="subType != null">
|
||||
and SubType='${subType}'
|
||||
<if test="subType != null and subType != ''">
|
||||
and SubType=#{subType}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and Number like '%${number}%'
|
||||
<if test="number != null and number != ''">
|
||||
<bind name="number" value="'%' + _parameter.number + '%'"/>
|
||||
and Number like #{number}
|
||||
</if>
|
||||
<if test="dhIds != null">
|
||||
and Id in (${dhIds})
|
||||
<if test="dhIds != null and dhIds != ''">
|
||||
and Id in
|
||||
<foreach item="dhId" index="index" collection="dhIds.split(',')" open="(" separator="," close=")">
|
||||
#{dhId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and OperTime >= '${beginTime}'
|
||||
<if test="beginTime != null and beginTime != ''">
|
||||
and OperTime >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and OperTime <= '${endTime}'
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and OperTime <= #{endTime}
|
||||
</if>
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
@@ -108,7 +116,7 @@
|
||||
select group_concat(concat(jsh_material.`Name`,' ',jsh_material.Model)) as mName
|
||||
from jsh_depotitem
|
||||
inner join jsh_material on jsh_depotitem.MaterialId = jsh_material.Id and ifnull(jsh_material.delete_Flag,'0') !='1'
|
||||
where jsh_depotitem.HeaderId = ${id}
|
||||
where jsh_depotitem.HeaderId = #{id}
|
||||
and ifnull(jsh_depotitem.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
@@ -120,18 +128,21 @@
|
||||
inner join jsh_material m on m.id=di.MaterialId and ifnull(m.delete_Flag,'0') !='1'
|
||||
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
inner join (select id,name as dName,delete_Flag from jsh_depot ) d on d.id=di.DepotId and ifnull(d.delete_Flag,'0') !='1'
|
||||
where dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
where dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.OrganId = ${oId}
|
||||
and dh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and di.DepotId = ${pid}
|
||||
and di.DepotId = #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
ORDER BY OperTime DESC,Number desc
|
||||
@@ -147,18 +158,21 @@
|
||||
inner join jsh_material m on m.id=di.MaterialId and ifnull(m.delete_Flag,'0') !='1'
|
||||
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
inner join (select id,name as dName,delete_Flag from jsh_depot) d on d.id=di.DepotId and ifnull(d.delete_Flag,'0') !='1'
|
||||
where dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
where dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.OrganId = ${oId}
|
||||
and dh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and di.DepotId = ${pid}
|
||||
and di.DepotId = #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
ORDER BY OperTime DESC,Number desc
|
||||
@@ -170,15 +184,18 @@
|
||||
(select sum(jdi.BasicNumber) numSum from jsh_depothead jdh
|
||||
INNER JOIN jsh_depotitem jdi on jdh.id=jdi.HeaderId and ifnull(jdi.delete_Flag,'0') !='1'
|
||||
where jdi.MaterialId=di.MaterialId
|
||||
and jdh.type='${type}' and jdh.OperTime >='${beginTime}' and jdh.OperTime <='${endTime}'
|
||||
and jdh.type=#{type} and jdh.OperTime >=#{beginTime} and jdh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and jdh.OrganId = ${oId}
|
||||
and jdh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and jdi.DepotId= ${pid}
|
||||
and jdi.DepotId= #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and jdi.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and jdi.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
and ifnull(jdh.delete_Flag,'0') !='1'
|
||||
) numSum,
|
||||
@@ -186,15 +203,18 @@
|
||||
(select sum(jdi.AllPrice) priceSum from jsh_depothead jdh
|
||||
INNER JOIN jsh_depotitem jdi on jdh.id=jdi.HeaderId and ifnull(jdi.delete_Flag,'0') !='1'
|
||||
where jdi.MaterialId=di.MaterialId
|
||||
and jdh.type='${type}' and jdh.OperTime >='${beginTime}' and jdh.OperTime <='${endTime}'
|
||||
and jdh.type=#{type} and jdh.OperTime >=#{beginTime} and jdh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and jdh.OrganId = ${oId}
|
||||
and jdh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and jdi.DepotId= ${pid}
|
||||
and jdi.DepotId= #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and jdi.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and jdi.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
and ifnull(jdh.delete_Flag,'0') !='1'
|
||||
) priceSum
|
||||
@@ -205,15 +225,18 @@
|
||||
INNER JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id and ifnull(jsh_materialcategory.status,'0') !='2'
|
||||
where ifnull(jsh_material.delete_Flag,'0') !='1'
|
||||
) m
|
||||
on m.Id=di.MaterialId where dh.type='${type}' and dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
on m.Id=di.MaterialId where dh.type=#{type} and dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.OrganId = ${oId}
|
||||
and dh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
and di.DepotId= #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName
|
||||
@@ -230,15 +253,18 @@
|
||||
from jsh_material
|
||||
INNER JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id and ifnull(jsh_materialcategory.status,'0') !='2'
|
||||
where ifnull(jsh_material.delete_Flag,'0') !='1'
|
||||
) m on m.Id=di.MaterialId where dh.type='${type}' and dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
) m on m.Id=di.MaterialId where dh.type=#{type} and dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="oId != null">
|
||||
and dh.OrganId = ${oId}
|
||||
and dh.OrganId = #{oId}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
and di.DepotId= #{pid}
|
||||
</if>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
<if test="pid == null and dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName) a
|
||||
@@ -248,20 +274,20 @@
|
||||
select dh.Number,concat(dh.SubType,dh.Type) as type,dh.DiscountLastMoney,dh.ChangeAmount,s.supplier supplierName,
|
||||
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh
|
||||
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
|
||||
and dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
where s.type=#{supType} and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
|
||||
and dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="organId != null">
|
||||
and dh.OrganId=${organId}
|
||||
and dh.OrganId=#{organId}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
UNION ALL
|
||||
select ah.BillNo Number,ah.Type as newType,ah.TotalPrice DiscountLastMoney,ah.ChangeAmount,s.supplier supplierName,
|
||||
date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah
|
||||
inner join jsh_supplier s on s.id=ah.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
where s.type='${supType}'
|
||||
and ah.BillTime >='${beginTime}' and ah.BillTime <='${endTime}'
|
||||
where s.type=#{supType}
|
||||
and ah.BillTime >=#{beginTime} and ah.BillTime <=#{endTime}
|
||||
<if test="organId != null">
|
||||
and ah.OrganId=${organId}
|
||||
and ah.OrganId=#{organId}
|
||||
</if>
|
||||
and ifnull(ah.delete_Flag,'0') !='1'
|
||||
ORDER BY oTime
|
||||
@@ -275,27 +301,27 @@
|
||||
(
|
||||
select count(1) a from jsh_depothead dh
|
||||
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
|
||||
and dh.OperTime >='${beginTime}' and dh.OperTime <='${endTime}'
|
||||
where s.type=#{supType} and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
|
||||
and dh.OperTime >=#{beginTime} and dh.OperTime <=#{endTime}
|
||||
<if test="organId != null">
|
||||
and dh.OrganId=${organId}
|
||||
and dh.OrganId=#{organId}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
UNION ALL
|
||||
select count(1) a from jsh_accounthead ah
|
||||
inner join jsh_supplier s on s.id=ah.OrganId and ifnull(s.delete_Flag,'0') !='1'
|
||||
where s.type='${supType}'
|
||||
and ah.BillTime >='${beginTime}' and ah.BillTime <='${endTime}'
|
||||
where s.type=#{supType}
|
||||
and ah.BillTime >=#{beginTime} and ah.BillTime <=#{endTime}
|
||||
<if test="organId != null">
|
||||
and ah.OrganId=${organId}
|
||||
and ah.OrganId=#{organId}
|
||||
</if>
|
||||
and ifnull(ah.delete_Flag,'0') !='1'
|
||||
) cc
|
||||
</select>
|
||||
|
||||
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
||||
select sum(${modeName}) as allMoney from jsh_depothead where Type='${type}' and SubType = '${subType}'
|
||||
and OrganId =${supplierId} and OperTime <='${endTime}'
|
||||
select sum(#{modeName}) as allMoney from jsh_depothead where Type=#{type} and SubType = #{subType}
|
||||
and OrganId =#{supplierId} and OperTime <=#{endTime}
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
@@ -309,7 +335,7 @@
|
||||
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="number != null">
|
||||
and dh.Number='${number}'
|
||||
and dh.Number=#{number}
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user