123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package report
- import (
- logger "eta/eta_mini_ht_api/common/component/log"
- configService "eta/eta_mini_ht_api/domian/config"
- permissionDao "eta/eta_mini_ht_api/models/config"
- )
- func GetClassifyIdsByPermissionIds(permissionIds []int) (classifyIds []int, err error) {
- return permissionDao.GetClassifyIdsByPermissionIds(permissionIds)
- }
- func GetPermissionNamesByPermissionIds(permissionIds []int) (permissionNames []string, err error) {
- return permissionDao.GetPermissionNamesByPermissionIds(permissionIds)
- }
- func GetPermissionsByPermissionIds(permissionIds []int) (permissionDTOs []configService.PermissionDTO, err error) {
- permission, err := permissionDao.GetPermissionsByPermissionIds(permissionIds)
- if err != nil {
- return
- }
- for _, node := range permission {
- permissionDTOs = append(permissionDTOs, convertPermissionDTO(node))
- }
- return
- //return etaDao.GetPermissionNamesByPermissionIds(permissionIds)
- }
- func GetFirstPermissionsByIds(ids []int) (permissionDTOS []configService.PermissionDTO, err error) {
- //list, err := etaDao.GetFirstPermissionsByIds(ids)
- list, err := permissionDao.GetFirstPermissionsByIds(ids)
- if err != nil {
- logger.Error("查询品种信息失败:%v", err)
- }
- for _, node := range list {
- permissionDTOS = append(permissionDTOS, convertPermissionDTO(node))
- }
- return
- }
- // 获取一级品种(海通的板块)
- func GetReportPermissionsById(id int, source string) (permissionIds []configService.PermissionDTO) {
- switch source {
- case SourceETA:
- //展示一级品种
- return getETAReportFirstPermissions(id)
- case SourceHT:
- return getHTReportFirstPermissions(id)
- }
- return
- }
- func GetReportSecondPermissionsById(id int, source string) (permissionIds []configService.PermissionDTO) {
- switch source {
- case SourceETA:
- return getETAReportSecondPermissions(id)
- case SourceHT:
- return getHTReportSecondPermissions(id)
- }
- return
- }
- func convertPermissionDTO(node permissionDao.Permission) configService.PermissionDTO {
- return configService.PermissionDTO{
- PermissionId: node.PermissionId,
- PermissionName: node.Name,
- ParentId: node.ParentId,
- RiskLevel: node.RiskLevel,
- }
- }
|