|
@@ -407,21 +407,20 @@ func InheritParentClassifyByEdbClassifyId(source, classifyType, classifyId, pare
|
|
|
|
|
|
{
|
|
|
|
|
|
- var parentRecordItems []*DataPermissionClassifyNoAuthRecord
|
|
|
- sql = `SELECT * FROM data_permission_classify_no_auth_record WHERE classify_id = ? AND source = ? AND sub_source = ? ORDER BY data_permission_classify_no_auth_record_id desc LIMIT ?,? `
|
|
|
+ var parentRecordItems []*EdbInfoClassifyPermissionNoAuthRecord
|
|
|
+ sql = `SELECT * FROM edb_info_classify_permission_no_auth_record WHERE classify_id = ? AND edb_classify_type = ? ORDER BY edb_info_classify_permission_no_auth_record_id desc LIMIT ?,? `
|
|
|
_, err = o.Raw(sql, parentClassifyId, source, classifyType).QueryRows(&parentRecordItems)
|
|
|
|
|
|
- addNoAuthRecordItems := make([]*DataPermissionClassifyNoAuthRecord, 0)
|
|
|
+ addNoAuthRecordItems := make([]*EdbInfoClassifyPermissionNoAuthRecord, 0)
|
|
|
for _, v := range parentRecordItems {
|
|
|
- addNoAuthRecordItems = append(addNoAuthRecordItems, &DataPermissionClassifyNoAuthRecord{
|
|
|
- DataPermissionClassifyNoAuthRecordId: 0,
|
|
|
- Source: v.Source,
|
|
|
- SubSource: v.SubSource,
|
|
|
- OpUniqueCode: uniqueCode,
|
|
|
- ClassifyId: fmt.Sprint(classifyId),
|
|
|
- ClassifyName: classifyName,
|
|
|
- SysUserId: v.SysUserId,
|
|
|
- CreateTime: time.Now(),
|
|
|
+ addNoAuthRecordItems = append(addNoAuthRecordItems, &EdbInfoClassifyPermissionNoAuthRecord{
|
|
|
+ EdbInfoClassifyPermissionNoAuthRecordId: 0,
|
|
|
+ EdbClassifyType: v.EdbClassifyType,
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ ClassifyId: fmt.Sprint(classifyId),
|
|
|
+ ClassifyName: classifyName,
|
|
|
+ SysUserId: v.SysUserId,
|
|
|
+ CreateTime: time.Now(),
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -468,3 +467,526 @@ func InheritParentClassifyByEdbClassifyId(source, classifyType, classifyId, pare
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type EdbInfoPermissionNoAuthRecord struct {
|
|
|
+ EdbInfoPermissionNoAuthRecordId int64 `json:"edb_info_permission_no_auth_record_id" orm:"column(edb_info_permission_no_auth_record_id);pk"`
|
|
|
+ OpUniqueCode string `json:"op_unique_code"`
|
|
|
+ EdbInfoType int32 `json:"edb_info_type"`
|
|
|
+ EdbInfoId int32 `json:"edb_info_id"`
|
|
|
+ EdbCode string `json:"edb_code"`
|
|
|
+ EdbName string `json:"edb_name"`
|
|
|
+ SysUserId int32 `json:"sys_user_id"`
|
|
|
+ CreateTime time.Time `json:"create_time"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func AddEdbInfoPermissionNoAuthRecordBySourceAndDataIdList(source, edbInfoType int, dataList []DataItem, noAuthUserIdList, authUserIdList []int, uniqueCode, content string, opUserId int) (err error) {
|
|
|
+ num := len(dataList)
|
|
|
+ if num <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ dataIdList := make([]int, 0)
|
|
|
+ for _, v := range dataList {
|
|
|
+ dataIdList = append(dataIdList, v.DataId)
|
|
|
+ }
|
|
|
+ userNum := len(noAuthUserIdList)
|
|
|
+ if userNum <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ o, err := orm.NewOrmUsingDB("data").Begin()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ _ = o.Rollback()
|
|
|
+ } else {
|
|
|
+ _ = o.Commit()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ var existList []*EdbInfoPermissionNoAuthRecord
|
|
|
+ sql := `SELECT * FROM edb_info_permission_no_auth_record WHERE edb_info_type = ? AND edb_info_id in (` + utils.GetOrmInReplace(num) + `)`
|
|
|
+ _, err = o.Raw(sql, edbInfoType, dataIdList).QueryRows(&existList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ existMap := make(map[int32]map[string]*EdbInfoPermissionNoAuthRecord)
|
|
|
+ for _, v := range existList {
|
|
|
+ tmpUserExistMap, ok := existMap[v.SysUserId]
|
|
|
+ if !ok {
|
|
|
+ tmpUserExistMap = make(map[string]*EdbInfoPermissionNoAuthRecord)
|
|
|
+ }
|
|
|
+
|
|
|
+ key := fmt.Sprint(v.EdbInfoType, "_", v.EdbInfoId)
|
|
|
+ tmpUserExistMap[key] = v
|
|
|
+ existMap[v.SysUserId] = tmpUserExistMap
|
|
|
+ }
|
|
|
+
|
|
|
+ addMessageList := make([]*DataPermissionMessage, 0)
|
|
|
+ addRecordList := make([]*EdbInfoPermissionNoAuthRecord, 0)
|
|
|
+ for _, userId := range noAuthUserIdList {
|
|
|
+ isAdd := false
|
|
|
+
|
|
|
+ tmpUserExistMap, userExistOk := existMap[int32(userId)]
|
|
|
+
|
|
|
+ for _, dataItem := range dataList {
|
|
|
+
|
|
|
+ if userExistOk {
|
|
|
+ key := fmt.Sprint(edbInfoType, "_", dataItem.DataId)
|
|
|
+ _, ok := tmpUserExistMap[key]
|
|
|
+ if ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isAdd = true
|
|
|
+ addRecordList = append(addRecordList, &EdbInfoPermissionNoAuthRecord{
|
|
|
+ EdbInfoPermissionNoAuthRecordId: 0,
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ EdbInfoType: int32(edbInfoType),
|
|
|
+ EdbInfoId: int32(dataItem.DataId),
|
|
|
+ EdbCode: dataItem.DataCode,
|
|
|
+ EdbName: dataItem.DataName,
|
|
|
+ SysUserId: int32(userId),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if isAdd {
|
|
|
+ addMessageList = append(addMessageList, &DataPermissionMessage{
|
|
|
+ DataPermissionMessageId: 0,
|
|
|
+ SendUserId: int32(opUserId),
|
|
|
+ ReceiveUserId: int32(userId),
|
|
|
+ Content: content,
|
|
|
+ Remark: content,
|
|
|
+ OpType: 3,
|
|
|
+ Source: int32(source),
|
|
|
+ SubSource: int32(edbInfoType),
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ IsRead: 0,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addMessageList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addMessageList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addRecordList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addRecordList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ authUserIdNum := len(authUserIdList)
|
|
|
+ if authUserIdNum > 0 {
|
|
|
+ sql = `DELETE FROM edb_info_permission_no_auth_record WHERE edb_info_type = ? AND sys_user_id in (` + utils.GetOrmInReplace(authUserIdNum) + `) AND edb_info_id in (` + utils.GetOrmInReplace(num) + `)`
|
|
|
+ _, err = o.Raw(sql, edbInfoType, authUserIdList, dataIdList).Exec()
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func DeleteEdbInfoPermissionNoAuthRecordBySourceAndDataIdList(edbInfoType int, dataIdList []string) (err error) {
|
|
|
+ num := len(dataIdList)
|
|
|
+ if num <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+
|
|
|
+ sql := `DELETE FROM edb_info_permission_no_auth_record WHERE edb_info_type = ? AND edb_info_id in (` + utils.GetOrmInReplace(num) + `)`
|
|
|
+ _, err = o.Raw(sql, edbInfoType, dataIdList).Exec()
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func GetEdbInfoDataPermissionNoAuthRecordListByUserId(userId int32, edbInfoType, startSize, pageSize int) (total int, items []*DataPermissionNoAuthRecord, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+
|
|
|
+
|
|
|
+ sql := `SELECT count(1) AS total FROM edb_info_permission_no_auth_record WHERE sys_user_id = ? AND edb_info_type = ? `
|
|
|
+ err = o.Raw(sql, userId, edbInfoType).QueryRow(&total)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ sql = `SELECT edb_info_permission_no_auth_record_id as data_permission_no_auth_record_id,op_unique_code,edb_info_type as sub_source,edb_info_id as data_id,edb_code as data_code,edb_name as data_name,sys_user_id,create_time FROM edb_info_permission_no_auth_record WHERE sys_user_id = ? AND edb_info_type = ? ORDER BY edb_info_permission_no_auth_record_id desc LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, userId, edbInfoType, startSize, pageSize).QueryRows(&items)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type EdbInfoClassifyPermissionNoAuthRecord struct {
|
|
|
+ EdbInfoClassifyPermissionNoAuthRecordId int64 `json:"edb_info_classify_permission_no_auth_record_id" orm:"column(edb_info_classify_permission_no_auth_record_id);pk"`
|
|
|
+ EdbClassifyType int32 `json:"edb_classify_type"`
|
|
|
+ OpUniqueCode string `json:"op_unique_code"`
|
|
|
+ ClassifyId string `json:"classify_id"`
|
|
|
+ ClassifyName string `json:"classify_name"`
|
|
|
+ SysUserId int32 `json:"sys_user_id"`
|
|
|
+ CreateTime time.Time `json:"create_time"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func AddEdbInfoClassifyNoAuthRecordBySourceAndClassifyIdList(source, edbClassifyType int, classifyInfoList []ClassifyDataItem, noAuthUserIdList []int, uniqueCode, content string, opUserId int) (err error) {
|
|
|
+ num := len(classifyInfoList)
|
|
|
+ if num <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
+ for _, v := range classifyInfoList {
|
|
|
+ classifyIdList = append(classifyIdList, v.ClassifyId)
|
|
|
+ }
|
|
|
+
|
|
|
+ userNum := len(noAuthUserIdList)
|
|
|
+ if userNum <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ o, err := orm.NewOrmUsingDB("data").Begin()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ _ = o.Rollback()
|
|
|
+ } else {
|
|
|
+ _ = o.Commit()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ var existList []*EdbInfoClassifyPermissionNoAuthRecord
|
|
|
+ sql := `SELECT * FROM edb_info_classify_permission_no_auth_record WHERE edb_classify_type = ? AND classify_id in (` + utils.GetOrmInReplace(num) + `)`
|
|
|
+ _, err = o.Raw(sql, edbClassifyType, classifyIdList).QueryRows(&existList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ existMap := make(map[int32]map[string]*EdbInfoClassifyPermissionNoAuthRecord)
|
|
|
+ for _, v := range existList {
|
|
|
+ tmpUserExistMap, ok := existMap[v.SysUserId]
|
|
|
+ if !ok {
|
|
|
+ tmpUserExistMap = make(map[string]*EdbInfoClassifyPermissionNoAuthRecord)
|
|
|
+ }
|
|
|
+
|
|
|
+ key := fmt.Sprint(v.EdbClassifyType, "_", v.ClassifyId)
|
|
|
+ tmpUserExistMap[key] = v
|
|
|
+ existMap[v.SysUserId] = tmpUserExistMap
|
|
|
+ }
|
|
|
+
|
|
|
+ addMessageList := make([]*DataPermissionMessage, 0)
|
|
|
+ addRecordList := make([]*EdbInfoClassifyPermissionNoAuthRecord, 0)
|
|
|
+ for _, userId := range noAuthUserIdList {
|
|
|
+ isAdd := false
|
|
|
+
|
|
|
+ tmpUserExistMap, userExistOk := existMap[int32(userId)]
|
|
|
+
|
|
|
+ for _, dataItem := range classifyInfoList {
|
|
|
+
|
|
|
+ if userExistOk {
|
|
|
+ key := fmt.Sprint(edbClassifyType, "_", dataItem.ClassifyId)
|
|
|
+ _, ok := tmpUserExistMap[key]
|
|
|
+ if ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isAdd = true
|
|
|
+ addRecordList = append(addRecordList, &EdbInfoClassifyPermissionNoAuthRecord{
|
|
|
+ EdbInfoClassifyPermissionNoAuthRecordId: 0,
|
|
|
+ EdbClassifyType: int32(edbClassifyType),
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ ClassifyId: fmt.Sprint(dataItem.ClassifyId),
|
|
|
+ ClassifyName: dataItem.ClassifyName,
|
|
|
+ SysUserId: int32(userId),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if isAdd {
|
|
|
+ addMessageList = append(addMessageList, &DataPermissionMessage{
|
|
|
+ DataPermissionMessageId: 0,
|
|
|
+ SendUserId: int32(opUserId),
|
|
|
+ ReceiveUserId: int32(userId),
|
|
|
+ Content: content,
|
|
|
+ Remark: content,
|
|
|
+ OpType: 4,
|
|
|
+ Source: int32(source),
|
|
|
+ SubSource: int32(edbClassifyType),
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ IsRead: 0,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addMessageList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addMessageList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addRecordList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addRecordList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ authUserIdNum := len(classifyIdList)
|
|
|
+ if authUserIdNum > 0 {
|
|
|
+ sql = `DELETE FROM edb_info_classify_permission_no_auth_record WHERE edb_classify_type = ? AND classify_id not in (` + utils.GetOrmInReplace(num) + `)`
|
|
|
+ _, err = o.Raw(sql, edbClassifyType, classifyIdList).Exec()
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func AddEdbInfoClassifyNoAuthRecordBySourceAndUserIdList(source, edbClassifyType int, noAuthClassifyMap map[int]ClassifyDataItem, configUserIdList []int, uniqueCode, content string, opUserId int) (err error) {
|
|
|
+
|
|
|
+ configUserNum := len(configUserIdList)
|
|
|
+ if configUserNum <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ o, err := orm.NewOrmUsingDB("data").Begin()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ _ = o.Rollback()
|
|
|
+ } else {
|
|
|
+ _ = o.Commit()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ var existList []*EdbInfoClassifyPermissionNoAuthRecord
|
|
|
+ sql := `SELECT * FROM edb_info_classify_permission_no_auth_record WHERE edb_classify_type = ? AND sys_user_id in (` + utils.GetOrmInReplace(configUserNum) + `)`
|
|
|
+ _, err = o.Raw(sql, edbClassifyType, configUserIdList).QueryRows(&existList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ existMap := make(map[int32]map[string]*EdbInfoClassifyPermissionNoAuthRecord)
|
|
|
+ delRecordIdMap := make(map[int64]int64)
|
|
|
+ for _, v := range existList {
|
|
|
+ tmpUserExistMap, ok := existMap[v.SysUserId]
|
|
|
+ if !ok {
|
|
|
+ tmpUserExistMap = make(map[string]*EdbInfoClassifyPermissionNoAuthRecord)
|
|
|
+ }
|
|
|
+
|
|
|
+ tmpUserExistMap[v.ClassifyId] = v
|
|
|
+ existMap[v.SysUserId] = tmpUserExistMap
|
|
|
+
|
|
|
+
|
|
|
+ delRecordIdMap[v.EdbInfoClassifyPermissionNoAuthRecordId] = v.EdbInfoClassifyPermissionNoAuthRecordId
|
|
|
+ }
|
|
|
+
|
|
|
+ addMessageList := make([]*DataPermissionMessage, 0)
|
|
|
+ addRecordList := make([]*EdbInfoClassifyPermissionNoAuthRecord, 0)
|
|
|
+ for _, userId := range configUserIdList {
|
|
|
+ isAdd := false
|
|
|
+
|
|
|
+ tmpUserExistMap, userExistOk := existMap[int32(userId)]
|
|
|
+
|
|
|
+ for _, dataItem := range noAuthClassifyMap {
|
|
|
+
|
|
|
+ if userExistOk {
|
|
|
+ key := fmt.Sprint(dataItem.ClassifyId)
|
|
|
+ tmpUserRecord, ok := tmpUserExistMap[key]
|
|
|
+ if ok {
|
|
|
+ delete(delRecordIdMap, tmpUserRecord.EdbInfoClassifyPermissionNoAuthRecordId)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isAdd = true
|
|
|
+ addRecordList = append(addRecordList, &EdbInfoClassifyPermissionNoAuthRecord{
|
|
|
+ EdbInfoClassifyPermissionNoAuthRecordId: 0,
|
|
|
+ EdbClassifyType: int32(edbClassifyType),
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ ClassifyId: fmt.Sprint(dataItem.ClassifyId),
|
|
|
+ ClassifyName: dataItem.ClassifyName,
|
|
|
+ SysUserId: int32(userId),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if isAdd {
|
|
|
+ addMessageList = append(addMessageList, &DataPermissionMessage{
|
|
|
+ DataPermissionMessageId: 0,
|
|
|
+ SendUserId: int32(opUserId),
|
|
|
+ ReceiveUserId: int32(userId),
|
|
|
+ Content: content,
|
|
|
+ Remark: content,
|
|
|
+ OpType: 4,
|
|
|
+ Source: int32(source),
|
|
|
+ SubSource: int32(edbClassifyType),
|
|
|
+ OpUniqueCode: uniqueCode,
|
|
|
+ IsRead: 0,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addMessageList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addMessageList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if len(addRecordList) > 0 {
|
|
|
+ _, err = o.InsertMulti(500, addRecordList)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ delRecordIdNum := len(delRecordIdMap)
|
|
|
+ if delRecordIdNum > 0 {
|
|
|
+ delRecordIdList := make([]int64, 0)
|
|
|
+ for _, v := range delRecordIdMap {
|
|
|
+ delRecordIdList = append(delRecordIdList, v)
|
|
|
+ }
|
|
|
+ sql = `DELETE FROM edb_info_classify_permission_no_auth_record WHERE edb_info_classify_permission_no_auth_record_id in (` + utils.GetOrmInReplace(delRecordIdNum) + `) `
|
|
|
+ _, err = o.Raw(sql, delRecordIdList).Exec()
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func DeleteEdbInfoClassifyNoAuthRecordBySourceAndClassifyIdList(edbClassifyType int) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+
|
|
|
+ sql := `DELETE FROM edb_info_classify_permission_no_auth_record WHERE edb_classify_type = ?`
|
|
|
+ _, err = o.Raw(sql, edbClassifyType).Exec()
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func GetEdbInfoDataPermissionClassifyNoAuthRecordListByUserId(userId int32, edbClassifyType, startSize, pageSize int) (total int, items []*DataPermissionClassifyNoAuthRecord, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+
|
|
|
+
|
|
|
+ sql := `SELECT count(1) AS total FROM edb_info_classify_permission_no_auth_record WHERE sys_user_id = ? AND edb_classify_type = ? `
|
|
|
+ err = o.Raw(sql, userId, edbClassifyType).QueryRow(&total)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ sql = `SELECT edb_info_classify_permission_no_auth_record_id as data_permission_classify_no_auth_record_id,edb_classify_type as sub_source,op_unique_code,classify_id,classify_name,sys_user_id,create_time FROM edb_info_classify_permission_no_auth_record WHERE sys_user_id = ? AND edb_classify_type = ? ORDER BY edb_info_classify_permission_no_auth_record_id desc LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, userId, edbClassifyType, startSize, pageSize).QueryRows(&items)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|