|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"context"
|
|
|
"dashoo.cn/opms_libary/myerrors"
|
|
|
"database/sql"
|
|
|
+ "github.com/gogf/gf/container/garray"
|
|
|
"github.com/gogf/gf/os/gtime"
|
|
|
"github.com/gogf/gf/util/gconv"
|
|
|
"strings"
|
|
|
@@ -29,6 +30,10 @@ func NewPunchRecordsService(ctx context.Context) (svc *PunchRecordsService, err
|
|
|
|
|
|
func (s *PunchRecordsService) GetList(req *model.SearchPunchRecordsReq) (total int, punchRecordsList []*model.PlatPunchRecords, err error) {
|
|
|
db := s.Dao.Where(s.Dao.C.UserId, s.GetCxtUserId())
|
|
|
+ // 用户仅有销售工程师角色展示自己的数据,其他人可以看到所有数据
|
|
|
+ if garray.NewStrArrayFrom(s.CxtUser.Roles, true).Contains("SalesEngineer") {
|
|
|
+ db = db.WhereIn("user_id", s.DataScope["userIds"])
|
|
|
+ }
|
|
|
if req.BeginTime != "" {
|
|
|
db = db.WhereGTE(s.Dao.C.CreatedTime, req.BeginTime)
|
|
|
}
|
|
|
@@ -46,6 +51,10 @@ func (s *PunchRecordsService) GetList(req *model.SearchPunchRecordsReq) (total i
|
|
|
}
|
|
|
func (s *PunchRecordsService) GetListByDay(req *model.SearchPunchRecordsReq) (total int, list []*model.PunchRecordsRes, err error) {
|
|
|
db := s.Dao.FieldsEx(s.Dao.C.DeletedTime)
|
|
|
+ // 用户仅有销售工程师角色展示自己的数据,其他人可以看到所有数据
|
|
|
+ if garray.NewStrArrayFrom(s.CxtUser.Roles, true).Contains("SalesEngineer") {
|
|
|
+ db = db.WhereIn("user_id", s.DataScope["userIds"])
|
|
|
+ }
|
|
|
if req.UserNickName != "" {
|
|
|
db = db.WhereLike(s.Dao.C.UserNickName, "%"+req.UserNickName+"%")
|
|
|
}
|