作者 tangxvhui

机会权限调整

@@ -72,6 +72,8 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st @@ -72,6 +72,8 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st
72 sql5 string = fmt.Sprintf(` SELECT id FROM chance where publish_status = %d AND enable_status=1 AND review_status = 3 AND company_id=%d `, models.ChancePublishStatus2, companyid) 72 sql5 string = fmt.Sprintf(` SELECT id FROM chance where publish_status = %d AND enable_status=1 AND review_status = 3 AND company_id=%d `, models.ChancePublishStatus2, companyid)
73 //查看所有公开的 73 //查看所有公开的
74 sql6 string = fmt.Sprintf(`SELECT id FROM chance WHERE review_status =3 AND enable_status=1 And company_id=%d `, companyid) 74 sql6 string = fmt.Sprintf(`SELECT id FROM chance WHERE review_status =3 AND enable_status=1 And company_id=%d `, companyid)
  75 + //获取指定部门未通过的
  76 + sql7 string = "SELECT id FROM chance WHERE department_id IN (%s) and review_status =2 AND enable_status=1"
75 77
76 allsql string = ` SELECT t.id FROM (%s) as t ` 78 allsql string = ` SELECT t.id FROM (%s) as t `
77 unionsql string = `` 79 unionsql string = ``
@@ -132,6 +134,17 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st @@ -132,6 +134,17 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st
132 sqlslice = append(sqlslice, fmt.Sprintf(sql3, strings.Join(ids, ","))) 134 sqlslice = append(sqlslice, fmt.Sprintf(sql3, strings.Join(ids, ",")))
133 } 135 }
134 } 136 }
  137 + if _, ok := usrPermission.CheckMap[serverabc.OpportunityCheckLv4]; ok {
  138 + //指定部门
  139 + ids := []string{}
  140 + for _, v := range usrPermission.CheckOption.Departments {
  141 + ids = append(ids, fmt.Sprint(v.Id))
  142 + }
  143 + if len(ids) > 0 {
  144 + log.Debug("命中规则:指定部门")
  145 + sqlslice = append(sqlslice, fmt.Sprintf(sql7, strings.Join(ids, ",")))
  146 + }
  147 + }
135 if len(usrPermission.CheckMap) > 0 { 148 if len(usrPermission.CheckMap) > 0 {
136 sqlslice = append(sqlslice, sql5) 149 sqlslice = append(sqlslice, sql5)
137 } 150 }