Bläddra i källkod

只查询我可编辑

xyxie 9 månader sedan
förälder
incheckning
52248fc78f
2 ändrade filer med 23 tillägg och 15 borttagningar
  1. 14 11
      controllers/data_manage/excel/excel_classify.go
  2. 9 4
      models/data_manage/excel/excel_info.go

+ 14 - 11
controllers/data_manage/excel/excel_classify.go

@@ -70,20 +70,23 @@ func (this *ExcelClassifyController) List() {
 	allExcelInfo := make([]*excel.ExcelClassifyItems, 0)
 	if source == utils.BALANCE_TABLE {
 		//找到当前协作人相关的表格ID
-		obj := new(excel.ExcelWorker)
-		existList, err := obj.GetBySysUserId(this.SysUser.AdminId)
-		if err != nil {
-			br.Msg = "获取表格协作人失败!"
-			br.ErrMsg = "获取表格协作人失败,Err:" + err.Error()
-			return
-		}
 		var excelIds []int
-		if len(existList) > 0 {
-			for _, v := range existList {
-				excelIds = append(excelIds, v.ExcelInfoId)
+		if isShowMe {
+			obj := new(excel.ExcelWorker)
+			existList, err := obj.GetBySysUserId(this.SysUser.AdminId)
+			if err != nil {
+				br.Msg = "获取表格协作人失败!"
+				br.ErrMsg = "获取表格协作人失败,Err:" + err.Error()
+				return
+			}
+			if len(existList) > 0 {
+				for _, v := range existList {
+					excelIds = append(excelIds, v.ExcelInfoId)
+				}
 			}
 		}
-		allExcelInfo, err = excel.GetBalanceNoContentExcelInfoAll(source, excelIds)
+
+		allExcelInfo, err = excel.GetBalanceNoContentExcelInfoAll(source, excelIds, showUserId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取表格信息失败,Err:" + err.Error()

+ 9 - 4
models/data_manage/excel/excel_info.go

@@ -176,7 +176,7 @@ func GetNoContentExcelInfoAll(source, userId int) (items []*ExcelClassifyItems,
 }
 
 // GetBalanceNoContentExcelInfoAll 获取不含content的平衡表表格列表 用于分类展示
-func GetBalanceNoContentExcelInfoAll(source int, excelInfoIds []int) (items []*ExcelClassifyItems, err error) {
+func GetBalanceNoContentExcelInfoAll(source int, excelInfoIds []int, userId int) (items []*ExcelClassifyItems, err error) {
 	o := orm.NewOrmUsingDB("data")
 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
              unique_code,sys_user_id,sys_user_real_name,sort,is_join_permission
@@ -184,9 +184,14 @@ func GetBalanceNoContentExcelInfoAll(source int, excelInfoIds []int) (items []*E
 
 	pars := []interface{}{source}
 
-	if len(excelInfoIds) > 0 {
-		sql += ` AND excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-		pars = append(pars, excelInfoIds)
+	if userId > 0 {
+		if len(excelInfoIds) > 0 {
+			sql += ` AND (excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `) or sys_user_id = ?)`
+			pars = append(pars, excelInfoIds, userId)
+		} else {
+			sql += ` AND sys_user_id = ? `
+			pars = append(pars, userId)
+		}
 	}
 
 	sql += `  ORDER BY sort asc,excel_info_id desc `