instance_query.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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) ([]client.TableRow, int64, error) {
  7. statement, tableRows, totalCount, err := dpsClient.QueryByWhereAndOrderBy(req)
  8. if err != nil {
  9. return nil, 0, err
  10. }
  11. fslog.Info(statement)
  12. return tableRows, totalCount, nil
  13. }
  14. func CommonQuery(req *client.CommonQueryRequest) ([]client.TableRow, int64, error) {
  15. statement, tableRows, totalCount, err := dpsClient.CommonQuery(req)
  16. if err != nil {
  17. return nil, 0, err
  18. }
  19. fslog.Info(statement)
  20. return tableRows, totalCount, nil
  21. }
  22. func QueryOnlyByWhereAndOrderBy(req *client.QueryByWhereAndOrderByRequest) ([]client.TableRow, error) {
  23. statement, tableRows, err := dpsClient.QueryOnlyByWhereAndOrderBy(req)
  24. if err != nil {
  25. return nil, err
  26. }
  27. fslog.Info(statement)
  28. return tableRows, nil
  29. }
  30. func CommonQueryOnly(req *client.CommonQueryRequest) ([]client.TableRow, error) {
  31. statement, tableRows, err := dpsClient.CommonQueryOnly(req)
  32. if err != nil {
  33. return nil, err
  34. }
  35. fslog.Info(statement)
  36. return tableRows, nil
  37. }
  38. func QueryByKeys(req *client.QueryByKeysRequest) (*client.TableRow, error) {
  39. statement, dataMap, err := dpsClient.QueryByKeys(req)
  40. if err != nil {
  41. return nil, err
  42. }
  43. fslog.Info(statement)
  44. return dataMap, nil
  45. }
  46. func CountWhere(req *client.CountWhereRequest) (int64, error) {
  47. statement, count, err := dpsClient.CountWhere(req)
  48. if err != nil {
  49. return 0, err
  50. }
  51. fslog.Info(statement)
  52. return count, nil
  53. }
  54. func CommonCount(req *client.CommonCountRequest) (int64, error) {
  55. statement, count, err := dpsClient.CommonCount(req)
  56. if err != nil {
  57. return 0, err
  58. }
  59. fslog.Info(statement)
  60. return count, nil
  61. }
  62. func CheckExistWhere(req *client.CountWhereRequest) (bool, error) {
  63. statement, count, err := dpsClient.CountWhere(req)
  64. if err != nil {
  65. return false, err
  66. }
  67. fslog.Info(statement)
  68. if count <= 0 {
  69. return false, nil
  70. }
  71. return true, nil
  72. }
  73. func CommonCheckExist(req *client.CommonCountRequest) (bool, error) {
  74. statement, count, err := dpsClient.CommonCount(req)
  75. if err != nil {
  76. return false, err
  77. }
  78. fslog.Info(statement)
  79. if count <= 0 {
  80. return false, nil
  81. }
  82. return true, nil
  83. }