@@ -12,7 +12,7 @@ if "%one%" NEQ "" ( | |||
set BasePath="./" | |||
set DBUSER="root" | |||
set DBPSW="Fnuo123com@" | |||
set DBNAME="fnuoos_test1" | |||
set DBNAME="advertisement" | |||
set DBHOST="119.23.182.117" | |||
set DBPORT="3306" | |||
@@ -20,6 +20,6 @@ del "src\models\%Table%.go" | |||
echo start reverse table %Table% | |||
xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/models/ %TName% | |||
xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/model/ %TName% | |||
echo end |
@@ -0,0 +1,23 @@ | |||
@echo off | |||
setlocal | |||
set "BasePath=./" | |||
REM 假设已经提供了文件名作为参数 | |||
set "FileName=%~1" | |||
REM 将参数设置最终文件名 | |||
set "FinalFile=%BasePath%src\super\dao\%FileName%_dao.go" | |||
REM 将文件名转换成大驼峰格式并设置成最终接口名 | |||
for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "InterfaceName=%%i" | |||
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%" | |||
echo Interface file %FileName%_dao.go generated successfully. | |||
endlocal |
@@ -0,0 +1,25 @@ | |||
@echo off | |||
set Table=* | |||
set TName="" | |||
set one=%1 | |||
if "%one%" NEQ "" ( | |||
set Table=%one% | |||
set TName="^%one%$" | |||
) | |||
set BasePath="./" | |||
set DBUSER="root" | |||
set DBPSW="Fnuo123com@" | |||
set DBNAME="super_advertisement" | |||
set DBHOST="119.23.182.117" | |||
set DBPORT="3306" | |||
del "src\models\%Table%.go" | |||
echo start reverse table %Table% | |||
xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/super/model/ %TName% | |||
echo end |
@@ -0,0 +1,23 @@ | |||
@echo off | |||
setlocal | |||
set "BasePath=./" | |||
REM 假设已经提供了文件名作为参数 | |||
set "FileName=%~1" | |||
REM 将参数设置最终文件名 | |||
set "FinalFile=%BasePath%src\super\implement\%FileName%_db.go" | |||
REM 将文件名转换成大驼峰格式并设置成最终实现类名 | |||
for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i" | |||
REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码 | |||
powershell -Command "(Get-Content '%BasePath%etc\template\template_implement.tpl') -replace 'DemoImplement', '%ImplementName%' | Out-File -FilePath '%BasePath%temp_implement.go' -Encoding UTF8" | |||
REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N) | |||
move /Y "%BasePath%temp_implement.go" "%FinalFile%" | |||
echo Implement file %FileName%_dao.go generated successfully. | |||
endlocal |
@@ -0,0 +1,16 @@ | |||
package dao | |||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
type AgentBankInfoDao interface { | |||
GetAgentBankInfoList(agentId int) (medium *model.AgentBankInfo, err error) | |||
FindAgentBankInfoList(name, state string, page, limit int) (list []AgentBankInfoGroup, total int64, err error) | |||
} | |||
type AgentBankInfoGroup struct { | |||
model.AgentList `xorm:"extends"` | |||
model.AgentBankInfo `xorm:"extends"` | |||
} | |||
func (AgentBankInfoGroup) TableName() string { | |||
return "agent_bank_info" | |||
} |
@@ -0,0 +1,16 @@ | |||
package dao | |||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
type AgentContactInfoDao interface { | |||
GetAgentContactInfoList(agentId int) (medium *model.AgentContactInfo, err error) | |||
FindAgentContactInfoList(name, state string, page, limit int) (list []AgentContactInfoGroup, total int64, err error) | |||
} | |||
type AgentContactInfoGroup struct { | |||
model.AgentList `xorm:"extends"` | |||
model.AgentContactInfo `xorm:"extends"` | |||
} | |||
func (AgentContactInfoGroup) TableName() string { | |||
return "agent_contact_info" | |||
} |
@@ -0,0 +1,16 @@ | |||
package dao | |||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
type MediumBankInfoDao interface { | |||
GetMediumBankInfoList(MediumId int) (medium *model.MediumBankInfo, err error) | |||
FindMediumBankInfoList(name, state string, page, limit int) (list []MediumBankInfoGroup, total int64, err error) | |||
} | |||
type MediumBankInfoGroup struct { | |||
model.MediumList `xorm:"extends"` | |||
model.MediumBankInfo `xorm:"extends"` | |||
} | |||
func (MediumBankInfoGroup) TableName() string { | |||
return "medium_bank_info" | |||
} |
@@ -0,0 +1,16 @@ | |||
package dao | |||
import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
type MediumContactInfoDao interface { | |||
GetMediumContactInfoList(MediumId int) (medium *model.MediumContactInfo, err error) | |||
FindMediumContactInfoList(name, state string, page, limit int) (list []MediumContactInfoGroup, total int64, err error) | |||
} | |||
type MediumContactInfoGroup struct { | |||
model.MediumList `xorm:"extends"` | |||
model.MediumContactInfo `xorm:"extends"` | |||
} | |||
func (MediumContactInfoGroup) TableName() string { | |||
return "medium_contact_info" | |||
} |
@@ -0,0 +1,43 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | |||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | |||
"xorm.io/xorm" | |||
) | |||
func NewAgentBankInfoDb(engine *xorm.Engine) dao.AgentBankInfoDao { | |||
return &AgentBankInfoDb{Db: engine} | |||
} | |||
type AgentBankInfoDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (a AgentBankInfoDb) GetAgentBankInfoList(agentId int) (medium *model.AgentBankInfo, err error) { | |||
medium = new(model.AgentBankInfo) | |||
has, err := a.Db.Where("agent_id =?", agentId).Get(medium) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return medium, nil | |||
} | |||
func (a AgentBankInfoDb) FindAgentBankInfoList(name, state string, page, limit int) (list []dao.AgentBankInfoGroup, total int64, err error) { | |||
sess := a.Db.Where("agent_bank_info.state>0").Desc("agent_bank_info.id").Limit(limit, (page-1)*limit) | |||
if name != "" { | |||
sess.And("agent_list.company_name like ?", "%"+name+"%") | |||
} | |||
if state != "" { | |||
sess.And("agent_bank_info.state = ?", state) | |||
} | |||
sess.Join("LEFT", "agent_list", "agent_list.agent_id = agent_bank_info.agent_id") | |||
total, err = sess.FindAndCount(&list) | |||
if err != nil { | |||
return nil, 0, err | |||
} | |||
return | |||
} |
@@ -0,0 +1,43 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | |||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | |||
"xorm.io/xorm" | |||
) | |||
func NewAgentContactInfoDb(engine *xorm.Engine) dao.AgentContactInfoDao { | |||
return &AgentContactInfoDb{Db: engine} | |||
} | |||
type AgentContactInfoDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (a AgentContactInfoDb) GetAgentContactInfoList(agentId int) (medium *model.AgentContactInfo, err error) { | |||
medium = new(model.AgentContactInfo) | |||
has, err := a.Db.Where("agent_id =?", agentId).Get(medium) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return medium, nil | |||
} | |||
func (a AgentContactInfoDb) FindAgentContactInfoList(name, state string, page, limit int) (list []dao.AgentContactInfoGroup, total int64, err error) { | |||
sess := a.Db.Where("agent_contact_info.state>0").Desc("agent_contact_info.id").Limit(limit, (page-1)*limit) | |||
if name != "" { | |||
sess.And("agent_list.company_name like ?", "%"+name+"%") | |||
} | |||
if state != "" { | |||
sess.And("agent_contact_info.state = ?", state) | |||
} | |||
sess.Join("LEFT", "agent_list", "agent_list.agent_id = agent_contact_info.agent_id") | |||
total, err = sess.FindAndCount(&list) | |||
if err != nil { | |||
return nil, 0, err | |||
} | |||
return | |||
} |
@@ -0,0 +1,43 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | |||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | |||
"xorm.io/xorm" | |||
) | |||
func NewMediumBankInfoDb(engine *xorm.Engine) dao.MediumBankInfoDao { | |||
return &MediumBankInfoDb{Db: engine} | |||
} | |||
type MediumBankInfoDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (a MediumBankInfoDb) GetMediumBankInfoList(MediumId int) (medium *model.MediumBankInfo, err error) { | |||
medium = new(model.MediumBankInfo) | |||
has, err := a.Db.Where("medium_id =?", MediumId).Get(medium) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return medium, nil | |||
} | |||
func (a MediumBankInfoDb) FindMediumBankInfoList(name, state string, page, limit int) (list []dao.MediumBankInfoGroup, total int64, err error) { | |||
sess := a.Db.Where("medium_bank_info.state>0").Desc("medium_bank_info.id").Limit(limit, (page-1)*limit) | |||
if name != "" { | |||
sess.And("medium_list.company_name like ?", "%"+name+"%") | |||
} | |||
if state != "" { | |||
sess.And("medium_bank_info.state = ?", state) | |||
} | |||
sess.Join("LEFT", "medium_list", "medium_list.medium_id = medium_bank_info.medium_id") | |||
total, err = sess.FindAndCount(&list) | |||
if err != nil { | |||
return nil, 0, err | |||
} | |||
return | |||
} |
@@ -0,0 +1,43 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | |||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | |||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | |||
"xorm.io/xorm" | |||
) | |||
func NewMediumContactInfoDb(engine *xorm.Engine) dao.MediumContactInfoDao { | |||
return &MediumContactInfoDb{Db: engine} | |||
} | |||
type MediumContactInfoDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (a MediumContactInfoDb) GetMediumContactInfoList(MediumId int) (medium *model.MediumContactInfo, err error) { | |||
medium = new(model.MediumContactInfo) | |||
has, err := a.Db.Where("medium_id =?", MediumId).Get(medium) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return medium, nil | |||
} | |||
func (a MediumContactInfoDb) FindMediumContactInfoList(name, state string, page, limit int) (list []dao.MediumContactInfoGroup, total int64, err error) { | |||
sess := a.Db.Where("medium_contact_info.state>0").Desc("medium_contact_info.id").Limit(limit, (page-1)*limit) | |||
if name != "" { | |||
sess.And("medium_list.company_name like ?", "%"+name+"%") | |||
} | |||
if state != "" { | |||
sess.And("medium_contact_info.state = ?", state) | |||
} | |||
sess.Join("LEFT", "medium_list", "medium_list.medium_id = medium_contact_info.medium_id") | |||
total, err = sess.FindAndCount(&list) | |||
if err != nil { | |||
return nil, 0, err | |||
} | |||
return | |||
} |
@@ -0,0 +1,20 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type AgentBankInfo struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` | |||
AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` | |||
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` | |||
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` | |||
CurrencyConf int `json:"currency_conf" xorm:"default 0 comment('结算币种 1人民币') TINYINT(1)"` | |||
Bank string `json:"bank" xorm:"comment('开户银行') VARCHAR(255)"` | |||
BankBranch string `json:"bank_branch" xorm:"comment('开户银行分行') VARCHAR(255)"` | |||
BankNo string `json:"bank_no" xorm:"comment('银行卡号') VARCHAR(255)"` | |||
Licence string `json:"licence" xorm:"comment('开户许可证') VARCHAR(255)"` | |||
} |
@@ -0,0 +1,19 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type AgentContactInfo struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` | |||
AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` | |||
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` | |||
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` | |||
Name string `json:"name" xorm:"comment('联系人') VARCHAR(255)"` | |||
Email string `json:"email" xorm:"comment('邮箱地址') VARCHAR(255)"` | |||
Phone string `json:"phone" xorm:"comment('联系电话') VARCHAR(255)"` | |||
Address string `json:"address" xorm:"comment('联系地址') VARCHAR(255)"` | |||
} |
@@ -0,0 +1,20 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type MediumBankInfo struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` | |||
MediumId int `json:"medium_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` | |||
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` | |||
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` | |||
CurrencyConf int `json:"currency_conf" xorm:"default 0 comment('结算币种 1人民币') TINYINT(1)"` | |||
Bank string `json:"bank" xorm:"comment('开户银行') VARCHAR(255)"` | |||
BankBranch string `json:"bank_branch" xorm:"comment('开户银行分行') VARCHAR(255)"` | |||
BankNo string `json:"bank_no" xorm:"comment('银行卡号') VARCHAR(255)"` | |||
Licence string `json:"licence" xorm:"comment('开户许可证') VARCHAR(255)"` | |||
} |
@@ -0,0 +1,19 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type MediumContactInfo struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` | |||
MediumId int `json:"medium_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` | |||
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` | |||
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"` | |||
Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` | |||
Name string `json:"name" xorm:"comment('联系人') VARCHAR(255)"` | |||
Email string `json:"email" xorm:"comment('邮箱地址') VARCHAR(255)"` | |||
Phone string `json:"phone" xorm:"comment('联系电话') VARCHAR(255)"` | |||
Address string `json:"address" xorm:"comment('联系地址') VARCHAR(255)"` | |||
} |