Skip to content

Commit abe85cf

Browse files
author
piexlmax(奇淼
committed
增加字典方法 GetDictionaryList,GetDictionaryListByType,GetDictionaryInfoByValue, GetDictionaryInfoByTypeValue 方便后台直接获取字典属性
前端增加extend属性获取
1 parent 07cde68 commit abe85cf

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

server/service/system/sys_dictionary_detail.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,33 @@ func (dictionaryDetailService *DictionaryDetailService) GetSysDictionaryDetailIn
8484
err = db.Limit(limit).Offset(offset).Order("sort").Find(&sysDictionaryDetails).Error
8585
return sysDictionaryDetails, total, err
8686
}
87+
88+
// 按照字典id获取字典全部内容的方法
89+
func (dictionaryDetailService *DictionaryDetailService) GetDictionaryList(dictionaryID uint) (list []system.SysDictionaryDetail, err error) {
90+
var sysDictionaryDetails []system.SysDictionaryDetail
91+
err = global.GVA_DB.Find(&sysDictionaryDetails, "sys_dictionary_id = ?", dictionaryID).Error
92+
return sysDictionaryDetails, err
93+
}
94+
95+
// 按照字典type获取字典全部内容的方法
96+
func (dictionaryDetailService *DictionaryDetailService) GetDictionaryListByType(t string) (list []system.SysDictionaryDetail, err error) {
97+
var sysDictionaryDetails []system.SysDictionaryDetail
98+
db := global.GVA_DB.Model(&system.SysDictionaryDetail{}).Joins("JOIN sys_dictionaries ON sys_dictionaries.id = sys_dictionary_details.sys_dictionary_id")
99+
err = db.Debug().Find(&sysDictionaryDetails, "type = ?", t).Error
100+
return sysDictionaryDetails, err
101+
}
102+
103+
// 按照字典id+字典内容value获取单条字典内容
104+
func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByValue(dictionaryID uint, value uint) (detail system.SysDictionaryDetail, err error) {
105+
var sysDictionaryDetail system.SysDictionaryDetail
106+
err = global.GVA_DB.First(&sysDictionaryDetail, "sys_dictionary_id = ? and value = ?", dictionaryID, value).Error
107+
return sysDictionaryDetail, err
108+
}
109+
110+
// 按照字典type+字典内容value获取单条字典内容
111+
func (dictionaryDetailService *DictionaryDetailService) GetDictionaryInfoByTypeValue(t string, value uint) (detail system.SysDictionaryDetail, err error) {
112+
var sysDictionaryDetails system.SysDictionaryDetail
113+
db := global.GVA_DB.Model(&system.SysDictionaryDetail{}).Joins("JOIN sys_dictionaries ON sys_dictionaries.id = sys_dictionary_details.sys_dictionary_id")
114+
err = db.First(&sysDictionaryDetails, "sys_dictionaries.type = ? and sys_dictionary_details.value = ?", t, value).Error
115+
return sysDictionaryDetails, err
116+
}

web/src/view/systemTools/autoCode/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,9 @@ const moveDownField = (index) => {
738738
form.value.fields.splice(index, 0, oldDownField)
739739
}
740740
741-
const currentInstance = getCurrentInstance()
741+
const fieldDialogNode = ref(null)
742742
const enterDialog = () => {
743-
currentInstance.refs.fieldDialogNode.fieldDialogFrom.validate(valid => {
743+
fieldDialogNode.value.fieldDialogFrom.validate(valid => {
744744
if (valid) {
745745
dialogMiddle.value.fieldName = toUpperCase(
746746
dialogMiddle.value.fieldName

0 commit comments

Comments
 (0)