From 6540a7a5292077ca70617e874e0afa56880b30c3 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 28 May 2024 12:45:06 +0800 Subject: [PATCH] update --- src/dao/micro_applications_list_dao.go | 7 ++++++ src/implement/micro_applications_list_db.go | 28 +++++++++++++++++++++ src/models/micro_applications_list.go | 18 +++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/dao/micro_applications_list_dao.go create mode 100644 src/implement/micro_applications_list_db.go create mode 100644 src/models/micro_applications_list.go diff --git a/src/dao/micro_applications_list_dao.go b/src/dao/micro_applications_list_dao.go new file mode 100644 index 0000000..a61dfd6 --- /dev/null +++ b/src/dao/micro_applications_list_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" + +type MicroApplicationsListDao interface { + GetMicroApplicationsLis(appKey string) (m *models.MicroApplicationsList, err error) +} diff --git a/src/implement/micro_applications_list_db.go b/src/implement/micro_applications_list_db.go new file mode 100644 index 0000000..138c5da --- /dev/null +++ b/src/implement/micro_applications_list_db.go @@ -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" +) + +func NewMicroApplicationsListDb(engine *xorm.Engine) dao.MicroApplicationsListDao { + return &MicroApplicationsListDb{Db: engine} +} + +type MicroApplicationsListDb struct { + Db *xorm.Engine +} + +func (m2 MicroApplicationsListDb) GetMicroApplicationsLis(appKey string) (m *models.MicroApplicationsList, err error) { + m = new(models.MicroApplicationsList) + has, err := m2.Db.Where("app_key =?", appKey).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/models/micro_applications_list.go b/src/models/micro_applications_list.go new file mode 100644 index 0000000..fbe5890 --- /dev/null +++ b/src/models/micro_applications_list.go @@ -0,0 +1,18 @@ +package models + +import ( + "time" +) + +type MicroApplicationsList struct { + Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"` + AppKey string `json:"app_key" xorm:"not null default '' comment('应用标识') CHAR(100)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + Icon string `json:"icon" xorm:"not null default '' comment('应用icon') VARCHAR(255)"` + Desc string `json:"desc" xorm:"not null default '' comment('应用描述') VARCHAR(255)"` + NowVersion string `json:"now_version" xorm:"not null default '' comment('当前版本号') CHAR(50)"` + Md5 string `json:"md5" xorm:"not null default '' comment('MD5校验值') VARCHAR(255)"` + AddressUrl string `json:"address_url" xorm:"not null default '' comment('文件地址url') VARCHAR(255)"` + CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` + UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` +}