Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
This commit is contained in:
commit
7db35e3e8d
171
api/projectRunConfig.go
Normal file
171
api/projectRunConfig.go
Normal file
@ -0,0 +1,171 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
jwt "github.com/appleboy/gin-jwt/v2"
|
||||
"github.com/gin-gonic/gin"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/middleware"
|
||||
"joylink.club/bj-rtsts-server/service"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
)
|
||||
|
||||
func InitProjectRunConfigRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
authed := api.Group("/v1/runconfig").Use(authMiddleware.MiddlewareFunc(), middleware.PermissMiddleware)
|
||||
authed.GET("/paging", pageQueryProjectRunConfig)
|
||||
authed.GET("/list", listQueryProjectRunConfig)
|
||||
authed.POST("", createProjectRunConfig)
|
||||
authed.GET("/:id", queryProjectRunConfig)
|
||||
authed.PUT("/:id", updateProjectRunConfig)
|
||||
authed.DELETE("/:id", deleteProjectRunConfig)
|
||||
}
|
||||
|
||||
// 分页查询项目运行环境配置信息
|
||||
//
|
||||
// @Summary 分页查询项目运行环境配置信息
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 可以通过项目名称过滤,分页查询项目运行环境配置信息
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param PageProjectRunConfigReqDto query dto.PageProjectRunConfigReqDto true "运行环境配置查询条件带分页信息"
|
||||
// @Success 200 {object} dto.PageDto
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig/paging [get]
|
||||
func pageQueryProjectRunConfig(c *gin.Context) {
|
||||
req := dto.PageProjectRunConfigReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(sys_error.New("查询失败,参数格式错误", err))
|
||||
}
|
||||
c.JSON(http.StatusOK, service.PageProjectRunConfigQuery(&req))
|
||||
}
|
||||
|
||||
// 查询项目运行环境配置信息列表
|
||||
//
|
||||
// @Summary 查询项目运行环境配置信息列表
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 无参数,查询项目运行环境配置列表
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.ProjectRunConfigDto
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig/list [get]
|
||||
func listQueryProjectRunConfig(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, service.ListProjectRunConfigQuery())
|
||||
}
|
||||
|
||||
// 创建项目运行环境配置信息
|
||||
//
|
||||
// @Summary 创建项目运行环境配置信息
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 创建项目运行环境配置数据
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param ProjectRunConfigReqDto query dto.ProjectRunConfigReqDto true "创建的项目运行环境配置信息"
|
||||
// @Success 200 {object} nil
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig [post]
|
||||
func createProjectRunConfig(c *gin.Context) {
|
||||
req := dto.ProjectRunConfigReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(sys_error.New("创建失败,参数格式错误", err))
|
||||
}
|
||||
c.JSON(http.StatusOK, service.CreateProjectRunConfig(&req))
|
||||
}
|
||||
|
||||
// 查询项目运行环境信息
|
||||
//
|
||||
// @Summary 查询项目运行环境信息
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 查询项目运行环境信息
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "项目运行环境ID"
|
||||
// @Success 200 {object} dto.ProjectRunConfigDto
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig/{id} [get]
|
||||
func queryProjectRunConfig(c *gin.Context) {
|
||||
id, exist := c.Params.Get("id")
|
||||
if !exist {
|
||||
panic(sys_error.New("查询失败,缺少主键"))
|
||||
}
|
||||
intId, _ := strconv.Atoi(id)
|
||||
c.JSON(http.StatusOK, service.QueryProjectRunConfig(int32(intId)))
|
||||
}
|
||||
|
||||
// 修改项目运行环境信息
|
||||
//
|
||||
// @Summary 修改项目运行环境信息
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 修改项目运行环境信息
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "项目运行环境信息ID"
|
||||
// @Param ProjectDto query dto.ProjectDto true "修改的项目信息"
|
||||
// @Success 200 {object} nil
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig/{id} [put]
|
||||
func updateProjectRunConfig(c *gin.Context) {
|
||||
id, exist := c.Params.Get("id")
|
||||
if !exist {
|
||||
panic(sys_error.New("更新失败,缺少主键"))
|
||||
}
|
||||
req := dto.ProjectRunConfigReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(sys_error.New("更新失败,参数格式错误", err))
|
||||
}
|
||||
intId, _ := strconv.Atoi(id)
|
||||
c.JSON(http.StatusOK, service.UpdateProjectRunConfig(int32(intId), &req))
|
||||
}
|
||||
|
||||
// 删除项目运行环境信息
|
||||
//
|
||||
// @Summary 删除项目运行环境信息
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 删除项目运行环境信息
|
||||
// @Tags 项目运行环境配置Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "项目运行环境信息ID"
|
||||
// @Success 200 {object} nil
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/runconfig/{id} [delete]
|
||||
func deleteProjectRunConfig(c *gin.Context) {
|
||||
idStr := c.Param("id")
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil {
|
||||
panic(sys_error.New("删除失败,缺少主键"))
|
||||
}
|
||||
service.DeleteProjectRunConfigById(int32(id))
|
||||
c.JSON(http.StatusOK, true)
|
||||
}
|
@ -31,14 +31,12 @@ func CreateSimulation(projectId int32, mapIds []int32) (string, error) {
|
||||
simulationId := createSimulationId(projectId)
|
||||
_, e := simulationMap.Load(simulationId)
|
||||
if !e && IsExistSimulation() {
|
||||
// panic(dto.ErrorDto{Code: dto.DataAlreadyExist, Message: "已有仿真在运行"})
|
||||
return "", sys_error.New("一套环境同时只能运行一个仿真")
|
||||
}
|
||||
if !e {
|
||||
verifySimulation, err := memory.CreateSimulation(projectId, mapIds)
|
||||
if err != nil {
|
||||
return "", err
|
||||
// panic(fmt.Sprintf("创建仿真失败:%s", err.Error()))
|
||||
}
|
||||
verifySimulation.SimulationId = simulationId
|
||||
if config.Config.Dynamics.Open {
|
||||
@ -47,7 +45,6 @@ func CreateSimulation(projectId int32, mapIds []int32) (string, error) {
|
||||
err := dynamics.Default().RequestStartSimulation(lineBaseInfo)
|
||||
if err != nil {
|
||||
return "", err
|
||||
// panic(dto.ErrorDto{Code: dto.DynamicsError, Message: err.Error()})
|
||||
}
|
||||
dynamics.Default().Start(verifySimulation)
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 60ed5685cf48665f31df84a62a1182bfcb08dbb2
|
||||
Subproject commit 6827f9671a619b95d80dac699463bbcd9ed0cb15
|
@ -25,6 +25,7 @@ var (
|
||||
Drafting *drafting
|
||||
Project *project
|
||||
ProjectPublishLink *projectPublishLink
|
||||
ProjectRunConfig *projectRunConfig
|
||||
ProjectTrainSizeLink *projectTrainSizeLink
|
||||
PublishedGi *publishedGi
|
||||
TrainModel *trainModel
|
||||
@ -43,6 +44,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
Drafting = &Q.Drafting
|
||||
Project = &Q.Project
|
||||
ProjectPublishLink = &Q.ProjectPublishLink
|
||||
ProjectRunConfig = &Q.ProjectRunConfig
|
||||
ProjectTrainSizeLink = &Q.ProjectTrainSizeLink
|
||||
PublishedGi = &Q.PublishedGi
|
||||
TrainModel = &Q.TrainModel
|
||||
@ -62,6 +64,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
Drafting: newDrafting(db, opts...),
|
||||
Project: newProject(db, opts...),
|
||||
ProjectPublishLink: newProjectPublishLink(db, opts...),
|
||||
ProjectRunConfig: newProjectRunConfig(db, opts...),
|
||||
ProjectTrainSizeLink: newProjectTrainSizeLink(db, opts...),
|
||||
PublishedGi: newPublishedGi(db, opts...),
|
||||
TrainModel: newTrainModel(db, opts...),
|
||||
@ -82,6 +85,7 @@ type Query struct {
|
||||
Drafting drafting
|
||||
Project project
|
||||
ProjectPublishLink projectPublishLink
|
||||
ProjectRunConfig projectRunConfig
|
||||
ProjectTrainSizeLink projectTrainSizeLink
|
||||
PublishedGi publishedGi
|
||||
TrainModel trainModel
|
||||
@ -103,6 +107,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||
Drafting: q.Drafting.clone(db),
|
||||
Project: q.Project.clone(db),
|
||||
ProjectPublishLink: q.ProjectPublishLink.clone(db),
|
||||
ProjectRunConfig: q.ProjectRunConfig.clone(db),
|
||||
ProjectTrainSizeLink: q.ProjectTrainSizeLink.clone(db),
|
||||
PublishedGi: q.PublishedGi.clone(db),
|
||||
TrainModel: q.TrainModel.clone(db),
|
||||
@ -131,6 +136,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
Drafting: q.Drafting.replaceDB(db),
|
||||
Project: q.Project.replaceDB(db),
|
||||
ProjectPublishLink: q.ProjectPublishLink.replaceDB(db),
|
||||
ProjectRunConfig: q.ProjectRunConfig.replaceDB(db),
|
||||
ProjectTrainSizeLink: q.ProjectTrainSizeLink.replaceDB(db),
|
||||
PublishedGi: q.PublishedGi.replaceDB(db),
|
||||
TrainModel: q.TrainModel.replaceDB(db),
|
||||
@ -149,6 +155,7 @@ type queryCtx struct {
|
||||
Drafting IDraftingDo
|
||||
Project IProjectDo
|
||||
ProjectPublishLink IProjectPublishLinkDo
|
||||
ProjectRunConfig IProjectRunConfigDo
|
||||
ProjectTrainSizeLink IProjectTrainSizeLinkDo
|
||||
PublishedGi IPublishedGiDo
|
||||
TrainModel ITrainModelDo
|
||||
@ -167,6 +174,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
Drafting: q.Drafting.WithContext(ctx),
|
||||
Project: q.Project.WithContext(ctx),
|
||||
ProjectPublishLink: q.ProjectPublishLink.WithContext(ctx),
|
||||
ProjectRunConfig: q.ProjectRunConfig.WithContext(ctx),
|
||||
ProjectTrainSizeLink: q.ProjectTrainSizeLink.WithContext(ctx),
|
||||
PublishedGi: q.PublishedGi.WithContext(ctx),
|
||||
TrainModel: q.TrainModel.WithContext(ctx),
|
||||
|
400
db/dbquery/project_run_config.gen.go
Normal file
400
db/dbquery/project_run_config.gen.go
Normal file
@ -0,0 +1,400 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package dbquery
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"joylink.club/bj-rtsts-server/db/model"
|
||||
)
|
||||
|
||||
func newProjectRunConfig(db *gorm.DB, opts ...gen.DOOption) projectRunConfig {
|
||||
_projectRunConfig := projectRunConfig{}
|
||||
|
||||
_projectRunConfig.projectRunConfigDo.UseDB(db, opts...)
|
||||
_projectRunConfig.projectRunConfigDo.UseModel(&model.ProjectRunConfig{})
|
||||
|
||||
tableName := _projectRunConfig.projectRunConfigDo.TableName()
|
||||
_projectRunConfig.ALL = field.NewAsterisk(tableName)
|
||||
_projectRunConfig.ID = field.NewInt32(tableName, "id")
|
||||
_projectRunConfig.Name = field.NewString(tableName, "name")
|
||||
_projectRunConfig.Description = field.NewString(tableName, "description")
|
||||
_projectRunConfig.ConfigContent = field.NewString(tableName, "config_content")
|
||||
_projectRunConfig.CreateTime = field.NewTime(tableName, "create_time")
|
||||
_projectRunConfig.UpdateTime = field.NewTime(tableName, "update_time")
|
||||
|
||||
_projectRunConfig.fillFieldMap()
|
||||
|
||||
return _projectRunConfig
|
||||
}
|
||||
|
||||
type projectRunConfig struct {
|
||||
projectRunConfigDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int32
|
||||
Name field.String // 测试环境名称
|
||||
Description field.String // 环境描述
|
||||
ConfigContent field.String // 环境配置信息
|
||||
CreateTime field.Time // 创建时间
|
||||
UpdateTime field.Time // 更新时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (p projectRunConfig) Table(newTableName string) *projectRunConfig {
|
||||
p.projectRunConfigDo.UseTable(newTableName)
|
||||
return p.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (p projectRunConfig) As(alias string) *projectRunConfig {
|
||||
p.projectRunConfigDo.DO = *(p.projectRunConfigDo.As(alias).(*gen.DO))
|
||||
return p.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (p *projectRunConfig) updateTableName(table string) *projectRunConfig {
|
||||
p.ALL = field.NewAsterisk(table)
|
||||
p.ID = field.NewInt32(table, "id")
|
||||
p.Name = field.NewString(table, "name")
|
||||
p.Description = field.NewString(table, "description")
|
||||
p.ConfigContent = field.NewString(table, "config_content")
|
||||
p.CreateTime = field.NewTime(table, "create_time")
|
||||
p.UpdateTime = field.NewTime(table, "update_time")
|
||||
|
||||
p.fillFieldMap()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *projectRunConfig) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := p.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (p *projectRunConfig) fillFieldMap() {
|
||||
p.fieldMap = make(map[string]field.Expr, 6)
|
||||
p.fieldMap["id"] = p.ID
|
||||
p.fieldMap["name"] = p.Name
|
||||
p.fieldMap["description"] = p.Description
|
||||
p.fieldMap["config_content"] = p.ConfigContent
|
||||
p.fieldMap["create_time"] = p.CreateTime
|
||||
p.fieldMap["update_time"] = p.UpdateTime
|
||||
}
|
||||
|
||||
func (p projectRunConfig) clone(db *gorm.DB) projectRunConfig {
|
||||
p.projectRunConfigDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return p
|
||||
}
|
||||
|
||||
func (p projectRunConfig) replaceDB(db *gorm.DB) projectRunConfig {
|
||||
p.projectRunConfigDo.ReplaceDB(db)
|
||||
return p
|
||||
}
|
||||
|
||||
type projectRunConfigDo struct{ gen.DO }
|
||||
|
||||
type IProjectRunConfigDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IProjectRunConfigDo
|
||||
WithContext(ctx context.Context) IProjectRunConfigDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IProjectRunConfigDo
|
||||
WriteDB() IProjectRunConfigDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IProjectRunConfigDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IProjectRunConfigDo
|
||||
Not(conds ...gen.Condition) IProjectRunConfigDo
|
||||
Or(conds ...gen.Condition) IProjectRunConfigDo
|
||||
Select(conds ...field.Expr) IProjectRunConfigDo
|
||||
Where(conds ...gen.Condition) IProjectRunConfigDo
|
||||
Order(conds ...field.Expr) IProjectRunConfigDo
|
||||
Distinct(cols ...field.Expr) IProjectRunConfigDo
|
||||
Omit(cols ...field.Expr) IProjectRunConfigDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo
|
||||
Group(cols ...field.Expr) IProjectRunConfigDo
|
||||
Having(conds ...gen.Condition) IProjectRunConfigDo
|
||||
Limit(limit int) IProjectRunConfigDo
|
||||
Offset(offset int) IProjectRunConfigDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectRunConfigDo
|
||||
Unscoped() IProjectRunConfigDo
|
||||
Create(values ...*model.ProjectRunConfig) error
|
||||
CreateInBatches(values []*model.ProjectRunConfig, batchSize int) error
|
||||
Save(values ...*model.ProjectRunConfig) error
|
||||
First() (*model.ProjectRunConfig, error)
|
||||
Take() (*model.ProjectRunConfig, error)
|
||||
Last() (*model.ProjectRunConfig, error)
|
||||
Find() ([]*model.ProjectRunConfig, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectRunConfig, err error)
|
||||
FindInBatches(result *[]*model.ProjectRunConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ProjectRunConfig) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IProjectRunConfigDo
|
||||
Assign(attrs ...field.AssignExpr) IProjectRunConfigDo
|
||||
Joins(fields ...field.RelationField) IProjectRunConfigDo
|
||||
Preload(fields ...field.RelationField) IProjectRunConfigDo
|
||||
FirstOrInit() (*model.ProjectRunConfig, error)
|
||||
FirstOrCreate() (*model.ProjectRunConfig, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ProjectRunConfig, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IProjectRunConfigDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Debug() IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Debug())
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) WithContext(ctx context.Context) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) ReadDB() IProjectRunConfigDo {
|
||||
return p.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) WriteDB() IProjectRunConfigDo {
|
||||
return p.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Session(config *gorm.Session) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Session(config))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Clauses(conds ...clause.Expression) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Returning(value interface{}, columns ...string) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Not(conds ...gen.Condition) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Or(conds ...gen.Condition) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Select(conds ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Where(conds ...gen.Condition) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Order(conds ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Distinct(cols ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Omit(cols ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Join(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) LeftJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) RightJoin(table schema.Tabler, on ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Group(cols ...field.Expr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Having(conds ...gen.Condition) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Limit(limit int) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Offset(offset int) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Unscoped() IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Create(values ...*model.ProjectRunConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Create(values)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) CreateInBatches(values []*model.ProjectRunConfig, batchSize int) error {
|
||||
return p.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (p projectRunConfigDo) Save(values ...*model.ProjectRunConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Save(values)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) First() (*model.ProjectRunConfig, error) {
|
||||
if result, err := p.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProjectRunConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Take() (*model.ProjectRunConfig, error) {
|
||||
if result, err := p.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProjectRunConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Last() (*model.ProjectRunConfig, error) {
|
||||
if result, err := p.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProjectRunConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Find() ([]*model.ProjectRunConfig, error) {
|
||||
result, err := p.DO.Find()
|
||||
return result.([]*model.ProjectRunConfig), err
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ProjectRunConfig, err error) {
|
||||
buf := make([]*model.ProjectRunConfig, 0, batchSize)
|
||||
err = p.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) FindInBatches(result *[]*model.ProjectRunConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return p.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Attrs(attrs ...field.AssignExpr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Assign(attrs ...field.AssignExpr) IProjectRunConfigDo {
|
||||
return p.withDO(p.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Joins(fields ...field.RelationField) IProjectRunConfigDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Joins(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Preload(fields ...field.RelationField) IProjectRunConfigDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Preload(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) FirstOrInit() (*model.ProjectRunConfig, error) {
|
||||
if result, err := p.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProjectRunConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) FirstOrCreate() (*model.ProjectRunConfig, error) {
|
||||
if result, err := p.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ProjectRunConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) FindByPage(offset int, limit int) (result []*model.ProjectRunConfig, count int64, err error) {
|
||||
result, err = p.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = p.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = p.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = p.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Scan(result interface{}) (err error) {
|
||||
return p.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (p projectRunConfigDo) Delete(models ...*model.ProjectRunConfig) (result gen.ResultInfo, err error) {
|
||||
return p.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (p *projectRunConfigDo) withDO(do gen.Dao) *projectRunConfigDo {
|
||||
p.DO = *do.(*gen.DO)
|
||||
return p
|
||||
}
|
26
db/model/project_run_config.gen.go
Normal file
26
db/model/project_run_config.gen.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameProjectRunConfig = "project_run_config"
|
||||
|
||||
// ProjectRunConfig mapped from table <project_run_config>
|
||||
type ProjectRunConfig struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Name string `gorm:"column:name;comment:测试环境名称" json:"name"` // 测试环境名称
|
||||
Description string `gorm:"column:description;comment:环境描述" json:"description"` // 环境描述
|
||||
ConfigContent string `gorm:"column:config_content;comment:环境配置信息" json:"config_content"` // 环境配置信息
|
||||
CreateTime time.Time `gorm:"column:create_time;comment:创建时间" json:"create_time"` // 创建时间
|
||||
UpdateTime time.Time `gorm:"column:update_time;comment:更新时间" json:"update_time"` // 更新时间
|
||||
}
|
||||
|
||||
// TableName ProjectRunConfig's table name
|
||||
func (*ProjectRunConfig) TableName() string {
|
||||
return TableNameProjectRunConfig
|
||||
}
|
376
docs/docs.go
376
docs/docs.go
@ -1,4 +1,5 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
// Code generated by swaggo/swag. DO NOT EDIT.
|
||||
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
@ -2735,6 +2736,356 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建项目运行环境配置数据",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "创建项目运行环境配置信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "config",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "description",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "无参数,查询项目运行环境配置列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "查询项目运行环境配置信息列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ProjectRunConfigDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/paging": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "可以通过项目名称过滤,分页查询项目运行环境配置信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "分页查询项目运行环境配置信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"example": 1,
|
||||
"description": "页码",
|
||||
"name": "current",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"example": 10,
|
||||
"description": "页面行数",
|
||||
"name": "size",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "查询项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "查询项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ProjectRunConfigDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "修改项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "修改项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境信息ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "code",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "删除项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境信息ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/:id/getMapKilometerRange": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -5156,6 +5507,29 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ProjectRunConfigDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PslOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
@ -2729,6 +2729,356 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建项目运行环境配置数据",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "创建项目运行环境配置信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "config",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "description",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "无参数,查询项目运行环境配置列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "查询项目运行环境配置信息列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ProjectRunConfigDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/paging": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "可以通过项目名称过滤,分页查询项目运行环境配置信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "分页查询项目运行环境配置信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"example": 1,
|
||||
"description": "页码",
|
||||
"name": "current",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"example": 10,
|
||||
"description": "页面行数",
|
||||
"name": "size",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/runconfig/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "查询项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "查询项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ProjectRunConfigDto"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "修改项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "修改项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境信息ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "code",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "name",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"JwtAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除项目运行环境信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"项目运行环境配置Api"
|
||||
],
|
||||
"summary": "删除项目运行环境信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "项目运行环境信息ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/simulation/:id/getMapKilometerRange": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -5150,6 +5500,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ProjectRunConfigDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PslOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
@ -215,6 +215,21 @@ definitions:
|
||||
$ref: '#/definitions/dto.TrainSizeDto'
|
||||
type: array
|
||||
type: object
|
||||
dto.ProjectRunConfigDto:
|
||||
properties:
|
||||
config:
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
updateAt:
|
||||
type: string
|
||||
type: object
|
||||
dto.PslOperationReqDto:
|
||||
properties:
|
||||
buttonCode:
|
||||
@ -2441,6 +2456,228 @@ paths:
|
||||
summary: 从发布数据拉取信息到草稿
|
||||
tags:
|
||||
- 发布的图形数据Api
|
||||
/api/v1/runconfig:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 创建项目运行环境配置数据
|
||||
parameters:
|
||||
- in: query
|
||||
name: config
|
||||
type: string
|
||||
- in: query
|
||||
name: description
|
||||
type: string
|
||||
- in: query
|
||||
name: id
|
||||
type: integer
|
||||
- in: query
|
||||
name: name
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 创建项目运行环境配置信息
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
/api/v1/runconfig/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 删除项目运行环境信息
|
||||
parameters:
|
||||
- description: 项目运行环境信息ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 删除项目运行环境信息
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 查询项目运行环境信息
|
||||
parameters:
|
||||
- description: 项目运行环境ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ProjectRunConfigDto'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 查询项目运行环境信息
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 修改项目运行环境信息
|
||||
parameters:
|
||||
- description: 项目运行环境信息ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- in: query
|
||||
name: code
|
||||
type: string
|
||||
- in: query
|
||||
name: id
|
||||
type: integer
|
||||
- in: query
|
||||
name: name
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 修改项目运行环境信息
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
/api/v1/runconfig/list:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 无参数,查询项目运行环境配置列表
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ProjectRunConfigDto'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 查询项目运行环境配置信息列表
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
/api/v1/runconfig/paging:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 可以通过项目名称过滤,分页查询项目运行环境配置信息
|
||||
parameters:
|
||||
- in: query
|
||||
name: name
|
||||
type: string
|
||||
- description: 页码
|
||||
example: 1
|
||||
in: query
|
||||
name: current
|
||||
required: true
|
||||
type: integer
|
||||
- description: 页面行数
|
||||
example: 10
|
||||
in: query
|
||||
name: size
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PageDto'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorDto'
|
||||
security:
|
||||
- JwtAuth: []
|
||||
summary: 分页查询项目运行环境配置信息
|
||||
tags:
|
||||
- 项目运行环境配置Api
|
||||
/api/v1/simulation/:id/getMapKilometerRange:
|
||||
get:
|
||||
consumes:
|
||||
|
43
dto/projectRunConfig.go
Normal file
43
dto/projectRunConfig.go
Normal file
@ -0,0 +1,43 @@
|
||||
package dto
|
||||
|
||||
import "joylink.club/bj-rtsts-server/db/model"
|
||||
|
||||
type PageProjectRunConfigReqDto struct {
|
||||
PageQueryDto
|
||||
Name string `json:"name" form:"name"`
|
||||
}
|
||||
|
||||
type ProjectRunConfigReqDto struct {
|
||||
Id int32 `json:"id" form:"id"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Description string `json:"description" form:"description"`
|
||||
ConfigContent string `json:"config" form:"config"`
|
||||
}
|
||||
|
||||
type ProjectRunConfigDto struct {
|
||||
Id int32 `json:"id" form:"id"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Description string `json:"description" form:"description"`
|
||||
ConfigContent string `json:"config" form:"config"`
|
||||
CreatedAt JsonTime `json:"createdAt" time_format:"2006-01-02 15:04:05"`
|
||||
UpdateAt JsonTime `json:"updateAt" time_format:"2006-01-02 15:04:05"`
|
||||
}
|
||||
|
||||
func ConvertToRunConfigDto(gi *model.ProjectRunConfig) *ProjectRunConfigDto {
|
||||
return &ProjectRunConfigDto{
|
||||
Id: gi.ID,
|
||||
Name: gi.Name,
|
||||
Description: gi.Description,
|
||||
ConfigContent: gi.ConfigContent,
|
||||
CreatedAt: JsonTime(gi.CreateTime),
|
||||
UpdateAt: JsonTime(gi.UpdateTime),
|
||||
}
|
||||
}
|
||||
|
||||
func ConvertToRunConfigFromSlice(giSlice []*model.ProjectRunConfig) []*ProjectRunConfigDto {
|
||||
var result []*ProjectRunConfigDto
|
||||
for _, gi := range giSlice {
|
||||
result = append(result, ConvertToRunConfigDto(gi))
|
||||
}
|
||||
return result
|
||||
}
|
@ -11,6 +11,8 @@ type SimulationCreateReqDto struct {
|
||||
MapId int32 `json:"mapId" form:"mapId"`
|
||||
// 项目id
|
||||
ProjectId int32 `json:"projectId" form:"projectId"`
|
||||
// 运行环境ID
|
||||
ProjectRunConfigId int32 `json:"runConfigId" form:"runConfigId"`
|
||||
}
|
||||
|
||||
// 创建仿真响应
|
||||
|
1
main.go
1
main.go
@ -38,6 +38,7 @@ func main() {
|
||||
api.InitTrainManageRouter(router, authMiddleware)
|
||||
api.InitProjectLinkRouter(router, authMiddleware)
|
||||
api.InitAuthRouter(router, authMiddleware)
|
||||
api.InitProjectRunConfigRouter(router, authMiddleware)
|
||||
docs.SwaggerInfo.Title = "CBTC测试系统API"
|
||||
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
|
||||
|
82
service/projectRunConfig.go
Normal file
82
service/projectRunConfig.go
Normal file
@ -0,0 +1,82 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"joylink.club/bj-rtsts-server/db/dbquery"
|
||||
"joylink.club/bj-rtsts-server/db/model"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
)
|
||||
|
||||
// 查询项目运行环境列表带分页
|
||||
func PageProjectRunConfigQuery(query *dto.PageProjectRunConfigReqDto) *dto.PageDto {
|
||||
d := dbquery.ProjectRunConfig
|
||||
dq := d.Where()
|
||||
if query.Name != "" {
|
||||
dq = dq.Where(d.Name.Like(fmt.Sprintf("%%%s%%", query.Name)))
|
||||
}
|
||||
records, total, err := dq.Debug().Omit(d.ConfigContent).FindByPage(query.Offset(), query.Size)
|
||||
if err != nil {
|
||||
panic(sys_error.New("查询失败,数据库错误请联系运维人员", err))
|
||||
}
|
||||
return &dto.PageDto{Total: int(total), PageQueryDto: query.PageQueryDto, Records: records}
|
||||
}
|
||||
|
||||
// 查询项目运行环境列表
|
||||
func ListProjectRunConfigQuery() []*dto.ProjectRunConfigDto {
|
||||
records, err := dbquery.ProjectRunConfig.Debug().Omit(dbquery.ProjectRunConfig.ConfigContent).Find()
|
||||
if err != nil {
|
||||
panic(sys_error.New("查询失败,数据库错误请联系运维人员", err))
|
||||
}
|
||||
return dto.ConvertToRunConfigFromSlice(records)
|
||||
}
|
||||
|
||||
// 创建项目运行环境
|
||||
func CreateProjectRunConfig(dd *dto.ProjectRunConfigReqDto) bool {
|
||||
d := model.ProjectRunConfig{
|
||||
Name: dd.Name,
|
||||
Description: dd.Description,
|
||||
ConfigContent: dd.ConfigContent,
|
||||
CreateTime: time.Now(),
|
||||
UpdateTime: time.Now(),
|
||||
}
|
||||
err := dbquery.ProjectRunConfig.Save(&d)
|
||||
if err != nil {
|
||||
panic(sys_error.New("保存失败,数据库错误请联系运维人员", err))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 查询项目运行环境
|
||||
func QueryProjectRunConfig(id int32) *dto.ProjectRunConfigDto {
|
||||
query, err := dbquery.ProjectRunConfig.Where(dbquery.ProjectRunConfig.ID.Eq(id)).Debug().First()
|
||||
if err != nil {
|
||||
panic(sys_error.New("查询失败,不存在此信息", err))
|
||||
}
|
||||
return dto.ConvertToRunConfigDto(query)
|
||||
}
|
||||
|
||||
// 更新项目运行环境
|
||||
func UpdateProjectRunConfig(id int32, dd *dto.ProjectRunConfigReqDto) bool {
|
||||
findOldQuery := dbquery.ProjectRunConfig
|
||||
oldD, err := findOldQuery.Where(findOldQuery.ID.Eq(id)).Debug().First()
|
||||
if oldD == nil || err != nil {
|
||||
panic(sys_error.New("保存失败,不存在此信息", err))
|
||||
}
|
||||
oldD.Name = dd.Name
|
||||
oldD.Description = dd.Description
|
||||
oldD.ConfigContent = dd.ConfigContent
|
||||
oldD.UpdateTime = time.Now()
|
||||
_, err2 := findOldQuery.Updates(oldD)
|
||||
if err2 != nil {
|
||||
panic(sys_error.New("保存失败,请联系维护人员", err2))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 删除项目运行环境
|
||||
func DeleteProjectRunConfigById(id int32) {
|
||||
dbquery.ProjectRunConfig.Debug().Where(dbquery.ProjectRunConfig.ID.Eq(id)).Delete()
|
||||
}
|
Loading…
Reference in New Issue
Block a user