rename-product-to-makeplan.ps1 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Rename yudao-module-product to yudao-module-makeplan
  2. # Including folders, packages, API paths, and all references
  3. Write-Host "========================================" -ForegroundColor Cyan
  4. Write-Host "Starting module rename: product -> makeplan" -ForegroundColor Cyan
  5. Write-Host "========================================" -ForegroundColor Cyan
  6. # 1. Rename module folder
  7. Write-Host "`n[1/8] Renaming module folder..." -ForegroundColor Yellow
  8. if (Test-Path "yudao-module-product") {
  9. Rename-Item -Path "yudao-module-product" -NewName "yudao-module-makeplan"
  10. Write-Host "Module folder renamed successfully" -ForegroundColor Green
  11. } else {
  12. Write-Host "yudao-module-product folder not found" -ForegroundColor Red
  13. exit 1
  14. }
  15. # 2. Rename mapper folder
  16. Write-Host "`n[2/8] Renaming mapper folder..." -ForegroundColor Yellow
  17. if (Test-Path "mapper/product") {
  18. Rename-Item -Path "mapper/product" -NewName "mapper/makeplan"
  19. Write-Host "Mapper folder renamed successfully" -ForegroundColor Green
  20. }
  21. # 3. Rename Java package
  22. Write-Host "`n[3/8] Renaming Java package..." -ForegroundColor Yellow
  23. $javaPath = "yudao-module-makeplan/src/main/java/cn/iocoder/yudao/module"
  24. if (Test-Path "$javaPath/product") {
  25. Rename-Item -Path "$javaPath/product" -NewName "makeplan"
  26. Write-Host "Java package renamed successfully" -ForegroundColor Green
  27. }
  28. # 4. Update package references in Java files
  29. Write-Host "`n[4/8] Updating package references in Java files..." -ForegroundColor Yellow
  30. $javaFiles = Get-ChildItem -Path "yudao-module-makeplan" -Filter "*.java" -Recurse
  31. $count = 0
  32. foreach ($file in $javaFiles) {
  33. $content = Get-Content $file.FullName -Raw -Encoding UTF8
  34. $newContent = $content -replace 'cn\.iocoder\.yudao\.module\.product', 'cn.iocoder.yudao.module.makeplan'
  35. if ($content -ne $newContent) {
  36. Set-Content -Path $file.FullName -Value $newContent -Encoding UTF8 -NoNewline
  37. $count++
  38. }
  39. }
  40. Write-Host "Updated $count Java files" -ForegroundColor Green
  41. # 5. Update pom.xml files
  42. Write-Host "`n[5/8] Updating pom.xml files..." -ForegroundColor Yellow
  43. $pomFiles = @(
  44. "pom.xml",
  45. "yudao-module-makeplan/pom.xml"
  46. )
  47. $count = 0
  48. foreach ($pomFile in $pomFiles) {
  49. if (Test-Path $pomFile) {
  50. $content = Get-Content $pomFile -Raw -Encoding UTF8
  51. $newContent = $content -replace 'yudao-module-product', 'yudao-module-makeplan'
  52. $newContent = $newContent -replace '<artifactId>product</artifactId>', '<artifactId>makeplan</artifactId>'
  53. $newContent = $newContent -replace '<module>yudao-module-product</module>', '<module>yudao-module-makeplan</module>'
  54. if ($content -ne $newContent) {
  55. Set-Content -Path $pomFile -Value $newContent -Encoding UTF8 -NoNewline
  56. $count++
  57. }
  58. }
  59. }
  60. Write-Host "Updated $count pom.xml files" -ForegroundColor Green
  61. # 6. Update mapper XML files
  62. Write-Host "`n[6/8] Updating mapper XML files..." -ForegroundColor Yellow
  63. $xmlFiles = Get-ChildItem -Path "yudao-module-makeplan" -Filter "*.xml" -Recurse
  64. $count = 0
  65. foreach ($file in $xmlFiles) {
  66. $content = Get-Content $file.FullName -Raw -Encoding UTF8
  67. $newContent = $content -replace 'cn\.iocoder\.yudao\.module\.product', 'cn.iocoder.yudao.module.makeplan'
  68. $newContent = $newContent -replace 'mapper/product/', 'mapper/makeplan/'
  69. if ($content -ne $newContent) {
  70. Set-Content -Path $file.FullName -Value $newContent -Encoding UTF8 -NoNewline
  71. $count++
  72. }
  73. }
  74. Write-Host "Updated $count XML files" -ForegroundColor Green
  75. # 7. Update frontend API paths
  76. Write-Host "`n[7/8] Updating frontend API paths..." -ForegroundColor Yellow
  77. # Rename frontend API folder
  78. if (Test-Path "yudao-ui/yudao-ui-admin-vue3/src/api/product") {
  79. Rename-Item -Path "yudao-ui/yudao-ui-admin-vue3/src/api/product" -NewName "makeplan"
  80. }
  81. # Update frontend files
  82. $frontendFiles = Get-ChildItem -Path "yudao-ui/yudao-ui-admin-vue3/src" -Include "*.vue","*.ts","*.js" -Recurse
  83. $count = 0
  84. foreach ($file in $frontendFiles) {
  85. $content = Get-Content $file.FullName -Raw -Encoding UTF8
  86. $newContent = $content -replace '@/api/product/', '@/api/makeplan/'
  87. $newContent = $newContent -replace '/product/workorder-schedule', '/makeplan/workorder-schedule'
  88. if ($content -ne $newContent) {
  89. Set-Content -Path $file.FullName -Value $newContent -Encoding UTF8 -NoNewline
  90. $count++
  91. }
  92. }
  93. Write-Host "Updated $count frontend files" -ForegroundColor Green
  94. # 8. Update application config files
  95. Write-Host "`n[8/8] Updating application config files..." -ForegroundColor Yellow
  96. $configFiles = Get-ChildItem -Path "yudao-server/src/main/resources" -Filter "application*.yaml" -Recurse
  97. $count = 0
  98. foreach ($file in $configFiles) {
  99. $content = Get-Content $file.FullName -Raw -Encoding UTF8
  100. $newContent = $content -replace 'yudao\.module\.product', 'yudao.module.makeplan'
  101. $newContent = $newContent -replace 'mapper/product/', 'mapper/makeplan/'
  102. if ($content -ne $newContent) {
  103. Set-Content -Path $file.FullName -Value $newContent -Encoding UTF8 -NoNewline
  104. $count++
  105. }
  106. }
  107. Write-Host "Updated $count config files" -ForegroundColor Green
  108. Write-Host "`n========================================" -ForegroundColor Cyan
  109. Write-Host "Module rename completed!" -ForegroundColor Green
  110. Write-Host "========================================" -ForegroundColor Cyan
  111. Write-Host "`nNext steps:" -ForegroundColor Yellow
  112. Write-Host "1. Run: mvn clean install -DskipTests" -ForegroundColor White
  113. Write-Host "2. Start backend service" -ForegroundColor White
  114. Write-Host "3. Start frontend service" -ForegroundColor White
  115. Write-Host "4. Test work order schedule functionality" -ForegroundColor White