Browse Source

update

master
dengbiao 7 months ago
parent
commit
2836b4282e
6 changed files with 91 additions and 1 deletions
  1. +1
    -1
      README.md
  2. +7
    -0
      src/dao/happy_orchard_basic_setting_dao.go
  3. +8
    -0
      src/dao/happy_orchard_seed_record_dao.go
  4. +28
    -0
      src/implement/happy_orchard_basic_setting_db.go
  5. +36
    -0
      src/implement/happy_orchard_seed_record_db.go
  6. +11
    -0
      src/models/happy_orchard_seed_record.go

+ 1
- 1
README.md View File

@@ -42,4 +42,4 @@
```bash
.\cmd_db.bat hello_world ---> 自动生成模型类
.\cmd_dao.bat hello_world ---> 自动生成接口类
cmd_implement.bat hello_world ---> 自动生成实现类
.\cmd_implement.bat hello_world ---> 自动生成实现类

+ 7
- 0
src/dao/happy_orchard_basic_setting_dao.go View File

@@ -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)
}

+ 8
- 0
src/dao/happy_orchard_seed_record_dao.go View File

@@ -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)
}

+ 28
- 0
src/implement/happy_orchard_basic_setting_db.go View File

@@ -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}
}

+ 36
- 0
src/implement/happy_orchard_seed_record_db.go View File

@@ -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}
}

+ 11
- 0
src/models/happy_orchard_seed_record.go View File

@@ -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"`
}

Loading…
Cancel
Save