@@ -42,4 +42,4 @@ | |||||
```bash | ```bash | ||||
.\cmd_db.bat hello_world ---> 自动生成模型类 | .\cmd_db.bat hello_world ---> 自动生成模型类 | ||||
.\cmd_dao.bat hello_world ---> 自动生成接口类 | .\cmd_dao.bat hello_world ---> 自动生成接口类 | ||||
cmd_implement.bat hello_world ---> 自动生成实现类 | |||||
.\cmd_implement.bat hello_world ---> 自动生成实现类 |
@@ -0,0 +1,7 @@ | |||||
package dao | |||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
type HappyOrchardBasicSettingDao interface { | |||||
GetHappyOrchardBasicSetting() (m *models.HappyOrchardBasicSetting, err error) | |||||
} |
@@ -0,0 +1,8 @@ | |||||
package dao | |||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
type HappyOrchardUserSeedRecordDao interface { | |||||
GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) | |||||
FindHappyOrchardUserSeedRecordsByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) | |||||
} |
@@ -0,0 +1,28 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" | |||||
"xorm.io/xorm" | |||||
) | |||||
type HappyOrchardBasicSettingDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (h HappyOrchardBasicSettingDb) GetHappyOrchardBasicSetting() (m *models.HappyOrchardBasicSetting, err error) { | |||||
m = new(models.HappyOrchardBasicSetting) | |||||
has, err := h.Db.Where("id > 0").Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | |||||
func NewHappyOrchardBasicSettingDb(engine *xorm.Engine) dao.HappyOrchardBasicSettingDao { | |||||
return &HappyOrchardBasicSettingDb{Db: engine} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" | |||||
"xorm.io/xorm" | |||||
) | |||||
type HappyOrchardUserSeedRecordDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (h HappyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) { | |||||
m = new(models.HappyOrchardUserSeedRecord) | |||||
has, err := h.Db.Where("id =?", id).Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | |||||
func (h HappyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordsByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { | |||||
var m []models.HappyOrchardUserSeedRecord | |||||
if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return &m, nil | |||||
} | |||||
func NewHappyOrchardUserSeedRecordDb(engine *xorm.Engine) dao.HappyOrchardUserSeedRecordDao { | |||||
return &HappyOrchardUserSeedRecordDb{Db: engine} | |||||
} |
@@ -0,0 +1,11 @@ | |||||
package models | |||||
type HappyOrchardUserSeedRecord struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uid int `json:"uid" xorm:"INT(11)"` | |||||
SeedId int `json:"seed_id" xorm:"not null default 0 INT(11)"` | |||||
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('当前获得水滴数') INT(11)"` | |||||
State int `json:"state" xorm:"not null default 1 comment('状态(1:种植中 2:待领取 3:已领取)') INT(11)"` | |||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` | |||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` | |||||
} |