Commit 940bbe80 authored by honghuiliu's avatar honghuiliu 💬

日常提交

parent 3d013f62
package admin
type ApiGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
QshToiletApi
QshPartolApi
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type QshPartolApi struct {
}
var qshPartolService = service.ServiceGroupApp.AdminServiceGroup.QshPartolService
// CreateQshPartol 创建QshPartol
// @Tags QshPartol
// @Summary 创建QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshPartol true "创建QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshPartol/createQshPartol [post]
func (qshPartolApi *QshPartolApi) CreateQshPartol(c *gin.Context) {
var qshPartol admin.QshPatrol
_ = c.ShouldBindJSON(&qshPartol)
if err := qshPartolService.CreateQshPartol(qshPartol); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteQshPartol 删除QshPartol
// @Tags QshPartol
// @Summary 删除QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshPartol true "删除QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshPartol/deleteQshPartol [delete]
func (qshPartolApi *QshPartolApi) DeleteQshPartol(c *gin.Context) {
var qshPartol admin.QshPatrol
_ = c.ShouldBindJSON(&qshPartol)
if err := qshPartolService.DeleteQshPartol(qshPartol); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// DeleteQshPartolByIds 批量删除QshPartol
// @Tags QshPartol
// @Summary 批量删除QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /qshPartol/deleteQshPartolByIds [delete]
func (qshPartolApi *QshPartolApi) DeleteQshPartolByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := qshPartolService.DeleteQshPartolByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateQshPartol 更新QshPartol
// @Tags QshPartol
// @Summary 更新QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshPartol true "更新QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshPartol/updateQshPartol [put]
func (qshPartolApi *QshPartolApi) UpdateQshPartol(c *gin.Context) {
var qshPartol admin.QshPatrol
_ = c.ShouldBindJSON(&qshPartol)
if err := qshPartolService.UpdateQshPartol(qshPartol); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindQshPartol 用id查询QshPartol
// @Tags QshPartol
// @Summary 用id查询QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query admin.QshPartol true "用id查询QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshPartol/findQshPartol [get]
func (qshPartolApi *QshPartolApi) FindQshPartol(c *gin.Context) {
var qshPartol admin.QshPatrol
_ = c.ShouldBindQuery(&qshPartol)
if reqshPartol, err := qshPartolService.GetQshPartol(qshPartol.ID); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"reqshPartol": reqshPartol}, c)
}
}
// GetQshPartolList 分页获取QshPartol列表
// @Tags QshPartol
// @Summary 分页获取QshPartol列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query adminReq.QshPartolSearch true "分页获取QshPartol列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshPartol/getQshPartolList [get]
func (qshPartolApi *QshPartolApi) GetQshPartolList(c *gin.Context) {
var pageInfo adminReq.QshPartolSearch
_ = c.ShouldBindQuery(&pageInfo)
if list, total, err := qshPartolService.GetQshPartolInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type QshToiletApi struct {
}
var qshToiletService = service.ServiceGroupApp.AdminServiceGroup.QshToiletService
// CreateQshToilet 创建QshToilet
// @Tags QshToilet
// @Summary 创建QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshToilet true "创建QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshToilet/createQshToilet [post]
func (qshToiletApi *QshToiletApi) CreateQshToilet(c *gin.Context) {
var qshToilet admin.QshToilet
_ = c.ShouldBindJSON(&qshToilet)
if err := qshToiletService.CreateQshToilet(qshToilet); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteQshToilet 删除QshToilet
// @Tags QshToilet
// @Summary 删除QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshToilet true "删除QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshToilet/deleteQshToilet [delete]
func (qshToiletApi *QshToiletApi) DeleteQshToilet(c *gin.Context) {
var qshToilet admin.QshToilet
_ = c.ShouldBindJSON(&qshToilet)
if err := qshToiletService.DeleteQshToilet(qshToilet); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// DeleteQshToiletByIds 批量删除QshToilet
// @Tags QshToilet
// @Summary 批量删除QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /qshToilet/deleteQshToiletByIds [delete]
func (qshToiletApi *QshToiletApi) DeleteQshToiletByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := qshToiletService.DeleteQshToiletByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateQshToilet 更新QshToilet
// @Tags QshToilet
// @Summary 更新QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshToilet true "更新QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshToilet/updateQshToilet [put]
func (qshToiletApi *QshToiletApi) UpdateQshToilet(c *gin.Context) {
var qshToilet admin.QshToilet
_ = c.ShouldBindJSON(&qshToilet)
if err := qshToiletService.UpdateQshToilet(qshToilet); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindQshToilet 用id查询QshToilet
// @Tags QshToilet
// @Summary 用id查询QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query admin.QshToilet true "用id查询QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshToilet/findQshToilet [get]
func (qshToiletApi *QshToiletApi) FindQshToilet(c *gin.Context) {
var qshToilet admin.QshToilet
_ = c.ShouldBindQuery(&qshToilet)
if reqshToilet, err := qshToiletService.GetQshToilet(qshToilet.ID); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"reqshToilet": reqshToilet}, c)
}
}
// GetQshToiletList 分页获取QshToilet列表
// @Tags QshToilet
// @Summary 分页获取QshToilet列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query adminReq.QshToiletSearch true "分页获取QshToilet列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshToilet/getQshToiletList [get]
func (qshToiletApi *QshToiletApi) GetQshToiletList(c *gin.Context) {
var pageInfo adminReq.QshToiletSearch
_ = c.ShouldBindQuery(&pageInfo)
if list, total, err := qshToiletService.GetQshToiletInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
package v1 package v1
import ( import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/admin"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/example" "github.com/flipped-aurora/gin-vue-admin/server/api/v1/example"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/system" "github.com/flipped-aurora/gin-vue-admin/server/api/v1/system"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/web"
) )
type ApiGroup struct { type ApiGroup struct {
SystemApiGroup system.ApiGroup SystemApiGroup system.ApiGroup
ExampleApiGroup example.ApiGroup ExampleApiGroup example.ApiGroup
AdminApiGroup admin.ApiGroup
WebApiGroup web.ApiGroup
} }
var ApiGroupApp = new(ApiGroup) var ApiGroupApp = new(ApiGroup)
package web
type ApiGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package web
import (
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"time"
)
var (
userService = service.ServiceGroupApp.SystemServiceGroup.UserService
loginService = service.ServiceGroupApp.WebServiceGroup.LoginService
)
func Login(c *gin.Context) {
var l request.Login
_ = c.ShouldBindJSON(&l)
if err := utils.Verify(l, utils.LoginVerify); err != nil {
response.FailWithMessage(err.Error(), c)
return
}
u := &system.SysUser{Username: l.Username, Password: l.Password}
key := ghelp.Md5(ghelp.CreateUnique())
prefixKey := "qsh_wc:" + key
if user, err := userService.Login(u); err != nil {
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
response.FailWithMessage("用户名不存在或者密码错误", c)
} else {
if user.Enable != 1 {
global.GVA_LOG.Error("登陆失败! 用户被禁止登录!")
response.FailWithMessage("用户被禁止登录", c)
return
}
value := ghelp.MAP{
"user_id": user.ID,
}
if err = global.GVA_REDIS.Set(c, prefixKey, ghelp.JsonEncode(value), 86400*time.Second).Err(); err != nil {
response.FailWithMessage("登录失败,请联系管理人员!", c)
return
}
response.OkWithData(key, c)
}
}
package web
import (
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
)
var patrolService = service.ServiceGroupApp.WebServiceGroup.PatrolService
//GetPatrolList 获取工单列表
func GetPatrolList(c *gin.Context) {
var arg request.PatrolList
_ = c.ShouldBindJSON(&arg)
if list, total, err := patrolService.GetPatrolList(arg); err != nil {
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithData(ghelp.MAP{
"list": list,
"total": total,
}, c)
}
}
func GetPatrolDetail(c *gin.Context) {
var arg request.GetPatrolId
_ = c.ShouldBindJSON(&arg)
//patrolService.GetPatrolDetail(arg)
}
package web
import (
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
)
var toiletService = service.ServiceGroupApp.WebServiceGroup.ToiletService
//GetToiletList 公厕点位列表
func GetToiletList(c *gin.Context) {
var toilet request.Toilet
_ = c.ShouldBindJSON(&toilet)
if list, total, err := toiletService.GetToiletList(toilet); err != nil {
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithData(ghelp.MAP{
"list": list,
"total": total,
}, c)
}
}
//GetToiletDetail 公厕点位详情
func GetToiletDetail(c *gin.Context) {
var arg request.GetId
_ = c.ShouldBindJSON(&arg)
if data, err := toiletService.GetToiletDetail(arg); err != nil {
response.FailWithMessage(err.Error(), c)
} else {
response.OkWithData(data, c)
}
}
...@@ -119,8 +119,8 @@ qiniu: ...@@ -119,8 +119,8 @@ qiniu:
use-cdn-domains: false use-cdn-domains: false
redis: redis:
db: 0 db: 0
addr: 127.0.0.1:6379 addr: "r-bp1cm5ncyvq2hnul81pd.redis.rds.aliyuncs.com:16379"
password: "" password: "rRk2k3nf9JJi283lk119Jvwz"
system: system:
env: public env: public
addr: 8888 addr: 8888
...@@ -157,4 +157,4 @@ zap: ...@@ -157,4 +157,4 @@ zap:
stacktrace-key: stacktrace stacktrace-key: stacktrace
max-age: 30 max-age: 30
show-line: true show-line: true
log-in-console: true log-in-console: true
\ No newline at end of file
...@@ -3,6 +3,7 @@ module github.com/flipped-aurora/gin-vue-admin/server ...@@ -3,6 +3,7 @@ module github.com/flipped-aurora/gin-vue-admin/server
go 1.16 go 1.16
require ( require (
gitee.com/zjlsliupei/ghelp v0.0.16 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible
github.com/aws/aws-sdk-go v1.42.27 github.com/aws/aws-sdk-go v1.42.27
......
...@@ -11,6 +11,8 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl ...@@ -11,6 +11,8 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gitee.com/zjlsliupei/ghelp v0.0.16 h1:JxWyobPGvO1YvLCVUn/+XGuRmn0N6aRtTdp0EohYFhU=
gitee.com/zjlsliupei/ghelp v0.0.16/go.mod h1:fap1kgFXS7J+dYdwyOy146v2FLdsg2QSwnzH4/dwm24=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
...@@ -465,6 +467,8 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG ...@@ -465,6 +467,8 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/model/example" "github.com/flipped-aurora/gin-vue-admin/server/model/example"
"github.com/flipped-aurora/gin-vue-admin/server/model/system" "github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"go.uber.org/zap" "go.uber.org/zap"
"gorm.io/gorm" "gorm.io/gorm"
) )
...@@ -52,6 +53,8 @@ func RegisterTables(db *gorm.DB) { ...@@ -52,6 +53,8 @@ func RegisterTables(db *gorm.DB) {
// 自动化模块表 // 自动化模块表
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT. // Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
admin.QshToilet{},
admin.QshPatrol{},
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT. // Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
) )
if err != nil { if err != nil {
......
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
func Routers() *gin.Engine { func Routers() *gin.Engine {
Router := gin.Default() Router := gin.Default()
adminRouter := router.RouterGroupApp.Admin
systemRouter := router.RouterGroupApp.System systemRouter := router.RouterGroupApp.System
exampleRouter := router.RouterGroupApp.Example exampleRouter := router.RouterGroupApp.Example
// 如果想要不使用nginx代理前端网页,可以修改 web/.env.production 下的 // 如果想要不使用nginx代理前端网页,可以修改 web/.env.production 下的
...@@ -71,11 +72,13 @@ func Routers() *gin.Engine { ...@@ -71,11 +72,13 @@ func Routers() *gin.Engine {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT. // Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
adminRouter.InitQshToiletRouter(PrivateGroup)
adminRouter.InitQshPartolRouter(PrivateGroup)
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT. // Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
} }
InstallPlugin(Router) // 安装插件 InstallPlugin(Router) // 安装插件
router.InitWebRouter(Router)
global.GVA_LOG.Info("router register success") global.GVA_LOG.Info("router register success")
return Router return Router
} }
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:35:22.359 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 net.Listen error: listen tcp :8888: bind: address already in use [github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:35:22.359 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 net.Listen error: listen tcp :8888: bind: address already in use
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:32:11.666 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:40:21.244 error /Users/honghuiliu/go/project/qsh-wc/server/api/v1/system/sys_dictionary.go:27 创建失败! {"error": "存在相同的type,不允许创建"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:42:33.362 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:47:54.232 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
...@@ -5,3 +5,15 @@ ...@@ -5,3 +5,15 @@
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:40:44.283 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:79 router register success [github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:40:44.283 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:79 router register success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:40:44.283 info /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:36 server run success on {"address": ":8888"} [github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 10:40:44.283 info /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:36 server run success on {"address": ":8888"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 11:10:36.843 info /Users/honghuiliu/go/project/qsh-wc/server/api/v1/system/sys_initdb.go:57 前往初始化数据库 [github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 11:10:36.843 info /Users/honghuiliu/go/project/qsh-wc/server/api/v1/system/sys_initdb.go:57 前往初始化数据库
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:33:21.225 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/gorm.go:61 register table success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:33:21.243 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:37 register swagger handler
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:33:21.245 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:79 router register success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:33:21.245 info /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:36 server run success on {"address": ":8888"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:43:42.498 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/gorm.go:64 register table success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:43:42.518 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:38 register swagger handler
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:43:42.520 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:82 router register success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:43:42.520 info /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:36 server run success on {"address": ":8888"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:49:02.795 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/gorm.go:64 register table success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:49:02.812 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:38 register swagger handler
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:49:02.825 info /Users/honghuiliu/go/project/qsh-wc/server/initialize/router.go:82 router register success
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/30 - 16:49:02.825 info /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:36 server run success on {"address": ":8888"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 08:15:27.253 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 09:58:25.756 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:04:29.697 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:10:59.531 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:43:34.820 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:52:09.155 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:53:05.508 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:59:18.052 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:59:25.971 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 10:59:47.307 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 11:05:15.073 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 11:06:27.219 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 11:07:10.441 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 11:07:50.134 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/08/31 - 11:10:57.128 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
This diff is collapsed.
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:26:48.524 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:33:10.415 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:35:17.216 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:36:06.861 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:36:57.714 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:37:40.723 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:37:51.342 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:40:10.894 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:41:39.825 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:42:38.252 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 08:46:02.801 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 09:11:10.289 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 10:29:23.591 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 net.Listen error: listen tcp :8888: bind: address already in use
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 10:32:48.771 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 net.Listen error: listen tcp :8888: bind: address already in use
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 16:19:50.487 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 16:34:20.062 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
[github.com/flipped-aurora/gin-vue-admin/server]2022/09/01 - 16:59:50.208 error /Users/honghuiliu/go/project/qsh-wc/server/core/server.go:48 accept tcp [::]:8888: use of closed network connection
This diff is collapsed.
...@@ -24,6 +24,7 @@ func main() { ...@@ -24,6 +24,7 @@ func main() {
global.GVA_LOG = core.Zap() // 初始化zap日志库 global.GVA_LOG = core.Zap() // 初始化zap日志库
zap.ReplaceGlobals(global.GVA_LOG) zap.ReplaceGlobals(global.GVA_LOG)
global.GVA_DB = initialize.Gorm() // gorm连接数据库 global.GVA_DB = initialize.Gorm() // gorm连接数据库
initialize.Redis()
initialize.Timer() initialize.Timer()
initialize.DBList() initialize.DBList()
if global.GVA_DB != nil { if global.GVA_DB != nil {
......
package middleware
import (
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin"
"github.com/songzhibin97/gkit/tools/gjson"
)
var exCheck = []string{"/web/login/login"}
func Token() gin.HandlerFunc {
return func(c *gin.Context) {
act := c.Request.URL.Path
if ghelp.InArray(act, exCheck) {
c.Next()
return
}
token := c.Query("access_token")
if token == "" {
response.Result(1000, "", "token不存在", c)
c.Abort()
return
}
res := global.GVA_REDIS.Get(c, "qsh_wc:"+token)
if res.Err() != nil {
response.Result(1000, "", "token不存在", c)
c.Abort()
return
}
c.Set("user_id", gjson.Get(res.Val(), "user_id").Int())
c.Next()
}
}
// 自动生成模板QshPartol
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// QshPartol 结构体
type QshPatrol struct {
global.GVA_MODEL
Content string `json:"content" form:"content" gorm:"column:content;comment:巡检内容;"`
Description string `json:"description" form:"description" gorm:"column:description;comment:异常描述;size:300;"`
Image string `json:"image" form:"image" gorm:"column:image;comment:巡检图片多个逗号分隔;"`
PartolName string `json:"partolName" form:"partolName" gorm:"column:partol_name;comment:巡视人;size:255;"`
Title string `json:"title" form:"title" gorm:"column:title;comment:工单标题;size:255;"`
ToiletId *int `json:"toiletId" form:"toiletId" gorm:"column:toilet_id;comment:巡检公厕;size:10;"`
Type *int `json:"type" form:"type" gorm:"column:type;comment:巡检类型 1=>一体化设备 2=>玻璃钢;"`
}
// TableName QshPartol 表名
func (QshPatrol) TableName() string {
return "qsh_patrol"
}
// 自动生成模板QshToilet
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// QshToilet 结构体
type QshToilet struct {
global.GVA_MODEL
Address string `json:"address" form:"address" gorm:"column:address;comment:公厕地址;size:255;"`
Image string `json:"image" form:"image" gorm:"column:image;comment:点位图片;size:5000;"`
Lat string `json:"lat" form:"lat" gorm:"column:lat;comment:纬度;size:255;"`
Lng string `json:"lng" form:"lng" gorm:"column:lng;comment:经度;size:255;"`
Manager string `json:"manager" form:"manager" gorm:"column:manager;comment:管理人员;size:200;"`
ManagerPhone string `json:"managerPhone" form:"managerPhone" gorm:"column:manager_phone;comment:管理员联系电话;size:100;"`
Monitor string `json:"monitor" form:"monitor" gorm:"column:monitor;comment:监控信息;size:255;"`
Name string `json:"name" form:"name" gorm:"column:name;comment:点位名称;size:198;"`
ShowImage string `json:"showImage" form:"showImage" gorm:"column:show_image;comment:展示图片;size:300;"`
Type *int `json:"type" form:"type" gorm:"column:type;comment:公厕类型 1=>有动力 2=>无动力;"`
}
// TableName QshToilet 表名
func (QshToilet) TableName() string {
return "qsh_toilet"
}
package request
import (
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
type QshPartolSearch struct {
admin.QshPatrol
request.PageInfo
}
package request
import (
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
type QshToiletSearch struct{
admin.QshToilet
request.PageInfo
}
package request
type Login struct {
Username string `json:"username"` // 用户名
Password string `json:"password"` // 密码
}
package request
import "github.com/flipped-aurora/gin-vue-admin/server/utils"
type PatrolList struct {
utils.PageInfo
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Type int `json:"type"`
}
type GetPatrolId struct {
ID string `json:"id"`
}
package request
import "github.com/flipped-aurora/gin-vue-admin/server/utils"
type Toilet struct {
utils.PageInfo
}
type GetId struct {
ID string `json:"id"`
}
package admin
type RouterGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
QshToiletRouter
QshPartolRouter
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1"
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
type QshPartolRouter struct {
}
// InitQshPartolRouter 初始化 QshPartol 路由信息
func (s *QshPartolRouter) InitQshPartolRouter(Router *gin.RouterGroup) {
qshPartolRouter := Router.Group("qshPartol").Use(middleware.OperationRecord())
qshPartolRouterWithoutRecord := Router.Group("qshPartol")
var qshPartolApi = v1.ApiGroupApp.AdminApiGroup.QshPartolApi
{
qshPartolRouter.POST("createQshPartol", qshPartolApi.CreateQshPartol) // 新建QshPartol
qshPartolRouter.DELETE("deleteQshPartol", qshPartolApi.DeleteQshPartol) // 删除QshPartol
qshPartolRouter.DELETE("deleteQshPartolByIds", qshPartolApi.DeleteQshPartolByIds) // 批量删除QshPartol
qshPartolRouter.PUT("updateQshPartol", qshPartolApi.UpdateQshPartol) // 更新QshPartol
}
{
qshPartolRouterWithoutRecord.GET("findQshPartol", qshPartolApi.FindQshPartol) // 根据ID获取QshPartol
qshPartolRouterWithoutRecord.GET("getQshPartolList", qshPartolApi.GetQshPartolList) // 获取QshPartol列表
}
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1"
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
type QshToiletRouter struct {
}
// InitQshToiletRouter 初始化 QshToilet 路由信息
func (s *QshToiletRouter) InitQshToiletRouter(Router *gin.RouterGroup) {
qshToiletRouter := Router.Group("qshToilet").Use(middleware.OperationRecord())
qshToiletRouterWithoutRecord := Router.Group("qshToilet")
var qshToiletApi = v1.ApiGroupApp.AdminApiGroup.QshToiletApi
{
qshToiletRouter.POST("createQshToilet", qshToiletApi.CreateQshToilet) // 新建QshToilet
qshToiletRouter.DELETE("deleteQshToilet", qshToiletApi.DeleteQshToilet) // 删除QshToilet
qshToiletRouter.DELETE("deleteQshToiletByIds", qshToiletApi.DeleteQshToiletByIds) // 批量删除QshToilet
qshToiletRouter.PUT("updateQshToilet", qshToiletApi.UpdateQshToilet) // 更新QshToilet
}
{
qshToiletRouterWithoutRecord.GET("findQshToilet", qshToiletApi.FindQshToilet) // 根据ID获取QshToilet
qshToiletRouterWithoutRecord.GET("getQshToiletList", qshToiletApi.GetQshToiletList) // 获取QshToilet列表
}
}
package router package router
import ( import (
"github.com/flipped-aurora/gin-vue-admin/server/router/admin"
"github.com/flipped-aurora/gin-vue-admin/server/router/example" "github.com/flipped-aurora/gin-vue-admin/server/router/example"
"github.com/flipped-aurora/gin-vue-admin/server/router/system" "github.com/flipped-aurora/gin-vue-admin/server/router/system"
"github.com/flipped-aurora/gin-vue-admin/server/router/web"
) )
type RouterGroup struct { type RouterGroup struct {
System system.RouterGroup System system.RouterGroup
Example example.RouterGroup Example example.RouterGroup
Admin admin.RouterGroup
Web web.RouterGroup
} }
var RouterGroupApp = new(RouterGroup) var RouterGroupApp = new(RouterGroup)
package router
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/web"
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
func InitWebRouter(router *gin.Engine) {
webRouter := router.Group("/web")
webRouter.Use(middleware.Token())
login := webRouter.Group("/login")
{
login.POST("/login", web.Login) //登录
}
toilet := webRouter.Group("toilet")
{
toilet.POST("/toiletList", web.GetToiletList)
toilet.POST("/getToiletDetail", web.GetToiletDetail)
}
patrol := webRouter.Group("patrol")
{
patrol.POST("getPatrolList", web.GetPatrolList)
}
}
package web
type RouterGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
type ServiceGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
QshToiletService
QshPartolService
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
type QshPartolService struct {
}
// CreateQshPartol 创建QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) CreateQshPartol(qshPartol admin.QshPatrol) (err error) {
err = global.GVA_DB.Create(&qshPartol).Error
return err
}
// DeleteQshPartol 删除QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) DeleteQshPartol(qshPartol admin.QshPatrol) (err error) {
err = global.GVA_DB.Delete(&qshPartol).Error
return err
}
// DeleteQshPartolByIds 批量删除QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) DeleteQshPartolByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]admin.QshPatrol{}, "id in ?", ids.Ids).Error
return err
}
// UpdateQshPartol 更新QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) UpdateQshPartol(qshPartol admin.QshPatrol) (err error) {
err = global.GVA_DB.Save(&qshPartol).Error
return err
}
// GetQshPartol 根据id获取QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) GetQshPartol(id uint) (qshPartol admin.QshPatrol, err error) {
err = global.GVA_DB.Where("id = ?", id).First(&qshPartol).Error
return
}
// GetQshPartolInfoList 分页获取QshPartol记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshPartolService *QshPartolService) GetQshPartolInfoList(info adminReq.QshPartolSearch) (list interface{}, total int64, err error) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
db := global.GVA_DB.Model(&admin.QshPatrol{})
var qshPartols []admin.QshPatrol
// 如果有条件搜索 下方会自动创建搜索语句
if info.Title != "" {
db = db.Where("title LIKE ?", "%"+info.Title+"%")
}
if info.Type != nil {
db = db.Where("type = ?", info.Type)
}
err = db.Count(&total).Error
if err != nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&qshPartols).Error
return qshPartols, total, err
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
)
type QshToiletService struct {
}
// CreateQshToilet 创建QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService) CreateQshToilet(qshToilet admin.QshToilet) (err error) {
err = global.GVA_DB.Create(&qshToilet).Error
return err
}
// DeleteQshToilet 删除QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService)DeleteQshToilet(qshToilet admin.QshToilet) (err error) {
err = global.GVA_DB.Delete(&qshToilet).Error
return err
}
// DeleteQshToiletByIds 批量删除QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService)DeleteQshToiletByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]admin.QshToilet{},"id in ?",ids.Ids).Error
return err
}
// UpdateQshToilet 更新QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService)UpdateQshToilet(qshToilet admin.QshToilet) (err error) {
err = global.GVA_DB.Save(&qshToilet).Error
return err
}
// GetQshToilet 根据id获取QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService)GetQshToilet(id uint) (qshToilet admin.QshToilet, err error) {
err = global.GVA_DB.Where("id = ?", id).First(&qshToilet).Error
return
}
// GetQshToiletInfoList 分页获取QshToilet记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshToiletService *QshToiletService)GetQshToiletInfoList(info adminReq.QshToiletSearch) (list interface{}, total int64, err error) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
db := global.GVA_DB.Model(&admin.QshToilet{})
var qshToilets []admin.QshToilet
// 如果有条件搜索 下方会自动创建搜索语句
if info.Name != "" {
db = db.Where("name LIKE ?","%"+ info.Name+"%")
}
if info.Type != nil {
db = db.Where("type = ?",info.Type)
}
err = db.Count(&total).Error
if err!=nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&qshToilets).Error
return qshToilets, total, err
}
package service package service
import ( import (
"github.com/flipped-aurora/gin-vue-admin/server/service/admin"
"github.com/flipped-aurora/gin-vue-admin/server/service/example" "github.com/flipped-aurora/gin-vue-admin/server/service/example"
"github.com/flipped-aurora/gin-vue-admin/server/service/system" "github.com/flipped-aurora/gin-vue-admin/server/service/system"
"github.com/flipped-aurora/gin-vue-admin/server/service/web"
) )
type ServiceGroup struct { type ServiceGroup struct {
SystemServiceGroup system.ServiceGroup SystemServiceGroup system.ServiceGroup
ExampleServiceGroup example.ServiceGroup ExampleServiceGroup example.ServiceGroup
AdminServiceGroup admin.ServiceGroup
WebServiceGroup web.ServiceGroup
} }
var ServiceGroupApp = new(ServiceGroup) var ServiceGroupApp = new(ServiceGroup)
package web
type ServiceGroup struct {
LoginService
ToiletService
PatrolService
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package web
type LoginService struct {
}
package web
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/request"
)
type PatrolService struct {
}
func (l *PatrolService) GetPatrolList(arg request.PatrolList) ([]admin.QshPatrol, int64, error) {
limit := arg.PageSize
offset := (arg.Page - 1) * arg.PageSize
var total int64
var patrolList []admin.QshPatrol
db := global.GVA_DB.Model(admin.QshPatrol{})
if arg.StartTime != "" {
db.Where("created_at >= ?", arg.StartTime)
}
if arg.EndTime != "" {
db.Where("created_at <= ?", arg.EndTime)
}
if arg.Type != 0 {
db.Where("type = ?", arg.Type)
}
err := db.Count(&total).Error
if err != nil {
return patrolList, total, err
}
err = db.Limit(limit).Offset(offset).Find(&patrolList).Error
if err != nil {
return patrolList, total, err
}
return patrolList, total, nil
}
package web
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/request"
)
type ToiletService struct {
}
func (l *ToiletService) GetToiletList(toilet request.Toilet) ([]admin.QshToilet, int64, error) {
limit := toilet.PageSize
offset := (toilet.Page - 1) * toilet.PageSize
var total int64
var toiletList []admin.QshToilet
db := global.GVA_DB.Model(admin.QshToilet{})
db.Count(&total)
err := db.Limit(limit).Offset(offset).Find(&toiletList).Error
if err != nil {
return toiletList, total, err
}
return toiletList, total, nil
}
func (l *ToiletService) GetToiletDetail(toilet request.GetId) (admin.QshToilet, error) {
var toiletInfo admin.QshToilet
err := global.GVA_DB.Model(toiletInfo).First(&toiletInfo).Error
if err != nil {
return toiletInfo, err
}
return toiletInfo, nil
}
package utils
type PageInfo struct {
Page int `json:"page" form:"page"` // 页码
PageSize int `json:"page_size" form:"page_size"` // 每页大小
}
import service from '@/utils/request'
// @Tags QshPartol
// @Summary 创建QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshPartol true "创建QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshPartol/createQshPartol [post]
export const createQshPartol = (data) => {
return service({
url: '/qshPartol/createQshPartol',
method: 'post',
data
})
}
// @Tags QshPartol
// @Summary 删除QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshPartol true "删除QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshPartol/deleteQshPartol [delete]
export const deleteQshPartol = (data) => {
return service({
url: '/qshPartol/deleteQshPartol',
method: 'delete',
data
})
}
// @Tags QshPartol
// @Summary 删除QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshPartol/deleteQshPartol [delete]
export const deleteQshPartolByIds = (data) => {
return service({
url: '/qshPartol/deleteQshPartolByIds',
method: 'delete',
data
})
}
// @Tags QshPartol
// @Summary 更新QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshPartol true "更新QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshPartol/updateQshPartol [put]
export const updateQshPartol = (data) => {
return service({
url: '/qshPartol/updateQshPartol',
method: 'put',
data
})
}
// @Tags QshPartol
// @Summary 用id查询QshPartol
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query model.QshPartol true "用id查询QshPartol"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshPartol/findQshPartol [get]
export const findQshPartol = (params) => {
return service({
url: '/qshPartol/findQshPartol',
method: 'get',
params
})
}
// @Tags QshPartol
// @Summary 分页获取QshPartol列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取QshPartol列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshPartol/getQshPartolList [get]
export const getQshPartolList = (params) => {
return service({
url: '/qshPartol/getQshPartolList',
method: 'get',
params
})
}
import service from '@/utils/request'
// @Tags QshToilet
// @Summary 创建QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshToilet true "创建QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshToilet/createQshToilet [post]
export const createQshToilet = (data) => {
return service({
url: '/qshToilet/createQshToilet',
method: 'post',
data
})
}
// @Tags QshToilet
// @Summary 删除QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshToilet true "删除QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshToilet/deleteQshToilet [delete]
export const deleteQshToilet = (data) => {
return service({
url: '/qshToilet/deleteQshToilet',
method: 'delete',
data
})
}
// @Tags QshToilet
// @Summary 删除QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshToilet/deleteQshToilet [delete]
export const deleteQshToiletByIds = (data) => {
return service({
url: '/qshToilet/deleteQshToiletByIds',
method: 'delete',
data
})
}
// @Tags QshToilet
// @Summary 更新QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshToilet true "更新QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshToilet/updateQshToilet [put]
export const updateQshToilet = (data) => {
return service({
url: '/qshToilet/updateQshToilet',
method: 'put',
data
})
}
// @Tags QshToilet
// @Summary 用id查询QshToilet
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query model.QshToilet true "用id查询QshToilet"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshToilet/findQshToilet [get]
export const findQshToilet = (params) => {
return service({
url: '/qshToilet/findQshToilet',
method: 'get',
params
})
}
// @Tags QshToilet
// @Summary 分页获取QshToilet列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取QshToilet列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshToilet/getQshToiletList [get]
export const getQshToiletList = (params) => {
return service({
url: '/qshToilet/getQshToiletList',
method: 'get',
params
})
}
This diff is collapsed.
<template>
<div>
<div class="gva-form-box">
<el-form :model="formData" label-position="right" label-width="80px">
<el-form-item label="巡检内容:">
<el-input v-model="formData.content" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="异常描述:">
<el-input v-model="formData.description" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="巡检图片多个逗号分隔:">
<el-input v-model="formData.image" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="巡视人:">
<el-input v-model="formData.partolName" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="工单标题:">
<el-input v-model="formData.title" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="巡检公厕:">
<el-input v-model.number="formData.toiletId" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="巡检类型:">
<el-select v-model="formData.type" placeholder="请选择" clearable>
<el-option v-for="(item,key) in partol_typeOptions" :key="key" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="save">保存</el-button>
<el-button size="mini" type="primary" @click="back">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: 'QshPartol'
}
</script>
<script setup>
import {
createQshPartol,
updateQshPartol,
findQshPartol
} from '@/api/qshPartol'
// 自动获取字典
import { getDictFunc } from '@/utils/format'
import { useRoute, useRouter } from "vue-router"
import { ElMessage } from 'element-plus'
import { ref } from 'vue'
const route = useRoute()
const router = useRouter()
const type = ref('')
const partol_typeOptions = ref([])
const formData = ref({
content: '',
description: '',
image: '',
partolName: '',
title: '',
toiletId: 0,
type: undefined,
})
// 初始化方法
const init = async () => {
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if (route.query.id) {
const res = await findQshPartol({ ID: route.query.id })
if (res.code === 0) {
formData.value = res.data.reqshPartol
type.value = 'update'
}
} else {
type.value = 'create'
}
partol_typeOptions.value = await getDictFunc('partol_type')
}
init()
// 保存按钮
const save = async() => {
let res
switch (type.value) {
case 'create':
res = await createQshPartol(formData.value)
break
case 'update':
res = await updateQshPartol(formData.value)
break
default:
res = await createQshPartol(formData.value)
break
}
if (res.code === 0) {
ElMessage({
type: 'success',
message: '创建/更改成功'
})
}
}
// 返回按钮
const back = () => {
router.go(-1)
}
</script>
<style>
</style>
This diff is collapsed.
<template>
<div>
<div class="gva-form-box">
<el-form :model="formData" label-position="right" label-width="80px">
<el-form-item label="公厕地址:">
<el-input v-model="formData.address" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="点位图片:">
<el-input v-model="formData.image" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="纬度:">
<el-input v-model="formData.lat" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="经度:">
<el-input v-model="formData.lng" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="管理人员:">
<el-input v-model="formData.manager" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="管理员联系电话:">
<el-input v-model="formData.managerPhone" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="监控信息:">
<el-input v-model="formData.monitor" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="点位名称:">
<el-input v-model="formData.name" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="展示图片:">
<el-input v-model="formData.showImage" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="公厕类型:">
<el-select v-model="formData.type" placeholder="请选择" clearable>
<el-option v-for="(item,key) in typeOptions" :key="key" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="save">保存</el-button>
<el-button size="mini" type="primary" @click="back">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: 'QshToilet'
}
</script>
<script setup>
import {
createQshToilet,
updateQshToilet,
findQshToilet
} from '@/api/qshToilet'
// 自动获取字典
import { getDictFunc } from '@/utils/format'
import { useRoute, useRouter } from "vue-router"
import { ElMessage } from 'element-plus'
import { ref } from 'vue'
const route = useRoute()
const router = useRouter()
const type = ref('')
const typeOptions = ref([])
const formData = ref({
address: '',
image: '',
lat: '',
lng: '',
manager: '',
managerPhone: '',
monitor: '',
name: '',
showImage: '',
type: undefined,
})
// 初始化方法
const init = async () => {
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if (route.query.id) {
const res = await findQshToilet({ ID: route.query.id })
if (res.code === 0) {
formData.value = res.data.reqshToilet
type.value = 'update'
}
} else {
type.value = 'create'
}
typeOptions.value = await getDictFunc('type')
}
init()
// 保存按钮
const save = async() => {
let res
switch (type.value) {
case 'create':
res = await createQshToilet(formData.value)
break
case 'update':
res = await updateQshToilet(formData.value)
break
default:
res = await createQshToilet(formData.value)
break
}
if (res.code === 0) {
ElMessage({
type: 'success',
message: '创建/更改成功'
})
}
}
// 返回按钮
const back = () => {
router.go(-1)
}
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment