From 7fe5f4073a84106fdf8cf8e7a9811329c42bbd6c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 21 May 2024 15:16:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/happy_orchard_seed_dao.go | 1 + ..._dao.go => happy_orchard_user_seed_record_dao.go} | 1 + src/implement/happy_orchard_seed_db.go | 9 ++++++++- src/implement/happy_orchard_user_seed_record_db.go | 7 +++++++ src/models/happy_orchard_seed.go | 12 ++++++------ 5 files changed, 23 insertions(+), 7 deletions(-) rename src/dao/{happy_orchard_seed_record_dao.go => happy_orchard_user_seed_record_dao.go} (83%) diff --git a/src/dao/happy_orchard_seed_dao.go b/src/dao/happy_orchard_seed_dao.go index 024ed61..31a07dc 100644 --- a/src/dao/happy_orchard_seed_dao.go +++ b/src/dao/happy_orchard_seed_dao.go @@ -5,4 +5,5 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" type HappyOrchardSeedDao interface { GetHappyOrchardSeed(id int) (m *models.HappyOrchardSeed, err error) FindHappyOrchardSeedAll(start, limit int) (mm *[]models.HappyOrchardSeed, err error) + FindHappyOrchardSeedWithIds(ids []int) (mm *[]models.HappyOrchardSeed, err error) } diff --git a/src/dao/happy_orchard_seed_record_dao.go b/src/dao/happy_orchard_user_seed_record_dao.go similarity index 83% rename from src/dao/happy_orchard_seed_record_dao.go rename to src/dao/happy_orchard_user_seed_record_dao.go index 8e7a7cb..3eff50f 100644 --- a/src/dao/happy_orchard_seed_record_dao.go +++ b/src/dao/happy_orchard_user_seed_record_dao.go @@ -9,4 +9,5 @@ type HappyOrchardUserSeedRecordDao interface { FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error) GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error) + FindHappyOrchardUserSeedRecordAll(uid, start, limit int) (mm *[]models.HappyOrchardUserSeedRecord, err error) } diff --git a/src/implement/happy_orchard_seed_db.go b/src/implement/happy_orchard_seed_db.go index 2a9870f..5c08362 100644 --- a/src/implement/happy_orchard_seed_db.go +++ b/src/implement/happy_orchard_seed_db.go @@ -28,7 +28,14 @@ func (h HappyOrchardSeedDb) GetHappyOrchardSeed(id int) (m *models.HappyOrchardS } func (h HappyOrchardSeedDb) FindHappyOrchardSeedAll(start, limit int) (mm *[]models.HappyOrchardSeed, err error) { var m []models.HappyOrchardSeed - if err := h.Db.OrderBy("sort desc,id desc").Limit(limit, start).Find(&m); err != nil { + if err := h.Db.Where("is_use=?", 1).OrderBy("sort desc,id desc").Limit(limit, start).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} +func (h HappyOrchardSeedDb) FindHappyOrchardSeedWithIds(ids []int) (mm *[]models.HappyOrchardSeed, err error) { + var m []models.HappyOrchardSeed + if err := h.Db.In("id", ids).Find(&m); err != nil { return nil, zhios_order_relate_logx.Error(err) } return &m, nil diff --git a/src/implement/happy_orchard_user_seed_record_db.go b/src/implement/happy_orchard_user_seed_record_db.go index dbbd540..a91406e 100644 --- a/src/implement/happy_orchard_user_seed_record_db.go +++ b/src/implement/happy_orchard_user_seed_record_db.go @@ -58,3 +58,10 @@ func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStat } return m, nil } +func (h happyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordAll(uid, start, limit int) (mm *[]models.HappyOrchardUserSeedRecord, err error) { + var m []models.HappyOrchardUserSeedRecord + if err := h.Db.Where("uid=?", uid).OrderBy("id desc").Limit(limit, start).Find(&m); err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + return &m, nil +} diff --git a/src/models/happy_orchard_seed.go b/src/models/happy_orchard_seed.go index a065a3f..8420684 100644 --- a/src/models/happy_orchard_seed.go +++ b/src/models/happy_orchard_seed.go @@ -7,12 +7,12 @@ type HappyOrchardSeed struct { SeedImgUrl string `json:"seed_img_url" xorm:"not null default '' comment('种子图片地址') VARCHAR(255)"` SeedMatureImgUrl string `json:"seed_mature_img_url" xorm:"not null default '' comment('种子成熟后图片地址') VARCHAR(255)"` Sort int `json:"sort" xorm:"not null default 0 comment('排序') INT(11)"` - NeedWatersNumForStage0 int `json:"need_waters_num_for_stage_0" xorm:"not null default 0 comment('阶段1所需水滴数') INT(11)"` - NeedWatersNumForStage1 int `json:"need_waters_num_for_stage_1" xorm:"not null default 0 comment('阶段2所需水滴数') INT(11)"` - NeedWatersNumForStage2 int `json:"need_waters_num_for_stage_2" xorm:"not null default 0 comment('阶段3所需水滴数') INT(11)"` - NeedWatersNumForStage3 int `json:"need_waters_num_for_stage_3" xorm:"not null default 0 comment('阶段4所需水滴数') INT(11)"` - NeedWatersNumForStage4 int `json:"need_waters_num_for_stage_4" xorm:"not null default 0 comment('阶段5所需水滴数') INT(11)"` - NeedWatersNumForStage5 int `json:"need_waters_num_for_stage_5" xorm:"not null default 0 comment('阶段6所需水滴数') INT(11)"` + NeedWatersNumForStage0 int `json:"need_waters_num_for_stage_0" xorm:"need_waters_num_for_stage_0 not null default 0 comment('阶段1所需水滴数') INT(11)"` + NeedWatersNumForStage1 int `json:"need_waters_num_for_stage_1" xorm:"need_waters_num_for_stage_1 not null default 0 comment('阶段2所需水滴数') INT(11)"` + NeedWatersNumForStage2 int `json:"need_waters_num_for_stage_2" xorm:"need_waters_num_for_stage_2 not null default 0 comment('阶段3所需水滴数') INT(11)"` + NeedWatersNumForStage3 int `json:"need_waters_num_for_stage_3" xorm:"need_waters_num_for_stage_3 not null default 0 comment('阶段4所需水滴数') INT(11)"` + NeedWatersNumForStage4 int `json:"need_waters_num_for_stage_4" xorm:"need_waters_num_for_stage_4 not null default 0 comment('阶段5所需水滴数') INT(11)"` + NeedWatersNumForStage5 int `json:"need_waters_num_for_stage_5" xorm:"need_waters_num_for_stage_5 not null default 0 comment('阶段6所需水滴数') INT(11)"` IsUse int32 `json:"is_use" xorm:"not null default 1 comment('是否可用(1:可用 2:不可用)') 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"`