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