|
|
@@ -10,7 +10,7 @@ import (
|
|
|
)
|
|
|
|
|
|
type CommunityList struct {
|
|
|
- Id int `orm:"column(community_id);auto" description:"社区图谱"`
|
|
|
+ CommunityId int `orm:"column(community_id);auto" description:"社区图谱"`
|
|
|
ParentId string `orm:"column(parent_id);size(225);null" description:"上级id"`
|
|
|
UserId string `orm:"column(user_id);size(225);null"`
|
|
|
Username string `orm:"column(username);size(255);null"`
|
|
|
@@ -44,7 +44,7 @@ func AddCommunityList(m *CommunityList) (id int64, err error) {
|
|
|
// Id doesn't exist
|
|
|
func GetCommunityListById(id int) (v *CommunityList, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- v = &CommunityList{Id: id}
|
|
|
+ v = &CommunityList{CommunityId: id}
|
|
|
if err = o.Read(v); err == nil {
|
|
|
return v, nil
|
|
|
}
|
|
|
@@ -133,7 +133,7 @@ func GetAllCommunityList(query map[string]string, fields []string, sortby []stri
|
|
|
// the record to be updated doesn't exist
|
|
|
func UpdateCommunityListById(m *CommunityList) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- v := CommunityList{Id: m.Id}
|
|
|
+ v := CommunityList{CommunityId: m.CommunityId}
|
|
|
// ascertain id exists in the database
|
|
|
if err = o.Read(&v); err == nil {
|
|
|
var num int64
|
|
|
@@ -148,11 +148,11 @@ func UpdateCommunityListById(m *CommunityList) (err error) {
|
|
|
// the record to be deleted doesn't exist
|
|
|
func DeleteCommunityList(id int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- v := CommunityList{Id: id}
|
|
|
+ v := CommunityList{CommunityId: id}
|
|
|
// ascertain id exists in the database
|
|
|
if err = o.Read(&v); err == nil {
|
|
|
var num int64
|
|
|
- if num, err = o.Delete(&CommunityList{Id: id}); err == nil {
|
|
|
+ if num, err = o.Delete(&CommunityList{CommunityId: id}); err == nil {
|
|
|
fmt.Println("Number of records deleted in database:", num)
|
|
|
}
|
|
|
}
|