查询服务费sql
-- 查询服务费列表 SELECT t2.*,m.payoff_status AS payoffStatus FROM( SELECT t.custId, t.custName, t.monthStr, SUM( t.issueAmt ) AS issueTotalAmt, SUM( t.serviceFee ) AS serviceTotalFee, t.feePayoffDate, t.`year`, t.`month` FROM ( SELECT k.`issuer` AS custId, c.cust_name AS custName, k.`issue_amt` AS issueAmt, k.service_fee AS serviceFee, k.fee_payoff_date AS feePayoffDate, YEAR ( k.fee_payoff_date ) AS `year`, MONTH ( k.fee_payoff_date ) AS `month`, CONCAT( YEAR ( k.fee_payoff_date ), '年', MONTH ( k.fee_payoff_date ), '月' ) AS monthStr FROM lk_issue_info k LEFT JOIN cm_customer c ON k.`issuer` = c.cust_id -- ${ew.customSqlSegment} ) t GROUP BY t.custId,t.`month`,t.custName,t.monthStr,t.feePayoffDate ORDER BY t.monthStr DESC ) t2 LEFT JOIN cm_fee_mark m ON m.cust_id = t2.custId AND m.`year` = t2.`year` AND m.`month` = t2.`month` -- 查询服务费详情 SELECT k.issue_link_no AS linkNo, k.issue_amt AS issueAmt, c.cust_id AS custId, c.cust_name AS custName, k.issue_date AS issueDate, k.payoff_date AS payoffDate, k.link_days AS linkDays, k.service_fee_rate AS serviceFeeRate, k.service_fee AS serviceFee, k.fee_payoff_date AS feePayoffDate, YEAR(k.fee_payoff_date) AS year, MONTH(k.fee_payoff_date) AS month FROM lk_issue_info k LEFT JOIN cm_customer c ON k.`issuer` = c.cust_id -- ${ew.customSqlSegment}