Airport.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #include "Airport.h"
  2. #include "regExp.h"
  3. #include "Dict.h"
  4. #include "AutoCompleteComBoxWidget.h"
  5. #include "CheckComboBoxWidget.h"
  6. #include "charcode.h"
  7. #include "DebugUtil.h"
  8. QX_REGISTER_CPP_USER(Airport)
  9. namespace qx {
  10. template <>
  11. void register_class(QxClass<Airport> & t)
  12. {
  13. qx::IxDataMember * pData = NULL; Q_UNUSED(pData);
  14. qx::IxSqlRelation * pRelation = NULL; Q_UNUSED(pRelation);
  15. qx::IxFunction * pFct = NULL; Q_UNUSED(pFct);
  16. qx::IxValidator * pValidator = NULL; Q_UNUSED(pValidator);
  17. t.setName("T_CM_AIRPORT");
  18. pData = t.id(& Airport::m_ID, "ID", 0);
  19. pData->setDescription("编号");
  20. pData->setAutoIncrement(true);
  21. pData = t.data(& Airport::m_NAME, "NAME", 0, true, true);
  22. pData->setDescription("名称");
  23. pData->setRequired(true);
  24. pData = t.data(& Airport::m_LONGITUDE, "LONGITUDE", 0, true, true);
  25. pData->setDescription("经度");
  26. pData->setMaxValue(180.0);
  27. pData->setMinValue(-180.0);
  28. pData->setPrecision(6); //默认即是6位
  29. pData = t.data(& Airport::m_LATITUDE, "LATITUDE", 0, true, true);
  30. pData->setDescription("纬度");
  31. pData->setMaxValue(90.0);
  32. pData->setMinValue(-90.0);
  33. pData = t.data(& Airport::m_HEIGHT, "HEIGHT", 0, true, true);
  34. pData->setDescription("高度");
  35. pData->setPropertyBag("regExp",REGEXP_DOUBLE(4,2));
  36. pData = t.data(& Airport::m_NATION, "NATION", 0, true, true);
  37. pData->setDescription("国别");
  38. pData->setPropertyBag("dict",Dict::nationDict);
  39. // pData->setPropertyBag("type",AutoCompleteComBoxWidget::type);
  40. pData->setPropertyBag("type",CheckComboBoxWidget::type);
  41. pData = t.data(& Airport::m_ISDELETE, "ISDELETE", 0, true, true);
  42. pData->setDescription("是否删除");
  43. pData->setPropertyBag("notShow",true);
  44. pData->setPropertyBag("notInput",true);
  45. // qx::QxSoftDelete SoftDelete;
  46. // SoftDelete.setColumnName("ISDELETE");
  47. // SoftDelete.setMode(qx::QxSoftDelete::mode_flag);
  48. // t.setSoftDelete(SoftDelete);
  49. pData = t.data(& Airport::m_IMPORTTIME, "IMPORTTIME", 0, true, true);
  50. pData->setDescription("更新时间");
  51. pData->setPropertyBag("notInput",true);
  52. pData->setPropertyBag("notEditAble",true);
  53. pData = t.data(& Airport::m_NOTE, "NOTE", 0, true, true);
  54. pData->setDescription("备注");
  55. qx::QxValidatorX<Airport> * pAllValidator = t.getAllValidator(); Q_UNUSED(pAllValidator);
  56. }
  57. } // namespace qx
  58. Airport::Airport() : m_ID(0.0), m_LONGITUDE(0.0), m_LATITUDE(0.0), m_HEIGHT(0.0) { ; }
  59. Airport::Airport(const double & id) : m_ID(id), m_LONGITUDE(0.0), m_LATITUDE(0.0), m_HEIGHT(0.0) { ; }
  60. Airport::~Airport() { ; }
  61. double Airport::getID() const { return m_ID; }
  62. QString Airport::getNAME() const { return m_NAME; }
  63. double Airport::getLONGITUDE() const { return m_LONGITUDE; }
  64. double Airport::getLATITUDE() const { return m_LATITUDE; }
  65. double Airport::getHEIGHT() const { return m_HEIGHT; }
  66. QString Airport::getNATION() const{ return m_NATION; }
  67. QString Airport::getISDELETE() const { return m_ISDELETE; }
  68. QDateTime Airport::getIMPORTTIME() const { return m_IMPORTTIME; }
  69. QString Airport::getNOTE() const { return m_NOTE; }
  70. void Airport::setID(const double & val) { m_ID = val; }
  71. void Airport::setNAME(const QString & val) { m_NAME = val; }
  72. void Airport::setLONGITUDE(const double & val) { m_LONGITUDE = val; }
  73. void Airport::setLATITUDE(const double & val) { m_LATITUDE = val; }
  74. void Airport::setHEIGHT(const double & val) { m_HEIGHT = val; }
  75. void Airport::setNATION(const QString & val) { m_NATION = val; }
  76. void Airport::setISDELETE(const QString & val) { m_ISDELETE = val; }
  77. void Airport::setIMPORTTIME(const QDateTime & val) { m_IMPORTTIME = val; }
  78. void Airport::setNOTE(const QString & val) { m_NOTE = val; }
  79. void Airport::onBeforeFetch(qx::dao::detail::IxDao_Helper *dao)
  80. {
  81. qDebug() << "onBeforeFetch **********************";
  82. Debug(dao->query().executedQuery());
  83. }
  84. void Airport::onAfterFetch(qx::dao::detail::IxDao_Helper *dao)
  85. {
  86. qDebug() << "onAfterFetch **********************";
  87. Debug(dao->query().executedQuery());
  88. }