| | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TFlowManagement"> |
| | | <id column="id" property="id" /> |
| | | <result column="sysSerialNumber" property="sysSerialNumber" /> |
| | | <result column="bankSerialNumber" property="bankSerialNumber" /> |
| | | <result column="flowMoney" property="flowMoney" /> |
| | | <result column="deductionMoney" property="deductionMoney" /> |
| | | <result column="remainingMoney" property="remainingMoney" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="sys_serial_number" property="sysSerialNumber" /> |
| | | <result column="bank_serial_number" property="bankSerialNumber" /> |
| | | <result column="flow_money" property="flowMoney" /> |
| | | <result column="deduction_money" property="deductionMoney" /> |
| | | <result column="remaining_money" property="remainingMoney" /> |
| | | <result column="pay_time" property="payTime" /> |
| | | <result column="payer" property="payer" /> |
| | | <result column="flowStatus" property="flowStatus" /> |
| | | <result column="flowType" property="flowType" /> |
| | | <result column="payType" property="payType" /> |
| | | <result column="paymentBillId" property="paymentBillId" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="flow_status" property="flowStatus" /> |
| | | <result column="flow_type" property="flowType" /> |
| | | <result column="pay_type" property="payType" /> |
| | | <result column="payment_bill_id" property="paymentBillId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="disabled" property="disabled" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, sysSerialNumber, bankSerialNumber, flowMoney, deductionMoney, remainingMoney, payTime, payer, flowStatus, flowType, payType, paymentBillId, createTime, updateTime, createBy, updateBy, isDelete |
| | | id, sys_serial_number, bank_serial_number, flow_money, deduction_money, remaining_money, pay_time, payer, flow_status, flow_type, pay_type, payment_bill_id, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | |
| | | |
| | | <!-- 定义结果映射 --> |
| | | <resultMap id="PaymentStatsResultMap" type="com.ruoyi.system.vo.TFlowManagementStatisticsVo"> |
| | | <result property="totalAmount" column="total_amount" /> |
| | | <result property="wechatAmount" column="wechat_amount" /> |
| | | <result property="alipayAmount" column="alipay_amount" /> |
| | | <result property="offlineAmount" column="offline_amount" /> |
| | | </resultMap> |
| | | |
| | | <!-- 统计总额和微信支付金额 --> |
| | | <select id="getPaymentStats" resultMap="PaymentStatsResultMap"> |
| | | SELECT ifnull(SUM(pre_outstand-remaining_money),0) AS total_amount, |
| | | ifnull(SUM(CASE WHEN pay_type = 1 THEN (pre_outstand-remaining_money) ELSE 0 END ) ,0)AS wechat_amount, |
| | | ifnull(SUM(CASE WHEN pay_type = 2 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS alipay_amount, |
| | | ifnull(SUM(CASE WHEN pay_type = 3 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS offline_amount |
| | | FROM |
| | | t_flow_management |
| | | <where> |
| | | <if test="req.sysSerialNumber != null and req.sysSerialNumber != ''"> |
| | | and sys_serial_number = #{req.sysSerialNumber} |
| | | </if> |
| | | <if test="req.bankSerialNumber != null and req.bankSerialNumber != ''"> |
| | | and bank_serial_number = #{req.bankSerialNumber} |
| | | </if> |
| | | <if test="req.payer != null and req.payer != ''"> |
| | | and payer like concat('%', #{req.payer}, '%') |
| | | </if> |
| | | <if test="req.payType != null and req.payType != ''"> |
| | | and pay_type = #{req.payType} |
| | | </if> |
| | | <if test="req.payStartTime != null and req.payStartTime != ''"> |
| | | and pay_time >= #{req.payStartTime} |
| | | </if> |
| | | <if test="req.payEndTime != null and req.payEndTime != ''"> |
| | | and pay_time <= #{req.payEndTime} |
| | | </if> |
| | | <if test='businessDeptId != null and businessDeptId != "" and businessDeptId != "0"'> |
| | | and business_dept_id = #{businessDeptId} |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |