You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package models
|
|
|
|
|
|
|
|
type ReplyItem struct {
|
|
|
|
Id string `json:"item_id"`
|
|
|
|
Content string `json:"item_content"`
|
|
|
|
GroupId string `json:"group_id"`
|
|
|
|
ItemName string `json:"item_name"`
|
|
|
|
}
|
|
|
|
type ReplyGroup struct {
|
|
|
|
Id string `json:"group_id"`
|
|
|
|
GroupName string `json:"group_name"`
|
|
|
|
UserId string `json:"user_id"`
|
|
|
|
Items []ReplyItem `json:"items"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func FindReplyByUserId(userId interface{}) ReplyGroup {
|
|
|
|
var replyGroup ReplyGroup
|
|
|
|
DB.Raw("select a.*,b.* from reply_group a left join reply_item b on a.id=b.group_id where a.user_id=? ", userId).Scan(&replyGroup)
|
|
|
|
return replyGroup
|
|
|
|
}
|
|
|
|
func CreateReplyGroup(groupName string, userId string) {
|
|
|
|
g := &ReplyGroup{
|
|
|
|
GroupName: groupName,
|
|
|
|
UserId: userId,
|
|
|
|
}
|
|
|
|
DB.Create(g)
|
|
|
|
}
|