sysStationLogic_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package test
  2. import (
  3. "git.rtzhtech.cn/iss/public-lib/dto"
  4. "git.rtzhtech.cn/iss/public-lib/logic"
  5. "git.rtzhtech.cn/iss/public-lib/model"
  6. "testing"
  7. )
  8. func TestSaveStation(t *testing.T) {
  9. md := logic.NewSysStationLogic()
  10. req := new(model.SysStation)
  11. req.Name = "name"
  12. req.Address = "address"
  13. req.Province = "province"
  14. req.Region = "region"
  15. req.Stationdesc = "desc"
  16. req.Stationid = 2
  17. err := md.SaveSysStation(req)
  18. if err != nil {
  19. t.Error(err)
  20. }
  21. }
  22. func TestSaveStationMap(t *testing.T) {
  23. md := logic.NewSysStationLogic()
  24. req := map[string]any{
  25. "name": "name2",
  26. "address": "address2",
  27. "province": "province2",
  28. "region": "region2",
  29. "stationdesc": "stationdesc2",
  30. "stationid": "3",
  31. }
  32. err := md.SaveSysStationMap(req)
  33. if err != nil {
  34. t.Error(err)
  35. }
  36. }
  37. func TestDelStation(t *testing.T) {
  38. md := logic.NewSysStationLogic()
  39. err := md.DelSysStation(2)
  40. if err != nil {
  41. t.Error(err)
  42. }
  43. }
  44. func TestGetStation(t *testing.T) {
  45. md := logic.NewSysStationLogic()
  46. req := new(dto.GetSysStationRequest)
  47. req.Page = 1
  48. req.Limit = 22
  49. list, err := md.GetSysStation(req)
  50. if err != nil {
  51. t.Error(err)
  52. }
  53. for _, val := range list.List {
  54. t.Log(val)
  55. }
  56. }