给单据补回count方法

This commit is contained in:
jishenghua 2025-02-24 23:47:19 +08:00
parent b04ab39d77
commit 1b0bffbaff
4 changed files with 192 additions and 0 deletions

View File

@ -26,6 +26,20 @@ public interface AccountHeadMapperEx {
@Param("remark") String remark,
@Param("number") String number);
Long countsByAccountHead(
@Param("type") String type,
@Param("creatorArray") String[] creatorArray,
@Param("billNo") String billNo,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("organId") Long organId,
@Param("creator") Long creator,
@Param("handsPersonId") Long handsPersonId,
@Param("accountId") Long accountId,
@Param("status") String status,
@Param("remark") String remark,
@Param("number") String number);
List<AccountHeadVo4ListEx> getDetailByNumber(
@Param("billNo") String billNo);

View File

@ -36,6 +36,27 @@ public interface DepotHeadMapperEx {
@Param("accountId") Long accountId,
@Param("remark") String remark);
Long countsByDepotHead(
@Param("type") String type,
@Param("subType") String subType,
@Param("creatorArray") String[] creatorArray,
@Param("hasDebt") String hasDebt,
@Param("statusArray") String[] statusArray,
@Param("purchaseStatusArray") String[] purchaseStatusArray,
@Param("number") String number,
@Param("linkApply") String linkApply,
@Param("linkNumber") String linkNumber,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("materialParam") String materialParam,
@Param("organId") Long organId,
@Param("organArray") String[] organArray,
@Param("creator") Long creator,
@Param("depotId") Long depotId,
@Param("depotArray") String[] depotArray,
@Param("accountId") Long accountId,
@Param("remark") String remark);
List<MaterialsListVo> findMaterialsListMapByHeaderIdList(
@Param("idList") List<Long> idList);

View File

@ -71,6 +71,64 @@
order by ah.id desc
</select>
<select id="countsByAccountHead" resultType="java.lang.Long">
SELECT
COUNT(1) from
(select distinct ah.* FROM jsh_account_head ah
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
left join jsh_depot_head dh on dh.id=ai.bill_id and ifnull(dh.delete_flag,'0') !='1'
WHERE 1=1
<if test="billNo != null">
<bind name="bindBillNo" value="'%'+billNo+'%'"/>
and ah.bill_no like #{bindBillNo}
</if>
<if test="type != null">
and ah.type=#{type}
</if>
<if test="beginTime != null">
and ah.bill_time &gt;= #{beginTime}
</if>
<if test="endTime != null">
and ah.bill_time &lt;= #{endTime}
</if>
<if test="organId != null">
and ah.organ_id=#{organId}
</if>
<if test="handsPersonId != null">
and ah.hands_person_id=#{handsPersonId}
</if>
<if test="creator != null">
and ah.creator=#{creator}
</if>
<if test="creatorArray != null">
and ah.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="accountId != null">
and ah.account_id=#{accountId}
</if>
<if test="status != null and status != ''">
and ah.status=#{status}
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and ah.remark like #{bindRemark}
</if>
<if test="number != null and number !=''">
<if test="number == 'QiChu'">
and ai.bill_id is null
</if>
<if test="number != 'QiChu'">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
</if>
and ifnull(ah.delete_flag,'0') !='1') tb
</select>
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
from jsh_account_head ah

View File

@ -167,6 +167,105 @@
order by jdh.id desc
</select>
<select id="countsByDepotHead" resultType="java.lang.Long">
select
count(1) from
(select distinct dh.id from jsh_depot_head dh
left join jsh_depot_item di on dh.Id = di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on di.material_id = m.Id and ifnull(m.delete_Flag,'0') !='1'
left join jsh_material_extend me on di.material_extend_id = me.id and ifnull(me.delete_flag,'0') !='1'
WHERE 1=1
<if test="type != null">
and dh.type=#{type}
</if>
<if test="subType != null">
and dh.sub_type=#{subType}
</if>
<if test="statusArray != null and statusArray !=''">
and dh.status in (
<foreach collection="statusArray" item="status" separator=",">
#{status}
</foreach>
)
</if>
<if test="purchaseStatusArray != null and purchaseStatusArray !=''">
and dh.purchase_status in (
<foreach collection="purchaseStatusArray" item="purchaseStatus" separator=",">
#{purchaseStatus}
</foreach>
)
</if>
<if test="number != null">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="linkApply != null">
<bind name="bindLinkApply" value="'%'+linkApply+'%'"/>
and dh.link_apply like #{bindLinkApply}
</if>
<if test="linkNumber != null">
<bind name="bindLinkNumber" value="'%'+linkNumber+'%'"/>
and dh.link_number like #{bindLinkNumber}
</if>
<if test="beginTime != null">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null">
and dh.oper_time &lt;= #{endTime}
</if>
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
</if>
<if test="organId != null">
and dh.organ_id=#{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
#{organId}
</foreach>
)
</if>
<if test="creator != null">
and dh.creator=#{creator}
</if>
<if test="depotId != null">
and di.depot_id=#{depotId}
</if>
<if test="depotArray != null and depotArray !=''">
and di.depot_id in (
<foreach collection="depotArray" item="depotId" separator=",">
#{depotId}
</foreach>
)
</if>
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="accountId != null">
<bind name="bindAccountId" value="'%'+accountId+'%'"/>
and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId})
</if>
<if test="hasDebt != null and hasDebt ==1">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))>0)
</if>
<if test="hasDebt != null and hasDebt ==0">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))=0)
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
</if>
and ifnull(dh.delete_Flag,'0') !='1') tb
</select>
<select id="findMaterialsListMapByHeaderIdList" resultType="com.jsh.erp.datasource.vo.MaterialsListVo">
select jsh_depot_item.header_id, group_concat(concat(jsh_material.name,' ',ifnull(jsh_material.standard,''),' ',
ifnull(jsh_material.model,''),' ',ifnull(jsh_material.color,''))) as materialsList