Browse Source

update

master
dengbiao 5 months ago
parent
commit
73ed64bdba
5 changed files with 29 additions and 4 deletions
  1. +2
    -2
      README.md
  2. +20
    -0
      cmd_dao.bat
  3. +1
    -1
      cmd_db.bat
  4. +5
    -0
      etc/template/template_interface.tpl
  5. +1
    -1
      src/implement/happy_orchard_reward_exchange_records_db.go

+ 2
- 2
README.md View File

@@ -40,5 +40,5 @@
确保安装了所需的依赖,然后运行以下命令:

```bash
pip install -r requirements.txt
python main.py
.\cmd_db.bat HelloWorld
.\cmd_dao.bat HelloWorld

+ 20
- 0
cmd_dao.bat View File

@@ -0,0 +1,20 @@
@echo off
setlocal

set "BasePath=./"

REM 假设已经提供了接口名作为参数
set "InterfaceName=%~1"

REM 将接口名转换为小写并设置最终文件名
for /f "delims=" %%i in ('powershell -Command "('%InterfaceName%').ToLower()"') do set "LowerInterfaceName=%%i"
set "FinalFile=%BasePath%src\dao\%LowerInterfaceName%_dao.go"

REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码
powershell -Command "(Get-Content '%BasePath%etc\template\template_interface.tpl') -replace 'DemoInterface', '%InterfaceName%' | Out-File -FilePath '%BasePath%temp_interface.go' -Encoding UTF8"

REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N)
move /Y "%BasePath%temp_interface.go" "%FinalFile%"

endlocal
echo Interface file %LowerInterfaceName%_dao.go generated successfully.

+ 1
- 1
cmd_db.bat View File

@@ -16,7 +16,7 @@ set DBNAME="fnuoos_test1"
set DBHOST="119.23.182.117"
set DBPORT="3306"

del "app\db\model\%Table%.go"
del "src\models\%Table%.go"

echo start reverse table %Table%



+ 5
- 0
etc/template/template_interface.tpl View File

@@ -0,0 +1,5 @@
package dao

type DemoInterfaceDao interface {
//TODO:: You can add specific method definitions here
}

+ 1
- 1
src/implement/happy_orchard_reward_exchange_records_db.go View File

@@ -11,7 +11,7 @@ type happyOrchardRewardExchangeRecordsDb struct {
Db *xorm.Engine
}

func NewHappyOrchardRewardExchangeRecordsDb(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
func NewHappyOrchardRewardExchangeRecordsDb123456(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
return &happyOrchardRewardExchangeRecordsDb{Db: engine}
}



Loading…
Cancel
Save