optimise unsettle sql

master
Yixian 3 years ago
parent 1869a872e7
commit e67ba7c00d

@ -1690,6 +1690,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
}
transactionMapper.deleteSettlementTransaction(clearingId);
// transactionMapper.removePreSettleRemark(clearingId);
transactionMapper.removeSettleRemark(clearingId);
preSettleTaskMapper.resetClearStatus(clearingId);
clearingDetailAnalysisMapper.clearAnalysis(clearingId);

@ -133,6 +133,8 @@ public interface TransactionMapper {
void removeSettleRemark(@Param("clearing_id") int clearingId);
// void removePreSettleRemark(@Param("clearing_id") int clearingId);
List<JSONObject> getHfClearAmount(JSONObject params);
List<JSONObject> analysisForATOReport(@Param("clientId") int clientId, @Param("channels") List<String> channels, @Param("from") Date startOfMon, @Param("to") Date endOfMon);
@ -165,11 +167,12 @@ public interface TransactionMapper {
/**
*
*
* @param beginTime
* @param endTime
* @return
*/
List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime);
List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
List<JSONObject> analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List<String> channels);

@ -3,13 +3,14 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.payment.TransactionMapper">
<update id="removeSettleRemark">
UPDATE pmt_transactions AS t
INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order
SET clearing_status = if(
(select count(task_id) from log_presettle_task p where p.clear_detail_id = d.clear_detail_id) >
0, 4, 0),
INNER JOIN (
select d.clear_detail_id,count(p.task_id) pre_settle_flag from log_clearing_detail d
left join log_presettle_task p on p.clear_detail_id = d.clear_detail_id
where d.clearing_id=#{clearing_id}) dd
ON dd.clear_detail_id = t.clearing_order
SET clearing_status = if(pre_settle_flag > 0, 4, 0),
clearing_order = NULL,
clearing_time = NULL
WHERE d.clearing_id = #{clearing_id}
</update>
<delete id="deleteSettlementTransaction">
DELETE t

Loading…
Cancel
Save