mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
修复代码生成,更换VerifyJSON绑定
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
"crypto-js": "^4.2.0",
|
||||
"css-color-function": "^1.3.3",
|
||||
"echarts": "^5.5.0",
|
||||
"element-plus": "^2.6.1",
|
||||
"element-plus": "^2.6.2",
|
||||
"highlight.js": "^11.9.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nprogress": "^0.2.0",
|
||||
@@ -59,13 +59,13 @@
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.72.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "~5.4.2",
|
||||
"typescript": "~5.4.3",
|
||||
"unplugin-auto-import": "^0.17.5",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.1.6",
|
||||
"vite": "^5.2.6",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-style-import": "^2.0.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.0.6"
|
||||
"vue-tsc": "^2.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,12 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) List(c *gin.Context) {
|
||||
// @Success 200 {object} []{{{ title (toCamelCase .EntityName) }}}Resp "成功"
|
||||
// @Router /api/admin/{{{ .ModuleName }}}/listAll [get]
|
||||
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ListAll(c *gin.Context) {
|
||||
//var listReq {{{ title (toCamelCase .EntityName) }}}ListReq
|
||||
//if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
// return
|
||||
//}
|
||||
res, err := Service.ListAll()
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
return
|
||||
}
|
||||
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Detail(c *gin.Context)
|
||||
// @Router /api/admin/{{{ .ModuleName }}}/add [post]
|
||||
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Add(c *gin.Context) {
|
||||
var addReq {{{ title (toCamelCase .EntityName) }}}AddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &addReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, Service.Add(addReq))
|
||||
@@ -102,7 +104,7 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Add(c *gin.Context) {
|
||||
// @Router /api/admin/{{{ .ModuleName }}}/edit [post]
|
||||
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Edit(c *gin.Context) {
|
||||
var editReq {{{ title (toCamelCase .EntityName) }}}EditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, Service.Edit(editReq))
|
||||
@@ -120,7 +122,7 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Edit(c *gin.Context) {
|
||||
// @Router /api/admin/{{{ .ModuleName }}}/del [post]
|
||||
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Del(c *gin.Context) {
|
||||
var delReq {{{ title (toCamelCase .EntityName) }}}DelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, Service.Del(delReq.{{{ title (toCamelCase .PrimaryKey) }}}))
|
||||
|
||||
@@ -36,7 +36,7 @@ func {{{ title (toCamelCase .ModuleName) }}}Route(rg *gin.RouterGroup) {
|
||||
rg.GET("/{{{ .ModuleName }}}/detail", handle.Detail)
|
||||
rg.POST("/{{{ .ModuleName }}}/add",middleware.RecordLog("{{{ .FunctionName }}}新增"), handle.Add)
|
||||
rg.POST("/{{{ .ModuleName }}}/edit",middleware.RecordLog("{{{ .FunctionName }}}编辑"), handle.Edit)
|
||||
rg.POST("/{{{ .ModuleName }}}/del", middleware.RecordLog("{{{ .FunctionName }}}删除"), ,handle.Del)
|
||||
rg.POST("/{{{ .ModuleName }}}/del", middleware.RecordLog("{{{ .FunctionName }}}删除"), handle.Del)
|
||||
rg.GET("/{{{ .ModuleName }}}/ExportFile", middleware.RecordLog("{{{ .FunctionName }}}导出"), handle.ExportFile)
|
||||
rg.POST("/{{{ .ModuleName }}}/ImportFile", handle.ImportFile)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"x_admin/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
import "x_admin/core"
|
||||
|
||||
|
||||
type I{{{ title (toCamelCase .EntityName) }}}Service interface {
|
||||
List(page request.PageReq, listReq {{{ title (toCamelCase .EntityName) }}}ListReq) (res response.PageResp, e error)
|
||||
@@ -180,7 +180,7 @@ func (service {{{ toCamelCase .EntityName }}}Service) ExportFile(listReq {{{ tit
|
||||
|
||||
// 数据
|
||||
var objs []model.{{{ title (toCamelCase .EntityName) }}}
|
||||
err = dbModel.Order("id asc").Find(&objs).Error
|
||||
err := dbModel.Order("id asc").Find(&objs).Error
|
||||
if e = response.CheckErr(err, "List Find err"); e != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user