fix obj_msg_vault_v

This commit is contained in:
shoopea 2019-10-11 15:04:42 +08:00
parent 73cc862f8b
commit cebde84271

6
sql.go
View File

@ -583,17 +583,19 @@ func initDB() {
log.Println("initDB : code_obj_sub_type populated ...") log.Println("initDB : code_obj_sub_type populated ...")
_, err = db.Exec(`CREATE VIEW obj_msg_vault_v AS _, err = db.Exec(`CREATE VIEW obj_msg_vault_v AS
SELECT om.sender_user_id user_id SELECT obm.sender_user_id user_id
,om.chat_id ,obm.chat_id
,om.obj_sub_type_id msg_type_id ,om.obj_sub_type_id msg_type_id
,omi.item_id ,omi.item_id
,oi.obj_sub_type_id item_type_id ,oi.obj_sub_type_id item_type_id
,omi.quantity ,omi.quantity
FROM obj om FROM obj om
,obj_msg obm
,obj oi ,obj oi
,obj_msg_item omi ,obj_msg_item omi
WHERE om.obj_type_id = ` + strconv.Itoa(objTypeMessage) + ` WHERE om.obj_type_id = ` + strconv.Itoa(objTypeMessage) + `
AND om.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, ` + strconv.Itoa(objSubTypeMessageGDepositAck) + `) AND om.obj_sub_type_id in (` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, ` + strconv.Itoa(objSubTypeMessageGDepositAck) + `)
AND obm.obj_id = om.id
AND omi.obj_id = o.id AND omi.obj_id = o.id
AND oi.id = omi.item_id AND oi.id = omi.item_id
ORDER BY om.sender_user_id ASC ORDER BY om.sender_user_id ASC