额度审批

This commit is contained in:
luojiaquan
2026-09-17 09:00:26 +08:00
parent 6487146117
commit 324da1baa1
14 changed files with 974 additions and 439 deletions
@@ -0,0 +1,129 @@
<?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.customer.customermoney.mapper.CustomerCreditApplyMapper">
<resultMap type="com.ruoyi.customer.customermoney.domain.CustomerCreditApply" id="CustomerCreditApplyResult">
<id property="applyId" column="apply_id" />
<result property="applyNo" column="apply_no" />
<result property="customerId" column="customer_id" />
<result property="accountId" column="account_id" />
<result property="creditType" column="credit_type" />
<result property="adjustMode" column="adjust_mode" />
<result property="changeAmount" column="change_amount" />
<result property="effectiveDate" column="effective_date" />
<result property="expireDate" column="expire_date" />
<result property="reason" column="reason" />
<result property="status" column="status" />
<result property="applyBy" column="apply_by" />
<result property="applyUserId" column="apply_user_id" />
<result property="applyTime" column="apply_time" />
<result property="approveBy" column="approve_by" />
<result property="approveUserId" column="approve_user_id"/>
<result property="approveTime" column="approve_time" />
<result property="approveRemark" column="approve_remark" />
<result property="flowId" column="flow_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
</resultMap>
<sql id="applyVo">
select a.apply_id, a.apply_no, a.customer_id, a.account_id, a.credit_type, a.adjust_mode,
a.change_amount, a.effective_date, a.expire_date, a.reason, a.status,
a.apply_by, a.apply_user_id, a.apply_time,
a.approve_by, a.approve_user_id, a.approve_time, a.approve_remark, a.flow_id,
a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.del_flag,
c.customer_code, c.customer_name
from customer_credit_apply a
left join bms_customer c on c.customer_id = a.customer_id
</sql>
<select id="selectApplyList"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply"
resultMap="CustomerCreditApplyResult">
<include refid="applyVo"/>
<where>
a.del_flag = '0'
<if test="customerId != null"> and a.customer_id = #{customerId}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="creditType != null and creditType != ''"> and a.credit_type = #{creditType}</if>
<if test="applyNo != null and applyNo != ''"> and a.apply_no like concat('%', #{applyNo}, '%')</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 申请时间范围 -->
and date_format(a.apply_time, '%y%m%d') &gt;= date_format(#{params.beginTime}, '%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
and date_format(a.apply_time, '%y%m%d') &lt;= date_format(#{params.endTime}, '%y%m%d')
</if>
</where>
order by a.apply_id desc
</select>
<select id="selectApplyById" resultMap="CustomerCreditApplyResult">
<include refid="applyVo"/>
where a.apply_id = #{applyId} and a.del_flag = '0'
</select>
<select id="selectApplyByIdForUpdate" resultMap="CustomerCreditApplyResult">
select * from customer_credit_apply where apply_id = #{applyId} and del_flag = '0' for update
</select>
<insert id="insertApply"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply"
useGeneratedKeys="true" keyProperty="applyId">
insert into customer_credit_apply (
apply_no, customer_id, credit_type, adjust_mode, change_amount,
effective_date, expire_date, reason, status,
apply_by, apply_user_id, apply_time,
create_by, create_time, remark
) values (
#{applyNo}, #{customerId}, #{creditType}, #{adjustMode}, #{changeAmount},
#{effectiveDate}, #{expireDate}, #{reason}, #{status},
#{applyBy}, #{applyUserId}, #{applyTime},
#{createBy}, sysdate(), #{remark}
)
</insert>
<update id="updateApproved"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply">
update customer_credit_apply
set status = 'APPROVED',
account_id = #{accountId},
flow_id = #{flowId},
approve_by = #{approveBy},
approve_user_id = #{approveUserId},
approve_time = sysdate(),
approve_remark = #{approveRemark},
update_by = #{approveBy},
update_time = sysdate()
where apply_id = #{applyId} and status = 'PENDING' and del_flag = '0'
</update>
<update id="updateRejected"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply">
update customer_credit_apply
set status = 'REJECTED',
approve_by = #{approveBy},
approve_user_id = #{approveUserId},
approve_time = sysdate(),
approve_remark = #{approveRemark},
update_by = #{approveBy},
update_time = sysdate()
where apply_id = #{applyId} and status = 'PENDING' and del_flag = '0'
</update>
<update id="updateCancelled">
update customer_credit_apply
set status = 'CANCELLED',
update_by = #{updateBy},
update_time = sysdate()
where apply_id = #{applyId} and status = 'PENDING' and del_flag = '0'
</update>
</mapper>