去掉应收登记收款功能逻辑
This commit is contained in:
@@ -31,8 +31,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
case l.object_type
|
||||
when 'BILL' then b.bill_no
|
||||
when 'EXPORT' then coalesce(e.file_name, b.bill_no)
|
||||
when 'RECEIPT' then r.receipt_no
|
||||
when 'WRITEOFF' then w.writeoff_no
|
||||
when 'BALANCE_WRITEOFF' then bw.writeoff_no
|
||||
else null
|
||||
end as object_display,
|
||||
@@ -41,8 +39,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ar_bill_log l
|
||||
left join ar_bill b on b.ar_bill_id = l.ar_bill_id
|
||||
left join ar_bill_export e on e.export_id = case when l.object_type = 'EXPORT' then cast(l.object_id as unsigned) end
|
||||
left join ar_receipt r on r.receipt_id = case when l.object_type = 'RECEIPT' then cast(l.object_id as unsigned) end
|
||||
left join ar_receipt_writeoff w on w.writeoff_id = case when l.object_type = 'WRITEOFF' then cast(l.object_id as unsigned) end
|
||||
left join ar_balance_writeoff bw on bw.writeoff_id = case when l.object_type = 'BALANCE_WRITEOFF' then cast(l.object_id as unsigned) end
|
||||
<where>
|
||||
<if test="arBillId != null">and l.ar_bill_id = #{arBillId}</if>
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ar.mapper.ArReceiptMapper">
|
||||
<resultMap id="ArReceiptResult" type="ArReceipt">
|
||||
<id property="receiptId" column="receipt_id"/>
|
||||
<result property="receiptNo" column="receipt_no"/>
|
||||
<result property="customerId" column="customer_id"/>
|
||||
<result property="customerName" column="customer_name"/>
|
||||
<result property="customerCode" column="customer_code"/>
|
||||
<result property="receiptDate" column="receipt_date"/>
|
||||
<result property="currency" column="currency"/>
|
||||
<result property="receiptAmount" column="receipt_amount"/>
|
||||
<result property="unallocatedAmount" column="unallocated_amount"/>
|
||||
<result property="paymentMethod" column="payment_method"/>
|
||||
<result property="bankReference" column="bank_reference"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectReceiptColumns">
|
||||
select r.receipt_id, r.receipt_no, r.customer_id, c.customer_name, c.customer_code,
|
||||
r.receipt_date, r.currency, r.receipt_amount, r.unallocated_amount,
|
||||
r.payment_method, r.bank_reference, r.status, r.remark,
|
||||
r.create_by, r.create_time, r.update_by, r.update_time
|
||||
from ar_receipt r
|
||||
left join bms_customer c on c.customer_id = r.customer_id and c.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<!-- 加锁更新只读取收款主表,避免锁定展示关联表。 -->
|
||||
<sql id="selectReceiptLockColumns">
|
||||
select receipt_id, receipt_no, customer_id, receipt_date, currency, receipt_amount,
|
||||
unallocated_amount, payment_method, bank_reference, status, remark,
|
||||
create_by, create_time, update_by, update_time
|
||||
from ar_receipt
|
||||
</sql>
|
||||
|
||||
<select id="selectArReceiptList" parameterType="com.ruoyi.ar.domain.vo.ArReceiptQuery" resultMap="ArReceiptResult">
|
||||
<include refid="selectReceiptColumns"/>
|
||||
<where>
|
||||
<if test="receiptNo != null and receiptNo != ''">and r.receipt_no like concat('%', #{receiptNo}, '%')</if>
|
||||
<if test="customerId != null">and r.customer_id = #{customerId}</if>
|
||||
<if test="currency != null and currency != ''">and r.currency = #{currency}</if>
|
||||
<if test="paymentMethod != null and paymentMethod != ''">and r.payment_method = #{paymentMethod}</if>
|
||||
<if test="status != null and status != ''">and r.status = #{status}</if>
|
||||
<if test="receiptDateStart != null">and r.receipt_date >= #{receiptDateStart}</if>
|
||||
<if test="receiptDateEnd != null">and r.receipt_date <= #{receiptDateEnd}</if>
|
||||
</where>
|
||||
order by r.receipt_date desc, r.receipt_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectArReceiptById" parameterType="long" resultMap="ArReceiptResult">
|
||||
<include refid="selectReceiptColumns"/> where r.receipt_id = #{receiptId}
|
||||
</select>
|
||||
|
||||
<select id="selectArReceiptByIdForUpdate" parameterType="long" resultMap="ArReceiptResult">
|
||||
<include refid="selectReceiptLockColumns"/> where receipt_id = #{receiptId} for update
|
||||
</select>
|
||||
|
||||
<select id="selectArReceiptByNo" parameterType="string" resultMap="ArReceiptResult">
|
||||
<include refid="selectReceiptColumns"/> where r.receipt_no = #{receiptNo}
|
||||
</select>
|
||||
|
||||
<select id="selectArReceiptByReference" resultMap="ArReceiptResult">
|
||||
<include refid="selectReceiptColumns"/>
|
||||
where r.payment_method = #{paymentMethod} and r.bank_reference = #{bankReference}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertArReceipt" parameterType="ArReceipt" useGeneratedKeys="true" keyProperty="receiptId">
|
||||
insert into ar_receipt (
|
||||
receipt_no, customer_id, receipt_date, currency, receipt_amount, unallocated_amount,
|
||||
payment_method, bank_reference, status, remark, create_by, create_time, update_by, update_time
|
||||
) values (
|
||||
#{receiptNo}, #{customerId}, #{receiptDate}, #{currency}, #{receiptAmount}, #{unallocatedAmount},
|
||||
#{paymentMethod}, #{bankReference}, #{status}, #{remark}, #{createBy}, sysdate(), #{updateBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateBalanceAndStatus">
|
||||
update ar_receipt
|
||||
set unallocated_amount = #{unallocatedAmount}, status = #{status},
|
||||
update_by = #{operator}, update_time = sysdate()
|
||||
where receipt_id = #{receiptId}
|
||||
</update>
|
||||
|
||||
<update id="updateCancelled">
|
||||
update ar_receipt set status = 'CANCELLED', remark = #{remark},
|
||||
update_by = #{operator}, update_time = sysdate()
|
||||
where receipt_id = #{receiptId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ar.mapper.ArReceiptWriteoffMapper">
|
||||
<resultMap id="ArReceiptWriteoffResult" type="ArReceiptWriteoff">
|
||||
<id property="writeoffId" column="writeoff_id"/>
|
||||
<result property="receiptId" column="receipt_id"/>
|
||||
<result property="arBillId" column="ar_bill_id"/>
|
||||
<result property="billNo" column="bill_no"/>
|
||||
<result property="receiptNo" column="receipt_no"/>
|
||||
<result property="writeoffNo" column="writeoff_no"/>
|
||||
<result property="writeoffAmount" column="writeoff_amount"/>
|
||||
<result property="currency" column="currency"/>
|
||||
<result property="writeoffDate" column="writeoff_date"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="cancelBy" column="cancel_by"/>
|
||||
<result property="cancelTime" column="cancel_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWriteoffColumns">
|
||||
select w.writeoff_id, w.receipt_id, w.ar_bill_id, b.bill_no, r.receipt_no,
|
||||
w.writeoff_no, w.writeoff_amount, w.currency, w.writeoff_date, w.status,
|
||||
w.remark, w.create_by, w.create_time, w.cancel_by, w.cancel_time
|
||||
from ar_receipt_writeoff w
|
||||
left join ar_bill b on b.ar_bill_id = w.ar_bill_id
|
||||
left join ar_receipt r on r.receipt_id = w.receipt_id
|
||||
</sql>
|
||||
|
||||
<!-- 加锁更新只读取核销关系主表,展示字段不参与锁定。 -->
|
||||
<sql id="selectWriteoffLockColumns">
|
||||
select writeoff_id, receipt_id, ar_bill_id, writeoff_no, writeoff_amount, currency,
|
||||
writeoff_date, status, remark, create_by, create_time, cancel_by, cancel_time
|
||||
from ar_receipt_writeoff
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="long" resultMap="ArReceiptWriteoffResult">
|
||||
<include refid="selectWriteoffColumns"/> where w.ar_bill_id = #{arBillId} order by w.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectByReceiptId" parameterType="long" resultMap="ArReceiptWriteoffResult">
|
||||
<include refid="selectWriteoffColumns"/> where w.receipt_id = #{receiptId} order by w.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="long" resultMap="ArReceiptWriteoffResult">
|
||||
<include refid="selectWriteoffColumns"/> where w.writeoff_id = #{writeoffId}
|
||||
</select>
|
||||
|
||||
<select id="selectByIdForUpdate" parameterType="long" resultMap="ArReceiptWriteoffResult">
|
||||
<include refid="selectWriteoffLockColumns"/> where writeoff_id = #{writeoffId} for update
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ArReceiptWriteoff" useGeneratedKeys="true" keyProperty="writeoffId">
|
||||
insert into ar_receipt_writeoff (
|
||||
receipt_id, ar_bill_id, writeoff_no, writeoff_amount, currency, writeoff_date,
|
||||
status, remark, create_by, create_time
|
||||
) values (
|
||||
#{receiptId}, #{arBillId}, #{writeoffNo}, #{writeoffAmount}, #{currency}, #{writeoffDate},
|
||||
#{status}, #{remark}, #{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateCancelled">
|
||||
update ar_receipt_writeoff
|
||||
set status = 'CANCELLED', remark = #{remark}, cancel_by = #{cancelBy}, cancel_time = sysdate()
|
||||
where writeoff_id = #{writeoffId} and status = 'EFFECTIVE'
|
||||
</update>
|
||||
|
||||
<select id="sumEffectiveByBillId" parameterType="long" resultType="java.math.BigDecimal">
|
||||
select coalesce(sum(writeoff_amount), 0) from ar_receipt_writeoff
|
||||
where ar_bill_id = #{arBillId} and status = 'EFFECTIVE'
|
||||
</select>
|
||||
|
||||
<select id="sumEffectiveByReceiptId" parameterType="long" resultType="java.math.BigDecimal">
|
||||
select coalesce(sum(writeoff_amount), 0) from ar_receipt_writeoff
|
||||
where receipt_id = #{receiptId} and status = 'EFFECTIVE'
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user