328 lines
13 KiB
XML
328 lines
13 KiB
XML
<?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.bonus.canteen.core.account.v3.mapper.AccDrawAuditMapper">
|
|
|
|
<!-- 分页查询提现申请-->
|
|
<select id="queryWithdrawApplyRecordPage" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyPageVO">
|
|
<include refid="query_withdraw_apply_record_sql">
|
|
</include>
|
|
</select>
|
|
|
|
<!-- 查询提现申请集合-->
|
|
<select id="queryWithdrawApplyRecordList" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyPageVO">
|
|
<include refid="query_withdraw_apply_record_sql">
|
|
</include>
|
|
</select>
|
|
|
|
<!-- 查询提现申请记录sql-->
|
|
<sql id="query_withdraw_apply_record_sql">
|
|
SELECT t1.audit_id applyId,
|
|
t1.crtime applyDateTime,
|
|
t1.apply_amount,
|
|
t1.apply_reason,
|
|
t1.flow_instance_id,
|
|
1 walletType,
|
|
ci.cust_id,
|
|
ci.cust_num,
|
|
ci.nick_name as cust_name,
|
|
ci.phonenumber as mobile,
|
|
sd.dept_name as org_full_name,
|
|
t3.psn_type_name,
|
|
t4.wallet_bal walletBal,
|
|
t4.frozen_balance walletFreezeBal,
|
|
t5.wallet_bal subsidyBal,
|
|
t5.frozen_balance subsidyFreezeBal,
|
|
t6.wallet_bal redBal
|
|
FROM acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
LEFT JOIN sys_dept sd ON ci.dept_id = sd.dept_id
|
|
LEFT JOIN cust_psn_type t3 on t3.psn_type = ci.psn_type
|
|
LEFT JOIN acc_wallet_info t4 ON t1.cust_id = t4.cust_id AND t4.wallet_id = 1
|
|
LEFT JOIN acc_wallet_info t5 ON t1.cust_id = t5.cust_id AND t5.wallet_id = 2
|
|
LEFT JOIN acc_wallet_info t6 ON t1.cust_id = t6.cust_id AND t6.wallet_id = 4
|
|
<where>
|
|
audit_status in
|
|
<foreach collection="param.approvalStatus" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
<if test="param.startDateTime != null">
|
|
and t1.crtime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.crtime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
<include refid="cust_fuzzy_query"></include>
|
|
</if>
|
|
</where>
|
|
ORDER BY t1.crtime DESC
|
|
</sql>
|
|
|
|
<!-- 分页查询审批记录-->
|
|
<select id="queryWithdrawApplyApprovalRecordPage"
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyPageVO">
|
|
<include refid="query_withdraw_approval_record_sql">
|
|
</include>
|
|
</select>
|
|
|
|
<!-- 查询审批记录-->
|
|
<select id="queryWithdrawApplyApprovalRecordList"
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyPageVO">
|
|
<include refid="query_withdraw_approval_record_sql">
|
|
</include>
|
|
</select>
|
|
|
|
<!-- 查询审批记录sql-->
|
|
<sql id="query_withdraw_approval_record_sql">
|
|
SELECT t1.uptime approvalTime,
|
|
t1.audit_status approvalStatus,
|
|
t1.crtime applyDateTime,
|
|
t1.apply_amount,
|
|
t1.actual_amount,
|
|
t1.apply_reason,
|
|
1 walletType,
|
|
ci.cust_id,
|
|
ci.cust_num,
|
|
ci.nick_name as cust_name,
|
|
ci.phonenumber as mobile,
|
|
t4.dept_name as org_full_name,
|
|
t3.psn_type_name,
|
|
t1.acc_bal_total,
|
|
t1.wallet_bal,
|
|
t1.subsidy_bal,
|
|
t1.red_bal,
|
|
t1.acc_freeze_bal_total,
|
|
t1.error_msg
|
|
FROM acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
LEFT JOIN cust_psn_type t3 on t3.psn_type = t1.psn_type
|
|
LEFT JOIN sys_dept t4 on t4.dept_id = t1.org_id
|
|
<where>
|
|
audit_status in
|
|
<foreach collection="param.approvalStatus" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
<if test="param.startDateTime != null">
|
|
and t1.uptime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.uptime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
and t1.org_id in
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
#{orgId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
<include refid="cust_fuzzy_query"></include>
|
|
</if>
|
|
</where>
|
|
ORDER BY t1.uptime DESC
|
|
</sql>
|
|
|
|
<!-- 查询审批记录汇总-->
|
|
<select id="queryWithdrawApplyApprovalRecordTotal"
|
|
resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyPageVO">
|
|
SELECT
|
|
sum(t1.apply_amount) as apply_amount,
|
|
sum(t1.actual_amount) as actual_amount
|
|
FROM acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
WHERE
|
|
audit_status in
|
|
<foreach collection="param.approvalStatus" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
<if test="param.startDateTime != null">
|
|
and t1.uptime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.uptime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
AND t1.org_id in
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
#{orgId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
<include refid="cust_fuzzy_query"></include>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 小程序分页查询取款申请记录-->
|
|
<select id="queryPageAccDrawAuditForApp" resultType="com.bonus.canteen.core.account.v3.app.vo.AppDrawAuditPageVO">
|
|
SELECT t1.audit_id,
|
|
t1.apply_amount,
|
|
t1.audit_status,
|
|
t1.apply_reason,
|
|
t1.crtime,
|
|
t1.approval_time as uptime,
|
|
t1.actual_amount,
|
|
t1.cash_amount,
|
|
t1.audit_reason as refusedReason,
|
|
t1.with_draw_result as withDrawResult
|
|
FROM acc_draw_audit AS t1
|
|
<where>
|
|
<if test="pageDTO.auditStatusList != null and pageDTO.auditStatusList.size() > 0">
|
|
and t1.audit_status in
|
|
<foreach collection="pageDTO.auditStatusList" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
<if test="pageDTO.custId != null">
|
|
and t1.cust_id = #{pageDTO.custId}
|
|
</if>
|
|
</where>
|
|
ORDER BY t1.uptime DESC
|
|
</select>
|
|
<!-- 移动端工作台:获取提现审核记录-->
|
|
<select id="queryAccWithDrawPageForAppWork" resultType="com.bonus.canteen.core.account.v3.app.vo.AppWorkWithdrawVO">
|
|
SELECT
|
|
t1.audit_id AS applyId,
|
|
t1.crtime AS applyDateTime,
|
|
t1.uptime AS approvalTime,
|
|
t1.audit_status,
|
|
t1.apply_amount,
|
|
t1.actual_amount,
|
|
ci.cust_id,
|
|
ci.cust_num,
|
|
ci.nick_name as cust_name,
|
|
ci.phonenumber as mobile,
|
|
t3.dept_name as org_full_name,
|
|
t4.wallet_bal
|
|
FROM
|
|
acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
LEFT JOIN sys_dept t3 ON t3.dept_id = ci.dept_id
|
|
LEFT JOIN acc_wallet_info t4 ON t1.cust_id = t4.cust_id AND t4.wallet_id = 1
|
|
<where>
|
|
audit_status IN
|
|
<foreach collection="param.approvalStatus" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
<if test="param.startDateTime != null">
|
|
and t1.crtime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.crtime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
<include refid="cust_fuzzy_query"></include>
|
|
</if>
|
|
</where>
|
|
ORDER BY t1.uptime DESC
|
|
|
|
</select>
|
|
<!-- 获取待审核提现申请数量 -->
|
|
<select id="monitorPendingCount" resultType="java.lang.Long">
|
|
SELECT count(*)
|
|
FROM acc_draw_audit t1
|
|
<where>
|
|
audit_status = 1
|
|
<if test="param.startDateTime != null">
|
|
and t1.crtime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.crtime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 提现审批记录-v4-->
|
|
<select id="listAccWithDrawApplyV4" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyV4PageVO">
|
|
SELECT
|
|
t1.audit_id AS applyId,
|
|
t1.crtime AS applyDateTime,
|
|
t1.approval_time,
|
|
t1.audit_status AS approvalStatus,
|
|
1 walletType,
|
|
t1.apply_amount,
|
|
t1.actual_amount,
|
|
t1.error_msg,
|
|
t1.cust_id,
|
|
ci.cust_num,
|
|
ci.nick_name as cust_name,
|
|
ci.phonenumber as mobile,
|
|
t3.psn_type_name,
|
|
t4.dept_name as org_full_name,
|
|
t1.flow_instance_id,
|
|
t1.audit_reason AS refusedReason,
|
|
t1.with_draw_result
|
|
FROM
|
|
acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
LEFT JOIN cust_psn_type t3 ON t3.psn_type = ci.psn_type
|
|
LEFT JOIN sys_dept t4 ON t4.dept_id = ci.dept_id
|
|
<include refid="withDraw_apply_where_v4"></include>
|
|
ORDER BY t1.crtime DESC
|
|
</select>
|
|
|
|
<!-- 查询审批记录汇总金额-v4-->
|
|
<select id="sumAccWithDrawApplyV4" resultType="com.bonus.canteen.core.account.v3.web.vo.AccWithDrawApplyV4PageVO">
|
|
SELECT
|
|
sum( t1.apply_amount ) AS apply_amount,
|
|
sum( t1.actual_amount ) AS actual_amount
|
|
FROM
|
|
acc_draw_audit t1
|
|
LEFT JOIN sys_user ci ON t1.cust_id = ci.cust_id
|
|
<include refid="withDraw_apply_where_v4"></include>
|
|
</select>
|
|
|
|
<!-- 提现审批记录-v4-where-->
|
|
<sql id="withDraw_apply_where_v4">
|
|
<where>
|
|
<if test="param.approvalStatus != null and param.approvalStatus.size() > 0">
|
|
and t1.audit_status in
|
|
<foreach collection="param.approvalStatus" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.withDrawResultStateList != null and param.withDrawResultStateList.size() > 0">
|
|
and t1.with_draw_result in
|
|
<foreach collection="param.withDrawResultStateList" item="status" separator="," open="(" close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.startDateTime != null">
|
|
and t1.crtime <![CDATA[ >= ]]> #{param.startDateTime}
|
|
</if>
|
|
<if test="param.endDateTime != null">
|
|
and t1.crtime <![CDATA[ <= ]]> #{param.endDateTime}
|
|
</if>
|
|
<if test="param.psnTypeList != null and param.psnTypeList.size() > 0">
|
|
and ci.psn_type in
|
|
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
|
|
#{psnType}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
|
|
and ci.dept_id in
|
|
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
|
|
#{orgId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.custId != null">
|
|
and t1.cust_id = #{param.custId}
|
|
</if>
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
<include refid="cust_fuzzy_query"></include>
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
|
|
<!-- 关联用户模糊查询-->
|
|
<sql id="cust_fuzzy_query">
|
|
and (ci.cust_num LIKE CONCAT('%', #{param.keyword},'%')
|
|
or ci.nick_name = #{param.keyword}
|
|
or ci.phonenumber = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
|
<!-- or ci.mobile_suffix = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler} -->
|
|
or ci.nick_name_like LIKE CONCAT('%',#{param.keyword},'%')
|
|
)
|
|
</sql>
|
|
|
|
|
|
</mapper>
|