fix
zhangqian
2024-04-09 c74a3671610ad2dfb864b0731291dc158750f55b
fix
3个文件已修改
20 ■■■■■ 已修改文件
controllers/dict.go 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/request/system_set.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/dict.go 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dict.go
@@ -118,7 +118,11 @@
        return
    }
    list, err := models.NewDictSearch().SetDictType(params.DictType).FindAll()
    search := models.NewDictSearch()
    if params.DictType != nil {
        search = search.SetDictType(params.DictType)
    }
    list, err := search.FindAll()
    if err != nil {
        util.ResponseFormat(c, code.RequestParamError, "查找失败")
controllers/request/system_set.go
@@ -7,7 +7,7 @@
type GetDictList struct {
    PageInfo
    DictType constvar.DictType `json:"dictType"` //字典类型
    DictType *constvar.DictType `json:"dictType" form:"dictType"` //字典类型
}
type AddDict struct {
models/dict.go
@@ -11,10 +11,10 @@
    // Dict 词典
    Dict struct {
        gorm.Model
        DictType constvar.DictType `gorm:"index;type:tinyint(3);not null;comment:字典类型"`         //字典类型
        Number   string            `gorm:"type:varchar(255);not null;comment:编号" json:"number"` //编号
        Name     string            `gorm:"type:varchar(255);not null;comment:名称" json:"name"`   //名称
        Remark   string            `gorm:"type:varchar(255);not null;comment:备注" json:"remark"` //备注
        DictType *constvar.DictType `gorm:"index;type:tinyint(3);not null;comment:字典类型"`         //字典类型
        Number   string             `gorm:"type:varchar(255);not null;comment:编号" json:"number"` //编号
        Name     string             `gorm:"type:varchar(255);not null;comment:名称" json:"name"`   //名称
        Remark   string             `gorm:"type:varchar(255);not null;comment:备注" json:"remark"` //备注
    }
    DictSearch struct {
@@ -64,7 +64,7 @@
    return slf
}
func (slf *DictSearch) SetDictType(dt constvar.DictType) *DictSearch {
func (slf *DictSearch) SetDictType(dt *constvar.DictType) *DictSearch {
    slf.DictType = dt
    return slf
}
@@ -84,7 +84,7 @@
        db = db.Where("number = ?", slf.Number)
    }
    if slf.DictType != 0 {
    if slf.DictType != nil {
        db = db.Where("dict_type = ?", slf.DictType)
    }