12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package data_manage
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- )
- // GetEdbInfoByPublicClassifyId
- // @Description: 根据公共分类id获取指标列表
- // @author: Roc
- // @datetime 2024-12-03 14:09:32
- // @param classifyId int
- // @param edbInfoType int
- // @param edbType int
- // @return items []*EdbClassifyItems
- // @return err error
- func GetEdbInfoByPublicClassifyId(classifyId, edbInfoType, edbType int) (items []*EdbClassifyItems, err error) {
- o := global.DmSQL["data"]
- sql := ` SELECT edb_info_id,classify_id,edb_public_classify_id,edb_name AS classify_name,edb_name_en AS classify_name_en,unique_code,source_name,source,sys_user_id,sys_user_real_name,start_date,edb_code,edb_type, public_sort sort,is_join_permission FROM edb_info WHERE edb_public_classify_id = ? AND edb_info_type = ?`
- pars := []interface{}{classifyId, edbInfoType}
- // 如果筛选了指标类型,那么就根据条件来
- if edbType > 0 {
- sql += ` AND edb_type = ? `
- pars = append(pars, edbType)
- }
- sql += ` order by public_sort asc,edb_info_id asc `
- err = o.Raw(sql, pars...).Scan(&items).Error
- return
- }
- // UpdatePublicEdbSuccess
- // @Description: 更新指标的公开成功状态
- // @author: Roc
- // @datetime 2024-12-06 13:37:01
- // @param edbInfoId int
- // @param classifyId int
- // @return err error
- func UpdatePublicEdbSuccess(edbInfoId, classifyId int) (err error) {
- sql := `UPDATE edb_info set public_status = ?,edb_public_classify_id = ? ,modify_time=now(),public_time = now() WHERE edb_info_id = ?`
- err = global.DmSQL["data"].Exec(sql, utils.DataPublicSuccess, classifyId, edbInfoId).Error
- return
- }
- // UpdatePublicEdb
- // @Description: 更新指标的公开状态
- // @author: Roc
- // @datetime 2024-12-06 11:10:53
- // @param edbInfoIdList []int
- // @param status int
- // @return err error
- func UpdatePublicEdb(edbInfoIdList []int, status int) (err error) {
- if len(edbInfoIdList) <= 0 {
- return
- }
- sql := `UPDATE edb_info set public_status = ?,modify_time=now() `
- if status == utils.DataPublicSuccess {
- sql += `,public_time = now() `
- }
- sql += ` WHERE edb_info_id in (?) `
- err = global.DmSQL["data"].Exec(sql, status, edbInfoIdList).Error
- return
- }
- // UpdatePublicClassifyIdByEdbInfoIdList
- // @Description: 根据指标id列表更新所属公共分类id
- // @author: Roc
- // @datetime 2024-12-10 13:18:52
- // @param edbInfoId int
- // @param edbClassifyId int
- // @return err error
- func UpdatePublicClassifyIdByEdbInfoIdList(edbInfoIdList []int, edbClassifyId int) (err error) {
- if len(edbInfoIdList) <= 0 {
- return
- }
- sql := ` UPDATE edb_info SET edb_public_classify_id = ? WHERE edb_info_id in (?) AND public_status = 3 `
- err = global.DmSQL["data"].Exec(sql, edbClassifyId, edbInfoIdList).Error
- return
- }
|