二钢通用构造模型方法.txt.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. -- 定义字段
  2. select 'private ' || case
  3. when a.data_type like '%CHAR%' then
  4. 'string'
  5. when a.data_type like '%DATE%' then
  6. 'DateTime'
  7. when a.data_type like '%TIME%' then
  8. 'DateTime'
  9. when a.data_type like '%NUM%' then
  10. 'double'
  11. when a.data_type like '%LONG%' then
  12. 'double'
  13. when a.data_type like '%FLOA%' then
  14. 'double'
  15. when a.data_type like '%DECIMAL%' then
  16. 'double'
  17. when a.data_type like 'INTEGER' then
  18. 'int'
  19. when a.data_type like 'TIME' then
  20. 'DateTime'
  21. else
  22. 'string'
  23. end || ' _' || a.column_name || ';'
  24. from user_tab_columns a
  25. where a.table_name = 'RTD_POINTCCM1NO1'
  26. order by a.column_id asc;
  27. -- 设置属性值
  28. select 'public ' || case
  29. when a.data_type like '%CHAR%' then
  30. 'string'
  31. when a.data_type like '%DATE%' then
  32. 'DateTime'
  33. when a.data_type like '%TIME%' then
  34. 'DateTime'
  35. when a.data_type like '%NUM%' then
  36. 'double'
  37. when a.data_type like '%LONG%' then
  38. 'double'
  39. when a.data_type like '%FLOA%' then
  40. 'double'
  41. when a.data_type like '%DECIMAL%' then
  42. 'double'
  43. when a.data_type like 'INTEGER' then
  44. 'int'
  45. when a.data_type like 'TIME' then
  46. 'DateTime'
  47. else
  48. 'string'
  49. end || ' ' || a.column_name || '' || ' { get { return this._' ||
  50. a.column_name || ';}' || ' set {this._' || a.column_name ||
  51. ' = value;}}'
  52. from user_tab_columns a
  53. where a.table_name = 'RTD_POINTCCM1NO1'
  54. order by a.column_id asc;
  55. select 'try{ Ccm1No1.' || a.column_name || ' = ' || '' || case
  56. when a.data_type like '%CHAR%' then
  57. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToString'
  58. when a.data_type like '%DATE%' then
  59. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvertToDateTime'
  60. when a.data_type like '%TIME%' then
  61. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvertToDateTime'
  62. when a.data_type like '%NUM%' then
  63. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToDouble'
  64. when a.data_type like '%LONG%' then
  65. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToDouble'
  66. when a.data_type like '%FLOAT%' then
  67. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToDouble'
  68. when a.data_type like '%DECIMAL%' then
  69. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToDouble'
  70. when a.data_type like 'INTEGER' then
  71. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToInt32'
  72. else
  73. 'Core.Mes.Client.Common.Util.LgConvertUtil.ConvetToString'
  74. end || '(' || 'dr[' || '"' || a.column_name || '"' || ']);' || '}' ||
  75. ' catch {}'
  76. from user_tab_columns a
  77. where a.table_name = 'RTD_POINTCCM1NO1'
  78. order by a.column_id asc