mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	feat: 支持关联多标签、计划任务立即执行、标签相关操作优化
This commit is contained in:
		@@ -2,6 +2,7 @@ package api
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"mayfly-go/internal/common/consts"
 | 
			
		||||
	"mayfly-go/internal/mongo/api/form"
 | 
			
		||||
	"mayfly-go/internal/mongo/application"
 | 
			
		||||
	"mayfly-go/internal/mongo/domain/entity"
 | 
			
		||||
@@ -30,22 +31,18 @@ func (m *Mongo) Mongos(rc *req.Ctx) {
 | 
			
		||||
	queryCond, page := ginx.BindQueryAndPage[*entity.MongoQuery](rc.GinCtx, new(entity.MongoQuery))
 | 
			
		||||
 | 
			
		||||
	// 不存在可访问标签id,即没有可操作数据
 | 
			
		||||
	tagIds := m.TagApp.ListTagIdByAccountId(rc.GetLoginAccount().Id)
 | 
			
		||||
	if len(tagIds) == 0 {
 | 
			
		||||
	codes := m.TagApp.GetAccountResourceCodes(rc.GetLoginAccount().Id, consts.TagResourceTypeMongo, queryCond.TagPath)
 | 
			
		||||
	if len(codes) == 0 {
 | 
			
		||||
		rc.ResData = model.EmptyPageResult[any]()
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	queryCond.TagIds = tagIds
 | 
			
		||||
	queryCond.Codes = codes
 | 
			
		||||
 | 
			
		||||
	res, err := m.MongoApp.GetPageList(queryCond, page, new([]entity.Mongo))
 | 
			
		||||
	biz.ErrIsNil(err)
 | 
			
		||||
	rc.ResData = res
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Mongo) MongoTags(rc *req.Ctx) {
 | 
			
		||||
	rc.ResData = m.TagApp.ListTagByAccountIdAndResource(rc.GetLoginAccount().Id, new(entity.Mongo))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Mongo) TestConn(rc *req.Ctx) {
 | 
			
		||||
	form := &form.Mongo{}
 | 
			
		||||
	mongo := ginx.BindJsonAndCopyTo[*entity.Mongo](rc.GinCtx, form, new(entity.Mongo))
 | 
			
		||||
@@ -63,7 +60,7 @@ func (m *Mongo) Save(rc *req.Ctx) {
 | 
			
		||||
	}(form.Uri)
 | 
			
		||||
	rc.ReqParam = form
 | 
			
		||||
 | 
			
		||||
	biz.ErrIsNil(m.MongoApp.Save(rc.MetaCtx, mongo))
 | 
			
		||||
	biz.ErrIsNil(m.MongoApp.Save(rc.MetaCtx, mongo, form.TagId...))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Mongo) DeleteMongo(rc *req.Ctx) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user