/*
 * @description: 安全巡检数据库操作相关
 * @Author: LanJianRong
 * @Date: 2020-11-20
 * @FilePath: \construction_management\dao\version_dao.go
 */

package dao

import (
	"github.com/go-xorm/xorm"
	"go.mod/models"
)

// 数据库操作引擎
type VersionDao struct {
	engine *xorm.Engine
}

// 获得一个DAO对象
func NewVersionDao(engine *xorm.Engine) *VersionDao {
	return &VersionDao{
		engine: engine,
	}
}

//获得标段下的账号数据
func (d *VersionDao) Get() *models.CmVersion {
	data := &models.CmVersion{}
	ok, err := d.engine.
		Desc("id").
		Get(data)
	if ok && err == nil {
		return data
	} else {
		data.Id = 0
		return data
	}
}
