instance_query.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package dps
  2. import (
  3. "git.sxidc.com/service-supports/dps-sdk/client"
  4. "git.sxidc.com/service-supports/fslog"
  5. )
  6. func QueryByWhereAndOrderBy(req *client.QueryByWhereAndOrderByRequest) ([]map[string]any, int64, error) {
  7. statement, dataMaps, totalCount, err := dpsClient.QueryByWhereAndOrderBy(req)
  8. if err != nil {
  9. return nil, 0, err
  10. }
  11. fslog.Info(statement)
  12. return dataMaps, totalCount, nil
  13. }
  14. func CommonQuery(req *client.CommonQueryRequest) ([]map[string]any, int64, error) {
  15. statement, dataMaps, totalCount, err := dpsClient.CommonQuery(req)
  16. if err != nil {
  17. return nil, 0, err
  18. }
  19. fslog.Info(statement)
  20. return dataMaps, totalCount, nil
  21. }
  22. func QueryByKeys(req *client.QueryByKeysRequest) (map[string]any, error) {
  23. statement, dataMap, err := dpsClient.QueryByKeys(req)
  24. if err != nil {
  25. return nil, err
  26. }
  27. fslog.Info(statement)
  28. return dataMap, nil
  29. }
  30. func CountWhere(req *client.CountWhereRequest) (int64, error) {
  31. statement, count, err := dpsClient.CountWhere(req)
  32. if err != nil {
  33. return 0, err
  34. }
  35. fslog.Info(statement)
  36. return count, nil
  37. }
  38. func CommonCount(req *client.CommonCountRequest) (int64, error) {
  39. statement, count, err := dpsClient.CommonCount(req)
  40. if err != nil {
  41. return 0, err
  42. }
  43. fslog.Info(statement)
  44. return count, nil
  45. }
  46. func CheckExistWhere(req *client.CountWhereRequest) (bool, error) {
  47. statement, count, err := dpsClient.CountWhere(req)
  48. if err != nil {
  49. return false, err
  50. }
  51. fslog.Info(statement)
  52. if count <= 0 {
  53. return false, nil
  54. }
  55. return true, nil
  56. }
  57. func CommonCheckExist(req *client.CommonCountRequest) (bool, error) {
  58. statement, count, err := dpsClient.CommonCount(req)
  59. if err != nil {
  60. return false, err
  61. }
  62. fslog.Info(statement)
  63. if count <= 0 {
  64. return false, nil
  65. }
  66. return true, nil
  67. }