- TransferLegacyWeixins中采用增量式
This commit is contained in:
@@ -26,9 +26,13 @@ func TransferLegacyWeixins() (err error) {
|
||||
// TRUNCATE TABLE casbin_rule;
|
||||
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM weixins
|
||||
ORDER BY parentid`
|
||||
SELECT t1.*
|
||||
FROM weixins t1
|
||||
LEFT JOIN user t2 ON t2.mobile = t1.tel
|
||||
LEFT JOIN auth_bind t3 ON t3.auth_id = t1.openid AND t3.type = 'weixinsns'
|
||||
LEFT JOIN auth_bind t4 ON t4.auth_id = t1.openid_mini AND t4.type = 'weixinmini'
|
||||
WHERE t2.id IS NULL OR (t1.openid <> '' AND t3.id IS NULL) OR (t1.openid_mini <> '' AND t4.id IS NULL)
|
||||
ORDER BY t1.parentid;`
|
||||
var weixinList []*legacymodel.WeiXins
|
||||
db := dao.GetDB()
|
||||
err = dao.GetRows(db, &weixinList, sql)
|
||||
|
||||
Reference in New Issue
Block a user