切换到jsh的版本
This commit is contained in:
@@ -42,8 +42,9 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByConditionDepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||
select dh.*, s.supplier OrganName, p.name HandsPersonName, a.name AccountName
|
||||
select distinct dh.*, d.name ProjectName, s.supplier OrganName, p.name HandsPersonName, a.name AccountName, dd.name AllocationProjectName
|
||||
from jsh_depothead dh
|
||||
left join jsh_depot d on dh.ProjectId=d.id and ifnull(d.delete_Flag,'0') !='1'
|
||||
left join jsh_supplier s on dh.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
@@ -51,41 +52,28 @@
|
||||
left join jsh_depotitem di on dh.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
</if>
|
||||
<if test="subType != null and subType != ''">
|
||||
and dh.SubType=#{subType}
|
||||
<if test="subType != null">
|
||||
and dh.SubType='${subType}'
|
||||
</if>
|
||||
<if test="number != null and number != ''">
|
||||
<bind name="number" value="'%' + _parameter.number + '%'"/>
|
||||
and dh.Number like #{number}
|
||||
<if test="number != null">
|
||||
and dh.Number like '%${number}%'
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''">
|
||||
and dh.OperTime >= #{beginTime}
|
||||
<if test="beginTime != null">
|
||||
and dh.OperTime >= '${beginTime}'
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and dh.OperTime <= #{endTime}
|
||||
<if test="endTime != null">
|
||||
and dh.OperTime <= '${endTime}'
|
||||
</if>
|
||||
<if test="materialParam != null">
|
||||
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
|
||||
</if>
|
||||
<if test="depotIds != null">
|
||||
and di.DepotId in (${depotIds})
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
and exists (
|
||||
select 0 from jsh_depotitem di
|
||||
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1' and di.tenant_id=m.tenant_id
|
||||
where 1=1
|
||||
and dh.Id = di.HeaderId
|
||||
and dh.tenant_id=di.tenant_id
|
||||
and ifnull(di.delete_Flag,'0') !='1'
|
||||
<if test="materialParam != null and materialParam != ''">
|
||||
<bind name="materialParam" value="'%' + _parameter.materialParam + '%'"/>
|
||||
and (m.Name like #{materialParam} or m.Model like #{materialParam})
|
||||
</if>
|
||||
<if test="depotIds != null and depotIds != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="depotIds.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
order by dh.Id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
@@ -93,48 +81,35 @@
|
||||
</select>
|
||||
<select id="countsByDepotHead" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(dh.id)
|
||||
FROM jsh_depothead dh
|
||||
left join jsh_supplier s on dh.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
COUNT(1) from
|
||||
(select distinct jsh_depothead.* FROM jsh_depothead
|
||||
left join jsh_depotitem di on jsh_depothead.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
|
||||
WHERE 1=1
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
<if test="type != null">
|
||||
and Type='${type}'
|
||||
</if>
|
||||
<if test="subType != null and subType != ''">
|
||||
and dh.SubType=#{subType}
|
||||
<if test="subType != null">
|
||||
and SubType='${subType}'
|
||||
</if>
|
||||
<if test="number != null and number != ''">
|
||||
<bind name="number" value="'%' + _parameter.number + '%'"/>
|
||||
and dh.Number like #{number}
|
||||
<if test="number != null">
|
||||
and Number like '%${number}%'
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''">
|
||||
and dh.OperTime >= #{beginTime}
|
||||
<if test="beginTime != null">
|
||||
and OperTime >= '${beginTime}'
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and dh.OperTime <= #{endTime}
|
||||
<if test="endTime != null">
|
||||
and OperTime <= '${endTime}'
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
and exists (
|
||||
select 0 from jsh_depotitem di
|
||||
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1' and di.tenant_id=m.tenant_id
|
||||
where 1=1
|
||||
and dh.Id = di.HeaderId
|
||||
and dh.tenant_id=di.tenant_id
|
||||
and ifnull(di.delete_Flag,'0') !='1'
|
||||
<if test="materialParam != null and materialParam != ''">
|
||||
<bind name="materialParam" value="'%' + _parameter.materialParam + '%'"/>
|
||||
and (m.Name like #{materialParam} or m.Model like #{materialParam})
|
||||
<if test="materialParam != null">
|
||||
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
|
||||
</if>
|
||||
<if test="depotIds != null and depotIds != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="depotIds.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="depotIds != null">
|
||||
and di.DepotId in (${depotIds})
|
||||
</if>
|
||||
)
|
||||
and ifnull(jsh_depothead.delete_Flag,'0') !='1') tb
|
||||
</select>
|
||||
|
||||
<select id="getMaxId" resultType="java.lang.Long">
|
||||
select max(Id) as Id from jsh_depothead
|
||||
</select>
|
||||
@@ -143,7 +118,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>
|
||||
|
||||
@@ -155,21 +130,18 @@
|
||||
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 dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
ORDER BY OperTime DESC,Number desc
|
||||
@@ -185,21 +157,18 @@
|
||||
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 dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and dh.Type=#{type}
|
||||
<if test="type != null">
|
||||
and dh.Type='${type}'
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
ORDER BY OperTime DESC,Number desc
|
||||
@@ -211,18 +180,15 @@
|
||||
(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 dids != null and dids != ''">
|
||||
and jdi.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and jdi.DepotId in (${dids})
|
||||
</if>
|
||||
and ifnull(jdh.delete_Flag,'0') !='1'
|
||||
) numSum,
|
||||
@@ -230,18 +196,15 @@
|
||||
(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 dids != null and dids != ''">
|
||||
and jdi.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and jdi.DepotId in (${dids})
|
||||
</if>
|
||||
and ifnull(jdh.delete_Flag,'0') !='1'
|
||||
) priceSum
|
||||
@@ -252,18 +215,15 @@
|
||||
LEFT 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 dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName
|
||||
@@ -280,18 +240,15 @@
|
||||
from jsh_material
|
||||
LEFT 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 dids != null and dids != ''">
|
||||
and di.DepotId in
|
||||
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
|
||||
#{did}
|
||||
</foreach>
|
||||
<if test="pid == null">
|
||||
and di.DepotId in (${dids})
|
||||
</if>
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName) a
|
||||
@@ -301,20 +258,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
|
||||
@@ -328,27 +285,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>
|
||||
|
||||
@@ -362,7 +319,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>
|
||||
@@ -477,8 +434,13 @@
|
||||
</set>
|
||||
where Id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateBuildOnlyNumber">
|
||||
update tbl_sequence set current_val = current_val + 1 where seq_name = 'depot_number_seq'
|
||||
</update>
|
||||
|
||||
<select id="getBuildOnlyNumber" resultType="java.lang.Long">
|
||||
select _nextval(#{seq_name}) from dual;
|
||||
select current_val from tbl_sequence where seq_name = 'depot_number_seq'
|
||||
</select>
|
||||
|
||||
<update id="batchDeleteDepotHeadByIds">
|
||||
|
||||
Reference in New Issue
Block a user