Explorar el Código

查询重复问题

deng.yinping hace 2 años
padre
commit
12019bea8e
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      models/qhj.go

+ 2 - 1
models/qhj.go

@@ -948,7 +948,8 @@ func (r *QhjBankAccountSign) buildSql() string {
 		"    on t.accountcode = to_char(ta.accountid)" +
 		" LEFT JOIN BANK_BANKINFO b on t.bankid=b.bankid" +
 		" LEFT JOIN bank_cusbankinfo ci ON ci.cusbankid = t.CUSBANKID" +
-		" LEFT JOIN bank_accountsignlog slog ON slog.exchticket = t.applyexchticket" +
+		" LEFT JOIN (SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.exchticket ORDER BY b.createtime DESC) AS row_num " +
+		" FROM BANK_ACCOUNTSIGNLOG b) slog ON slog.exchticket = t.applyexchticket AND slog.row_num = 1" +
 		" WHERE 1 = 1" +
 		"   and ta.taaccounttype = 2"
 	sqlId.And("ta.RELATEDUSERID", r.RELATEDUSERID)