package data_manage import ( "eta_gn/eta_task/global" "time" ) type EdbClassify struct { ClassifyID int64 `gorm:"column:classify_id;primaryKey"` //`orm:"column(classify_id);pk"` ClassifyType uint32 ClassifyName string ParentID int64 HasData int32 CreateTime time.Time ModifyTime time.Time SysUserID int64 SysUserRealName string Level int64 UniqueCode string Sort uint32 RootID int64 LastModifyUserID uint32 LastModifyUserRealName string IsJoinPermission int64 ClassifyNameEn string } // GetAllEdbClassifyListByCondition // @Description: 获取分类列表 // @author: Roc // @datetime 2024-02-29 10:55:38 // @param condition string // @param pars []interface{} // @return item []*EdbInfoUpdateLog // @return err error func GetAllEdbClassifyListByCondition(condition string, pars []interface{}) (item []*EdbClassify, err error) { //o := orm.NewOrmUsingDB("data") sql := ` SELECT * FROM edb_classify WHERE 1=1 ` if condition != "" { sql += condition } sql += `ORDER BY classify_id ASC ` //_, err = o.Raw(sql, pars).QueryRows(&item) err = global.DmSQL["data"].Raw(sql, pars...).Find(&item).Error return } // AddEdbClassify // @Description: 新增分类 // @param item // @return err func AddEdbClassify(item *EdbClassify) (err error) { err = global.DmSQL["data"].Create(item).Error if err != nil { return } return } // Update // @Description: 更新指定参数 // @receiver m // @param cols // @return err func (m *EdbClassify) Update(cols []string) (err error) { err = global.DmSQL["data"].Select(cols).Updates(m).Error return }