Переглянути джерело

add egg point partition coefficient management

master
shenjiachi 1 тиждень тому
джерело
коміт
0e106357c3
3 змінених файлів з 70 додано та 0 видалено
  1. +11
    -0
      src/dao/egg_point_partition_coefficient_management_dao.go
  2. +49
    -0
      src/implement/egg_point_partition_coefficient_management_implement.go
  3. +10
    -0
      src/model/egg_point_partition_coefficient_management.go

+ 11
- 0
src/dao/egg_point_partition_coefficient_management_dao.go Переглянути файл

@@ -0,0 +1,11 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggPointPartitionCoefficientManagementDao interface {
//TODO:: You can add specific method definitions here
EggPointPartitionCoefficientManagementGetAll() (*[]model.EggPointPartitionCoefficientManagement, error)
EggPointPartitionCoefficientManagementBatchInsert(m []model.EggPointPartitionCoefficientManagement) (int64, error)
EggPointPartitionCoefficientManagementDel(id string) (int64, error)
EggPointPartitionCoefficientManagementUpdate(id string, m *model.EggPointPartitionCoefficientManagement, columns ...string) (int64, error)
}

+ 49
- 0
src/implement/egg_point_partition_coefficient_management_implement.go Переглянути файл

@@ -0,0 +1,49 @@
package implement

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"xorm.io/xorm"
)

func NewEggPointPartitionCoefficientManagementDb(engine *xorm.Engine) dao.EggPointPartitionCoefficientManagementDao {
return &EggPointPartitionCoefficientManagementDb{Db: engine}
}

type EggPointPartitionCoefficientManagementDb struct {
Db *xorm.Engine
}

func (e EggPointPartitionCoefficientManagementDb) EggPointPartitionCoefficientManagementGetAll() (*[]model.EggPointPartitionCoefficientManagement, error) {
var m []model.EggPointPartitionCoefficientManagement
err := e.Db.Asc("start_score").Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err.Error())
}
return &m, err
}

func (e EggPointPartitionCoefficientManagementDb) EggPointPartitionCoefficientManagementBatchInsert(m []model.EggPointPartitionCoefficientManagement) (int64, error) {
affect, err := e.Db.Insert(m)
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affect, nil
}

func (e EggPointPartitionCoefficientManagementDb) EggPointPartitionCoefficientManagementDel(id string) (int64, error) {
affect, err := e.Db.Where("id = ?", id).Delete(model.EggPointPartitionCoefficientManagement{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affect, nil
}

func (e EggPointPartitionCoefficientManagementDb) EggPointPartitionCoefficientManagementUpdate(id string, m *model.EggPointPartitionCoefficientManagement, columns ...string) (int64, error) {
affected, err := e.Db.Where("id =?", id).Cols(columns...).Update(m)
if err != nil {
return 0, err
}
return affected, nil
}

+ 10
- 0
src/model/egg_point_partition_coefficient_management.go Переглянути файл

@@ -0,0 +1,10 @@
package model

type EggPointPartitionCoefficientManagement struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
StartScore string `json:"start_score" xorm:"not null comment('起始分值') DECIMAL(10,2)"`
EndScore string `json:"end_score" xorm:"not null comment('截止分值') DECIMAL(10,2)"`
Coefficient string `json:"coefficient" xorm:"not null comment('系数') DECIMAL(10,2)"`
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"`
}

Завантаження…
Відмінити
Зберегти