增加周报评论及统计规则接口

master
xiao.ming 2021-11-05 12:19:50 +08:00
parent c1542a3433
commit a491ea8672
40 changed files with 2024 additions and 79 deletions

View File

@ -780,21 +780,58 @@ gin-vue-admin提供代码自动生成功能选择数据库表结构可直
``` ```
// 周报 // 周报
{ {
"id":100, "code": 0,
"header":"周报", "data": {
"rewtReports": {
"ID": 100,
"CreatedAt": "2021-11-04T03:11:07Z",
"UpdatedAt": "2021-11-04T11:35:11Z",
"userName": "xiaoming", "userName": "xiaoming",
"sendTo": ["xiao1", "xiao2"], "sendTo": [
"contents":[ {
{"title":"本周工作", "content":"<strong>本周工作</strong>这里"}, "ID": 1,
{"title":"下周计划", "content":"<p>下周计划在这</p>这里"} "name": "xiao11"
},
{
"ID": 2,
"name": "xiao21"
}
],
"header": "周报",
"contents": [
{
"title": "本周工作",
"content": "<strong>本周工作</strong>这里"
},
{
"title": "下周计划",
"content": "<p>下周计划在这</p>这里"
}
],
"pictures": [
{
"key": "fe01ce2a7fbac8fafaed7c982a04e229_20211102170427.png",
"name": "demo.png"
},
{
"key": "fe01ce2a7fbac8fafaed7c982a04e229_20211102170420.png",
"name": "demo1.png"
}
], ],
"pics":[
{ "key":"fe01ce2a7fbac8fafaed7c982a04e229_20211102170427.png", "name":"demo.png"}
]
"attachments": [ "attachments": [
{ "key":"fe01ce2a7fbac8fafaed7c982a04e220_20211102170428.c", "name":"demo.c"} {
"key": "fe01ce2a7fbac8fafaed7c982a04e229_20211102170427.txt",
"name": "demo.txt"
},
{
"key": "fe01ce2a7fbac8fafaed7c982a04e229_20211102170420.txt",
"name": "demo1.txt"
}
] ]
} }
},
"msg": "操作成功"
}
// 评论 // 评论
{ {

View File

@ -13,12 +13,12 @@ type ApiGroup struct {
SystemApi SystemApi
} }
var userService = service.ServiceGroupApp.UserService var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
var jwtService = service.ServiceGroupApp.JwtService var jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
var menuService = service.ServiceGroupApp.MenuService var menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
var baseMenuService = service.ServiceGroupApp.BaseMenuService var baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
var systemConfigService = service.ServiceGroupApp.SystemConfigService var systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService
var fileUploadAndDownloadService = service.ServiceGroupApp.FileUploadAndDownloadService var fileUploadAndDownloadService = service.ServiceGroupApp.SystemServiceGroup.FileUploadAndDownloadService
var authorityService = service.ServiceGroupApp.AuthorityService var authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
var casbinService = service.ServiceGroupApp.CasbinService var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService

View File

@ -1,12 +1,17 @@
package wt package wt
import "goweb-gin-demo/service" import (
"goweb-gin-demo/service"
)
type ApiWtGroup struct { type ApiWtGroup struct {
WtReportsApi WtReportsApi
WtTemplateApi WtTemplateApi
WtCommentApi
WtRuleApi
} }
var wtReportsService = service.ServiceGroupApp.WtReportsService var wtReportsService = service.ServiceGroupApp.WtServiceGroup.WtReportsService
var wtTemplatesService = service.ServiceGroupApp.WtTemplateService var wtTemplatesService = service.ServiceGroupApp.WtServiceGroup.WtTemplateService
var wtCommentService = service.ServiceGroupApp.WtServiceGroup.WtCommentService
var wtRuleService = service.ServiceGroupApp.WtServiceGroup.WtRuleService

121
api/wt/wt_comments.go Executable file
View File

@ -0,0 +1,121 @@
package wt
import (
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"goweb-gin-demo/global"
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/common/response"
"goweb-gin-demo/model/wt"
wtReq "goweb-gin-demo/model/wt/request"
"strconv"
)
type WtCommentApi struct {
}
// CreateWtComment 创建周报评论
// @Tags WtComment
// @Summary 创建周报评论
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body wt.WtComment true "创建周报评论"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /wtComment/createWtComment [post]
func (wtCommentApi *WtCommentApi) CreateWtComment(c *gin.Context) {
var wtComment wt.WtComment
_ = c.ShouldBindJSON(&wtComment)
if err := wtCommentService.CreateWtComment(wtComment); err != nil {
global.GLOBAL_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteWtCommentByIds 批量删除周报评论
// @Tags WtComment
// @Summary 批量删除周报评论
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除周报评论"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /wtComment/deleteWtCommentByIds [delete]
func (wtCommentApi *WtCommentApi) DeleteWtCommentByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := wtCommentService.DeleteWtCommentByIds(IDS); err != nil {
global.GLOBAL_LOG.Error("批量删除失败!", zap.Any("err", err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateWtComment 更新周报评论
// @Tags WtComment
// @Summary 更新周报评论
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body wt.WtComment true "更新周报评论"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /wtComment/updateWtComment [put]
func (wtCommentApi *WtCommentApi) UpdateWtComment(c *gin.Context) {
var wtComment wt.WtComment
_ = c.ShouldBindJSON(&wtComment)
if err := wtCommentService.UpdateWtComment(wtComment); err != nil {
global.GLOBAL_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindWtComment 用id查询周报评论
// @Tags WtComment
// @Summary 用id查询周报评论
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.GetById true "用id查询周报评论"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /wtComment/findWtComment [get]
func (wtCommentApi *WtCommentApi) FindWtComment(c *gin.Context) {
idStr := c.Query("id")
id, _ := strconv.Atoi(idStr)
if err, rewtComment := wtCommentService.GetWtComment(uint(id)); err != nil {
global.GLOBAL_LOG.Error("查询失败!", zap.Any("err", err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"rewtComment": rewtComment}, c)
}
}
// GetWtCommentList 分页获取周报评论列表
// @Tags WtComment
// @Summary 分页获取周报评论列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query wtReq.WtCommentSearch true "分页获取周报评论列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /wtComment/getWtCommentList [get]
func (wtCommentApi *WtCommentApi) GetWtCommentList(c *gin.Context) {
var pageInfo wtReq.WtCommentSearch
_ = c.ShouldBindQuery(&pageInfo)
if err, list, total := wtCommentService.GetWtCommentInfoList(pageInfo); err != nil {
global.GLOBAL_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}

121
api/wt/wt_rules.go Executable file
View File

@ -0,0 +1,121 @@
package wt
import (
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"goweb-gin-demo/global"
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/common/response"
wtReq "goweb-gin-demo/model/wt/request"
"strconv"
)
type WtRuleApi struct {
}
// CreateWtRule 创建统计规则
// @Tags WtRule
// @Summary 创建统计规则
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.WtRuleRes true "创建统计规则"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /wtRule/createWtRule [post]
func (wtRuleApi *WtRuleApi) CreateWtRule(c *gin.Context) {
var ruleRes wtReq.WtRuleRes
_ = c.ShouldBindJSON(&ruleRes)
if err := wtRuleService.CreateWtRule(ruleRes); err != nil {
global.GLOBAL_LOG.Error("创建失败!", zap.Any("err", err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteWtRuleByIds 批量删除统计规则
// @Tags WtRule
// @Summary 批量删除统计规则
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除统计规则"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /wtRule/deleteWtRuleByIds [delete]
func (wtRuleApi *WtRuleApi) DeleteWtRuleByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := wtRuleService.DeleteWtRuleByIds(IDS); err != nil {
global.GLOBAL_LOG.Error("批量删除失败!", zap.Any("err", err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateWtRule 更新统计规则
// @Tags WtRule
// @Summary 更新统计规则
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.WtRuleRes true "更新统计规则"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /wtRule/updateWtRule [put]
func (wtRuleApi *WtRuleApi) UpdateWtRule(c *gin.Context) {
var ruleRes wtReq.WtRuleRes
_ = c.ShouldBindJSON(&ruleRes)
if err := wtRuleService.UpdateWtRule(ruleRes); err != nil {
global.GLOBAL_LOG.Error("更新失败!", zap.Any("err", err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindWtRule 用id查询统计规则
// @Tags WtRule
// @Summary 用id查询统计规则
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.GetById true "用id查询统计规则"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /wtRule/findWtRule [get]
func (wtRuleApi *WtRuleApi) FindWtRule(c *gin.Context) {
idStr := c.Query("id")
id, _ := strconv.Atoi(idStr)
if err, rewtRule := wtRuleService.GetWtRule(uint(id)); err != nil {
global.GLOBAL_LOG.Error("查询失败!", zap.Any("err", err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"rewtRule": rewtRule}, c)
}
}
// GetWtRuleList 分页获取统计规则列表
// @Tags WtRule
// @Summary 分页获取统计规则列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query wtReq.WtRuleSearch true "分页获取统计规则列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /wtRule/getWtRuleList [get]
func (wtRuleApi *WtRuleApi) GetWtRuleList(c *gin.Context) {
var pageInfo wtReq.WtRuleSearch
_ = c.ShouldBindQuery(&pageInfo)
if err, list, total := wtRuleService.GetWtRuleInfoList(pageInfo); err != nil {
global.GLOBAL_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}

View File

@ -1349,6 +1349,229 @@ var doc = `{
} }
} }
}, },
"/wtComment/createWtComment": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "创建周报评论",
"parameters": [
{
"description": "创建周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wt.WtComment"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/deleteWtCommentByIds": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "批量删除周报评论",
"parameters": [
{
"description": "批量删除周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.IdsReq"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/findWtComment": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "用id查询周报评论",
"parameters": [
{
"type": "number",
"description": "主键ID",
"name": "id",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/getWtCommentList": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "分页获取周报评论列表",
"parameters": [
{
"type": "string",
"name": "comment",
"in": "query"
},
{
"type": "string",
"description": "创建时间",
"name": "createdAt",
"in": "query"
},
{
"type": "integer",
"description": "主键ID",
"name": "id",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页大小",
"name": "pageSize",
"in": "query"
},
{
"type": "integer",
"name": "reportId",
"in": "query"
},
{
"type": "string",
"description": "更新时间",
"name": "updatedAt",
"in": "query"
},
{
"type": "string",
"name": "userName",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/updateWtComment": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "更新周报评论",
"parameters": [
{
"description": "更新周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wt.WtComment"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtReports/createWtReports": { "/wtReports/createWtReports": {
"post": { "post": {
"security": [ "security": [
@ -1587,6 +1810,234 @@ var doc = `{
} }
} }
}, },
"/wtRule/createWtRule": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "创建统计规则",
"parameters": [
{
"description": "创建统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.WtRuleRes"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/deleteWtRuleByIds": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "批量删除统计规则",
"parameters": [
{
"description": "批量删除统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.IdsReq"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/findWtRule": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "用id查询统计规则",
"parameters": [
{
"type": "number",
"description": "主键ID",
"name": "id",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/getWtRuleList": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "分页获取统计规则列表",
"parameters": [
{
"type": "string",
"description": "创建时间",
"name": "createdAt",
"in": "query"
},
{
"type": "string",
"name": "endTime",
"in": "query"
},
{
"type": "integer",
"description": "主键ID",
"name": "id",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页大小",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"name": "reporters",
"in": "query"
},
{
"type": "string",
"name": "startTime",
"in": "query"
},
{
"type": "string",
"description": "更新时间",
"name": "updatedAt",
"in": "query"
},
{
"type": "integer",
"name": "userId",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/updateWtRule": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "更新统计规则",
"parameters": [
{
"description": "更新统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.WtRuleRes"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtTemplates/createWtTemplate": { "/wtTemplates/createWtTemplate": {
"post": { "post": {
"security": [ "security": [
@ -1611,7 +2062,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/request.WtTemplateVO" "$ref": "#/definitions/request.WtTemplateRes"
} }
} }
], ],
@ -1716,6 +2167,11 @@ var doc = `{
], ],
"summary": "分页获取周报模板列表", "summary": "分页获取周报模板列表",
"parameters": [ "parameters": [
{
"type": "string",
"name": "attachments",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "contents", "name": "contents",
@ -1750,6 +2206,16 @@ var doc = `{
"name": "pageSize", "name": "pageSize",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "pictures",
"in": "query"
},
{
"type": "string",
"name": "sendTo",
"in": "query"
},
{ {
"type": "string", "type": "string",
"description": "更新时间", "description": "更新时间",
@ -1796,7 +2262,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/request.WtTemplateVO" "$ref": "#/definitions/request.WtTemplateRes"
} }
} }
], ],
@ -2403,7 +2869,30 @@ var doc = `{
} }
} }
}, },
"request.WtTemplateVO": { "request.WtRuleRes": {
"type": "object",
"properties": {
"endTime": {
"type": "string"
},
"id": {
"type": "integer"
},
"reporters": {
"type": "array",
"items": {
"type": "string"
}
},
"startTime": {
"type": "string"
},
"userId": {
"type": "integer"
}
}
},
"request.WtTemplateRes": {
"type": "object", "type": "object",
"properties": { "properties": {
"contents": { "contents": {
@ -2669,6 +3158,32 @@ var doc = `{
"type": "string" "type": "string"
} }
} }
},
"wt.WtComment": {
"type": "object",
"properties": {
"comment": {
"type": "string"
},
"createdAt": {
"description": "创建时间",
"type": "string"
},
"id": {
"description": "主键ID",
"type": "integer"
},
"reportId": {
"type": "integer"
},
"updatedAt": {
"description": "更新时间",
"type": "string"
},
"userName": {
"type": "string"
}
}
} }
} }
}` }`

View File

@ -1330,6 +1330,229 @@
} }
} }
}, },
"/wtComment/createWtComment": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "创建周报评论",
"parameters": [
{
"description": "创建周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wt.WtComment"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/deleteWtCommentByIds": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "批量删除周报评论",
"parameters": [
{
"description": "批量删除周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.IdsReq"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/findWtComment": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "用id查询周报评论",
"parameters": [
{
"type": "number",
"description": "主键ID",
"name": "id",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/getWtCommentList": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "分页获取周报评论列表",
"parameters": [
{
"type": "string",
"name": "comment",
"in": "query"
},
{
"type": "string",
"description": "创建时间",
"name": "createdAt",
"in": "query"
},
{
"type": "integer",
"description": "主键ID",
"name": "id",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页大小",
"name": "pageSize",
"in": "query"
},
{
"type": "integer",
"name": "reportId",
"in": "query"
},
{
"type": "string",
"description": "更新时间",
"name": "updatedAt",
"in": "query"
},
{
"type": "string",
"name": "userName",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtComment/updateWtComment": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtComment"
],
"summary": "更新周报评论",
"parameters": [
{
"description": "更新周报评论",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wt.WtComment"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtReports/createWtReports": { "/wtReports/createWtReports": {
"post": { "post": {
"security": [ "security": [
@ -1568,6 +1791,234 @@
} }
} }
}, },
"/wtRule/createWtRule": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "创建统计规则",
"parameters": [
{
"description": "创建统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.WtRuleRes"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/deleteWtRuleByIds": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "批量删除统计规则",
"parameters": [
{
"description": "批量删除统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.IdsReq"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/findWtRule": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "用id查询统计规则",
"parameters": [
{
"type": "number",
"description": "主键ID",
"name": "id",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/getWtRuleList": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "分页获取统计规则列表",
"parameters": [
{
"type": "string",
"description": "创建时间",
"name": "createdAt",
"in": "query"
},
{
"type": "string",
"name": "endTime",
"in": "query"
},
{
"type": "integer",
"description": "主键ID",
"name": "id",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页大小",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"name": "reporters",
"in": "query"
},
{
"type": "string",
"name": "startTime",
"in": "query"
},
{
"type": "string",
"description": "更新时间",
"name": "updatedAt",
"in": "query"
},
{
"type": "integer",
"name": "userId",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtRule/updateWtRule": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"WtRule"
],
"summary": "更新统计规则",
"parameters": [
{
"description": "更新统计规则",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.WtRuleRes"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/wtTemplates/createWtTemplate": { "/wtTemplates/createWtTemplate": {
"post": { "post": {
"security": [ "security": [
@ -1592,7 +2043,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/request.WtTemplateVO" "$ref": "#/definitions/request.WtTemplateRes"
} }
} }
], ],
@ -1697,6 +2148,11 @@
], ],
"summary": "分页获取周报模板列表", "summary": "分页获取周报模板列表",
"parameters": [ "parameters": [
{
"type": "string",
"name": "attachments",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "contents", "name": "contents",
@ -1731,6 +2187,16 @@
"name": "pageSize", "name": "pageSize",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "pictures",
"in": "query"
},
{
"type": "string",
"name": "sendTo",
"in": "query"
},
{ {
"type": "string", "type": "string",
"description": "更新时间", "description": "更新时间",
@ -1777,7 +2243,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/request.WtTemplateVO" "$ref": "#/definitions/request.WtTemplateRes"
} }
} }
], ],
@ -2384,7 +2850,30 @@
} }
} }
}, },
"request.WtTemplateVO": { "request.WtRuleRes": {
"type": "object",
"properties": {
"endTime": {
"type": "string"
},
"id": {
"type": "integer"
},
"reporters": {
"type": "array",
"items": {
"type": "string"
}
},
"startTime": {
"type": "string"
},
"userId": {
"type": "integer"
}
}
},
"request.WtTemplateRes": {
"type": "object", "type": "object",
"properties": { "properties": {
"contents": { "contents": {
@ -2650,6 +3139,32 @@
"type": "string" "type": "string"
} }
} }
},
"wt.WtComment": {
"type": "object",
"properties": {
"comment": {
"type": "string"
},
"createdAt": {
"description": "创建时间",
"type": "string"
},
"id": {
"description": "主键ID",
"type": "integer"
},
"reportId": {
"type": "integer"
},
"updatedAt": {
"description": "更新时间",
"type": "string"
},
"userName": {
"type": "string"
}
}
} }
} }
} }

View File

@ -408,7 +408,22 @@ definitions:
userName: userName:
type: string type: string
type: object type: object
request.WtTemplateVO: request.WtRuleRes:
properties:
endTime:
type: string
id:
type: integer
reporters:
items:
type: string
type: array
startTime:
type: string
userId:
type: integer
type: object
request.WtTemplateRes:
properties: properties:
contents: contents:
items: items:
@ -594,6 +609,24 @@ definitions:
name: name:
type: string type: string
type: object type: object
wt.WtComment:
properties:
comment:
type: string
createdAt:
description: 创建时间
type: string
id:
description: 主键ID
type: integer
reportId:
type: integer
updatedAt:
description: 更新时间
type: string
userName:
type: string
type: object
info: info:
contact: {} contact: {}
paths: paths:
@ -1399,6 +1432,142 @@ paths:
summary: 设置用户信息 summary: 设置用户信息
tags: tags:
- SysUser - SysUser
/wtComment/createWtComment:
post:
consumes:
- application/json
parameters:
- description: 创建周报评论
in: body
name: data
required: true
schema:
$ref: '#/definitions/wt.WtComment'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 创建周报评论
tags:
- WtComment
/wtComment/deleteWtCommentByIds:
delete:
consumes:
- application/json
parameters:
- description: 批量删除周报评论
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.IdsReq'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"批量删除成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 批量删除周报评论
tags:
- WtComment
/wtComment/findWtComment:
get:
consumes:
- application/json
parameters:
- description: 主键ID
in: query
name: id
type: number
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"查询成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 用id查询周报评论
tags:
- WtComment
/wtComment/getWtCommentList:
get:
consumes:
- application/json
parameters:
- in: query
name: comment
type: string
- description: 创建时间
in: query
name: createdAt
type: string
- description: 主键ID
in: query
name: id
type: integer
- description: 页码
in: query
name: page
type: integer
- description: 每页大小
in: query
name: pageSize
type: integer
- in: query
name: reportId
type: integer
- description: 更新时间
in: query
name: updatedAt
type: string
- in: query
name: userName
type: string
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 分页获取周报评论列表
tags:
- WtComment
/wtComment/updateWtComment:
put:
consumes:
- application/json
parameters:
- description: 更新周报评论
in: body
name: data
required: true
schema:
$ref: '#/definitions/wt.WtComment'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"更新成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 更新周报评论
tags:
- WtComment
/wtReports/createWtReports: /wtReports/createWtReports:
post: post:
consumes: consumes:
@ -1544,6 +1713,145 @@ paths:
summary: 更新周报 summary: 更新周报
tags: tags:
- WtReports - WtReports
/wtRule/createWtRule:
post:
consumes:
- application/json
parameters:
- description: 创建统计规则
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.WtRuleRes'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 创建统计规则
tags:
- WtRule
/wtRule/deleteWtRuleByIds:
delete:
consumes:
- application/json
parameters:
- description: 批量删除统计规则
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.IdsReq'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"批量删除成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 批量删除统计规则
tags:
- WtRule
/wtRule/findWtRule:
get:
consumes:
- application/json
parameters:
- description: 主键ID
in: query
name: id
type: number
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"查询成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 用id查询统计规则
tags:
- WtRule
/wtRule/getWtRuleList:
get:
consumes:
- application/json
parameters:
- description: 创建时间
in: query
name: createdAt
type: string
- in: query
name: endTime
type: string
- description: 主键ID
in: query
name: id
type: integer
- description: 页码
in: query
name: page
type: integer
- description: 每页大小
in: query
name: pageSize
type: integer
- in: query
name: reporters
type: string
- in: query
name: startTime
type: string
- description: 更新时间
in: query
name: updatedAt
type: string
- in: query
name: userId
type: integer
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 分页获取统计规则列表
tags:
- WtRule
/wtRule/updateWtRule:
put:
consumes:
- application/json
parameters:
- description: 更新统计规则
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.WtRuleRes'
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"更新成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 更新统计规则
tags:
- WtRule
/wtTemplates/createWtTemplate: /wtTemplates/createWtTemplate:
post: post:
consumes: consumes:
@ -1554,7 +1862,7 @@ paths:
name: data name: data
required: true required: true
schema: schema:
$ref: '#/definitions/request.WtTemplateVO' $ref: '#/definitions/request.WtTemplateRes'
produces: produces:
- application/json - application/json
responses: responses:
@ -1616,6 +1924,9 @@ paths:
consumes: consumes:
- application/json - application/json
parameters: parameters:
- in: query
name: attachments
type: string
- in: query - in: query
name: contents name: contents
type: string type: string
@ -1638,6 +1949,12 @@ paths:
in: query in: query
name: pageSize name: pageSize
type: integer type: integer
- in: query
name: pictures
type: string
- in: query
name: sendTo
type: string
- description: 更新时间 - description: 更新时间
in: query in: query
name: updatedAt name: updatedAt
@ -1667,7 +1984,7 @@ paths:
name: data name: data
required: true required: true
schema: schema:
$ref: '#/definitions/request.WtTemplateVO' $ref: '#/definitions/request.WtTemplateRes'
produces: produces:
- application/json - application/json
responses: responses:

Binary file not shown.

View File

@ -42,6 +42,7 @@ func Routers() *gin.Engine {
RouterGroup.InitFileUploadAndDownloadRouter(PrivateGroup) RouterGroup.InitFileUploadAndDownloadRouter(PrivateGroup)
RouterGroup.InitAuthorityRouter(PrivateGroup) RouterGroup.InitAuthorityRouter(PrivateGroup)
RouterGroup.InitWtReportsRouter(PrivateGroup) RouterGroup.InitWtReportsRouter(PrivateGroup)
RouterGroup.InitWtRuleRouter(PrivateGroup)
} }
global.GLOBAL_LOG.Info("router register success") global.GLOBAL_LOG.Info("router register success")

View File

@ -1 +1 @@
log/2021-11-04.log log/2021-11-05.log

29
log/2021-11-05.log Normal file
View File

@ -0,0 +1,29 @@
[goweb-demo]2021/11/05 - 09:04:23.221 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:47 router register success
[goweb-demo]2021/11/05 - 09:04:23.223 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 09:10:09.982 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 09:10:17.846 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:47 router register success
[goweb-demo]2021/11/05 - 09:10:17.847 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 10:33:46.120 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 11:14:00.392 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:47 router register success
[goweb-demo]2021/11/05 - 11:14:00.394 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:28:40.712 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 11:37:11.227 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 11:37:11.230 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:37:44.494 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 11:37:51.391 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 11:37:51.397 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:39:39.024 error /Users/zero/work/mygithub/goweb-gin-demo/api/wt/wt_comments.go:30 创建失败! {"err": "Error 1048: Column 'report_id' cannot be null"}
[goweb-demo]2021/11/05 - 11:43:45.723 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 11:43:58.720 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 11:43:58.721 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:45:15.899 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 11:45:15.900 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:50:45.851 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 11:50:45.852 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 11:53:06.019 error /Users/zero/work/mygithub/goweb-gin-demo/api/wt/wt_comments.go:30 创建失败! {"err": "Error 1062: Duplicate entry '1' for key 'PRIMARY'"}
[goweb-demo]2021/11/05 - 12:15:59.500 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 12:16:53.847 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 12:16:53.849 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
[goweb-demo]2021/11/05 - 12:17:41.333 error /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
[goweb-demo]2021/11/05 - 12:17:49.963 info /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:48 router register success
[goweb-demo]2021/11/05 - 12:17:49.965 info /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}

View File

@ -8,7 +8,7 @@ import (
"goweb-gin-demo/service" "goweb-gin-demo/service"
) )
var casbinService = service.ServiceGroupApp.CasbinService var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
// 拦截器 // 拦截器
func CasbinHandler() gin.HandlerFunc { func CasbinHandler() gin.HandlerFunc {

View File

@ -1,20 +1,19 @@
package middleware package middleware
import ( import (
"goweb-gin-demo/service"
"goweb-gin-demo/utils" "goweb-gin-demo/utils"
"strconv" "strconv"
"time" "time"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/common/response" "goweb-gin-demo/model/common/response"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"goweb-gin-demo/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
) )
var jwtService = service.ServiceGroupApp.JwtService var jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
func JWTAuth() gin.HandlerFunc { func JWTAuth() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {

View File

@ -2,20 +2,20 @@ package middleware
import ( import (
"bytes" "bytes"
"goweb-gin-demo/service"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strconv" "strconv"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"goweb-gin-demo/model/web/request" "goweb-gin-demo/model/web/request"
"goweb-gin-demo/service"
"go.uber.org/zap"
) )
var operationRecordService = service.ServiceGroupApp.OperationRecordService var operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
func OperationRecord() gin.HandlerFunc { func OperationRecord() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {

11
model/wt/request/wt_comments.go Executable file
View File

@ -0,0 +1,11 @@
package request
import (
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/wt"
)
type WtCommentSearch struct{
wt.WtComment
request.PageInfo
}

19
model/wt/request/wt_rules.go Executable file
View File

@ -0,0 +1,19 @@
package request
import (
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/wt"
)
type WtRuleSearch struct{
wt.WtRule
request.PageInfo
}
type WtRuleRes struct {
ID uint
UserId int
Reporters []string
StartTime string
EndTime string
}

11
model/wt/response/wt_rules.go Executable file
View File

@ -0,0 +1,11 @@
package response
import "goweb-gin-demo/global"
type WtRuleResult struct {
global.GLOBAL_MODEL
UserId int
Reporters []string
StartTime string
EndTime string
}

20
model/wt/wt_comments.go Executable file
View File

@ -0,0 +1,20 @@
package wt
import (
"goweb-gin-demo/global"
)
// WtComment 结构体
type WtComment struct {
global.GLOBAL_MODEL
ReportId int `json:"reportId" form:"reportId" gorm:"column:report_id;comment:报告id;type:bigint"`
UserName string `json:"userName" form:"userName" gorm:"column:user_name;comment:评论的用户;type:varchar(100);"`
Comment string `json:"comment" form:"comment" gorm:"column:comment;comment:评论;type:text;"`
}
// TableName WtComment 表名
func (WtComment) TableName() string {
return "wt_comments"
}

21
model/wt/wt_rules.go Executable file
View File

@ -0,0 +1,21 @@
package wt
import (
"goweb-gin-demo/global"
)
// WtRule 结构体
type WtRule struct {
global.GLOBAL_MODEL
UserId int `json:"userId" form:"userId" gorm:"column:user_id;comment:用户id;type:bigint"`
Reporters string `json:"reporters" form:"reporters" gorm:"column:reporters;comment:需要提交报告的人;type:varchar(500);"`
StartTime string `json:"startTime" form:"startTime" gorm:"column:start_time;comment:提交报告的起始时间5-0900 代表周五9点;type:varchar(50);"`
EndTime string `json:"endTime" form:"endTime" gorm:"column:end_time;comment:提交报告的结束时间8-0900 代表次周一9点截止;type:varchar(50);"`
}
// TableName WtRule 表名
func (WtRule) TableName() string {
return "wt_rules"
}

View File

@ -1,4 +1,3 @@
// 自动生成模板WtTemplate
package wt package wt
import ( import (

View File

@ -15,6 +15,7 @@ type RouterGroup struct {
web.AuthorityRouter web.AuthorityRouter
wt.WtReportsRouter wt.WtReportsRouter
wt.WtRuleRouter
} }
var RouterGroupApp = new(RouterGroup) var RouterGroupApp = new(RouterGroup)

View File

@ -10,19 +10,19 @@ type WtReportsRouter struct {
} }
// InitWtReportsRouter 初始化 WtReports 路由信息 // InitWtReportsRouter 初始化周报路由信息
func (s *WtReportsRouter) InitWtReportsRouter(Router *gin.RouterGroup) { func (s *WtReportsRouter) InitWtReportsRouter(Router *gin.RouterGroup) {
wtReportsRouter := Router.Group("wtReports").Use(middleware.OperationRecord()) wtReportsRouter := Router.Group("wtReports").Use(middleware.OperationRecord())
wtReportsRouterWithoutRecord := Router.Group("wtReports") wtReportsRouterWithoutRecord := Router.Group("wtReports")
var wtReportsApi = api.ApiGroupApp.WtServiceGroup.WtReportsApi var wtReportsApi = api.ApiGroupApp.WtServiceGroup.WtReportsApi
{ {
wtReportsRouter.POST("createWtReports", wtReportsApi.CreateWtReports) // 新建WtReports wtReportsRouter.POST("createWtReports", wtReportsApi.CreateWtReports) // 新建周报
wtReportsRouter.DELETE("deleteWtReportsByIds", wtReportsApi.DeleteWtReportsByIds) // 批量删除WtReports wtReportsRouter.DELETE("deleteWtReportsByIds", wtReportsApi.DeleteWtReportsByIds) // 批量删除周报
wtReportsRouter.PUT("updateWtReports", wtReportsApi.UpdateWtReports) // 更新WtReports wtReportsRouter.PUT("updateWtReports", wtReportsApi.UpdateWtReports) // 更新周报
} }
{ {
wtReportsRouterWithoutRecord.GET("findWtReports", wtReportsApi.FindWtReports) // 根据ID获取WtReports wtReportsRouterWithoutRecord.GET("findWtReports", wtReportsApi.FindWtReports) // 根据ID获取周报
wtReportsRouterWithoutRecord.GET("getWtReportsList", wtReportsApi.GetWtReportsList) // 获取WtReports列表 wtReportsRouterWithoutRecord.GET("getWtReportsList", wtReportsApi.GetWtReportsList) // 获取周报列表
} }
wtTemplatesRouter := Router.Group("wtTemplates").Use(middleware.OperationRecord()) wtTemplatesRouter := Router.Group("wtTemplates").Use(middleware.OperationRecord())
@ -37,4 +37,17 @@ func (s *WtReportsRouter) InitWtReportsRouter(Router *gin.RouterGroup) {
wtTemplatesRouterWithoutRecord.GET("findWtTemplate", wtTemplatesApi.FindWtTemplate) // 根据ID获取周报模板 wtTemplatesRouterWithoutRecord.GET("findWtTemplate", wtTemplatesApi.FindWtTemplate) // 根据ID获取周报模板
wtTemplatesRouterWithoutRecord.GET("getWtTemplateList", wtTemplatesApi.GetWtTemplateList) // 获取周报模板列表 wtTemplatesRouterWithoutRecord.GET("getWtTemplateList", wtTemplatesApi.GetWtTemplateList) // 获取周报模板列表
} }
wtCommentRouter := Router.Group("wtComment").Use(middleware.OperationRecord())
wtCommentRouterWithoutRecord := Router.Group("wtComment")
var wtCommentApi = api.ApiGroupApp.WtServiceGroup.WtCommentApi
{
wtCommentRouter.POST("createWtComment", wtCommentApi.CreateWtComment) // 新建周报评论
wtCommentRouter.DELETE("deleteWtCommentByIds", wtCommentApi.DeleteWtCommentByIds) // 批量删除周报评论
wtCommentRouter.PUT("updateWtComment", wtCommentApi.UpdateWtComment) // 更新周报评论
}
{
wtCommentRouterWithoutRecord.GET("findWtComment", wtCommentApi.FindWtComment) // 根据ID获取周报评论
wtCommentRouterWithoutRecord.GET("getWtCommentList", wtCommentApi.GetWtCommentList) // 获取周报评论列表
}
} }

26
router/wt/wt_rules.go Executable file
View File

@ -0,0 +1,26 @@
package wt
import (
"github.com/gin-gonic/gin"
"goweb-gin-demo/api"
"goweb-gin-demo/middleware"
)
type WtRuleRouter struct {
}
// InitWtRuleRouter 初始化 统计规则 路由信息
func (s *WtRuleRouter) InitWtRuleRouter(Router *gin.RouterGroup) {
wtRuleRouter := Router.Group("wtRule").Use(middleware.OperationRecord())
wtRuleRouterWithoutRecord := Router.Group("wtRule")
var wtRuleApi = api.ApiGroupApp.WtServiceGroup.WtRuleApi
{
wtRuleRouter.POST("createWtRule", wtRuleApi.CreateWtRule) // 新建统计规则
wtRuleRouter.DELETE("deleteWtRuleByIds", wtRuleApi.DeleteWtRuleByIds) // 批量删除统计规则
wtRuleRouter.PUT("updateWtRule", wtRuleApi.UpdateWtRule) // 更新统计规则
}
{
wtRuleRouterWithoutRecord.GET("findWtRule", wtRuleApi.FindWtRule) // 根据ID获取统计规则
wtRuleRouterWithoutRecord.GET("getWtRuleList", wtRuleApi.GetWtRuleList) // 获取统计规则列表
}
}

View File

@ -1,20 +1,13 @@
package service package service
import "goweb-gin-demo/service/wt" import (
"goweb-gin-demo/service/system"
"goweb-gin-demo/service/wt"
)
type ServiceGroup struct { type ServiceGroup struct {
UserService SystemServiceGroup system.SystemServiceGroup
JwtService WtServiceGroup wt.WtServiceGroup
CasbinService
OperationRecordService
MenuService
BaseMenuService
SystemConfigService
FileUploadAndDownloadService
AuthorityService
wt.WtReportsService
wt.WtTemplateService
} }
var ServiceGroupApp = new(ServiceGroup) var ServiceGroupApp = new(ServiceGroup)

View File

@ -1,14 +1,14 @@
package service package system
import ( import (
"errors" "errors"
"strconv" "strconv"
"gorm.io/gorm"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/common/request" "goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"goweb-gin-demo/model/web/response" "goweb-gin-demo/model/web/response"
"gorm.io/gorm"
) )
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)

View File

@ -1,11 +1,11 @@
package service package system
import ( import (
"errors" "errors"
"gorm.io/gorm"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"gorm.io/gorm"
) )
type BaseMenuService struct { type BaseMenuService struct {

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"errors" "errors"

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"errors" "errors"

13
service/system/enter.go Normal file
View File

@ -0,0 +1,13 @@
package system
type SystemServiceGroup struct {
UserService
JwtService
CasbinService
OperationRecordService
MenuService
BaseMenuService
SystemConfigService
FileUploadAndDownloadService
AuthorityService
}

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"errors" "errors"

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"context" "context"

View File

@ -1,13 +1,13 @@
package service package system
import ( import (
"errors" "errors"
"strconv" "strconv"
"gorm.io/gorm"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/common/request" "goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"gorm.io/gorm"
) )
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"goweb-gin-demo/global" "goweb-gin-demo/global"

View File

@ -1,4 +1,4 @@
package service package system
import ( import (
"go.uber.org/zap" "go.uber.org/zap"

View File

@ -1,13 +1,13 @@
package service package system
import ( import (
"errors" "errors"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
"goweb-gin-demo/global" "goweb-gin-demo/global"
"goweb-gin-demo/model/common/request" "goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/web" "goweb-gin-demo/model/web"
"goweb-gin-demo/utils" "goweb-gin-demo/utils"
"gorm.io/gorm"
) )
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)

View File

@ -1 +1,8 @@
package wt package wt
type WtServiceGroup struct {
WtReportsService
WtTemplateService
WtCommentService
WtRuleService
}

57
service/wt/wt_comments.go Executable file
View File

@ -0,0 +1,57 @@
package wt
import (
"goweb-gin-demo/global"
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/wt"
wtReq "goweb-gin-demo/model/wt/request"
)
type WtCommentService struct {
}
// CreateWtComment 创建WtComment记录
func (wtCommentService *WtCommentService) CreateWtComment(wtComment wt.WtComment) (err error) {
err = global.GLOBAL_DB.Create(&wtComment).Error
return err
}
// DeleteWtComment 删除WtComment记录
func (wtCommentService *WtCommentService)DeleteWtComment(wtComment wt.WtComment) (err error) {
err = global.GLOBAL_DB.Delete(&wtComment).Error
return err
}
// DeleteWtCommentByIds 批量删除WtComment记录
func (wtCommentService *WtCommentService)DeleteWtCommentByIds(ids request.IdsReq) (err error) {
err = global.GLOBAL_DB.Delete(&[]wt.WtComment{},"id in ?",ids.Ids).Error
return err
}
// UpdateWtComment 更新WtComment记录
func (wtCommentService *WtCommentService)UpdateWtComment(wtComment wt.WtComment) (err error) {
err = global.GLOBAL_DB.Save(&wtComment).Error
return err
}
// GetWtComment 根据id获取WtComment记录
func (wtCommentService *WtCommentService)GetWtComment(id uint) (err error, wtComment wt.WtComment) {
err = global.GLOBAL_DB.Where("id = ?", id).First(&wtComment).Error
return
}
// GetWtCommentInfoList 分页获取WtComment记录
func (wtCommentService *WtCommentService)GetWtCommentInfoList(info wtReq.WtCommentSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
db := global.GLOBAL_DB.Model(&wt.WtComment{})
var wtComments []wt.WtComment
// 如果有条件搜索 下方会自动创建搜索语句
err = db.Count(&total).Error
if err!=nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&wtComments).Error
return err, wtComments, total
}

94
service/wt/wt_rules.go Executable file
View File

@ -0,0 +1,94 @@
package wt
import (
"encoding/json"
"goweb-gin-demo/global"
"goweb-gin-demo/model/common/request"
"goweb-gin-demo/model/wt"
wtReq "goweb-gin-demo/model/wt/request"
wtRes "goweb-gin-demo/model/wt/response"
)
type WtRuleService struct {
}
// CreateWtRule 创建WtRule记录
func (wtRuleService *WtRuleService) CreateWtRule(ruleRes wtReq.WtRuleRes) (err error) {
rule := voToRule(ruleRes)
err = global.GLOBAL_DB.Create(&rule).Error
return err
}
// DeleteWtRuleByIds 批量删除WtRule记录
func (wtRuleService *WtRuleService) DeleteWtRuleByIds(ids request.IdsReq) (err error) {
err = global.GLOBAL_DB.Delete(&[]wt.WtRule{}, "id in ?", ids.Ids).Error
return err
}
// UpdateWtRule 更新WtRule记录
func (wtRuleService *WtRuleService) UpdateWtRule(ruleRes wtReq.WtRuleRes) (err error) {
rule := voToRule(ruleRes)
err = global.GLOBAL_DB.Updates(&rule).Error
return err
}
// GetWtRule 根据id获取WtRule记录
func (wtRuleService *WtRuleService) GetWtRule(id uint) (err error, wtRule wt.WtRule) {
err = global.GLOBAL_DB.Where("id = ?", id).First(&wtRule).Error
return
}
// GetWtRuleInfoList 分页获取WtRule记录
func (wtRuleService *WtRuleService) GetWtRuleInfoList(info wtReq.WtRuleSearch) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
db := global.GLOBAL_DB.Model(&wt.WtRule{})
var wtRules []wt.WtRule
// 如果有条件搜索 下方会自动创建搜索语句
err = db.Count(&total).Error
if err != nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&wtRules).Error
ruleResults := rulesToVOs(wtRules)
return err, ruleResults, total
}
//数据转换一下, 需要把json数据转换为字符串
func voToRule(ruleRes wtReq.WtRuleRes) wt.WtRule {
contentJson, _ := json.Marshal(ruleRes.Reporters)
rule := wt.WtRule{
GLOBAL_MODEL: global.GLOBAL_MODEL{ID: ruleRes.ID},
UserId: ruleRes.UserId,
Reporters: string(contentJson),
StartTime: ruleRes.StartTime,
EndTime: ruleRes.EndTime,
}
return rule
}
// 批量转换 数据转换, 把字符串转换为json
func rulesToVOs(rules []wt.WtRule) []wtRes.WtRuleResult {
var ruleResults []wtRes.WtRuleResult
for _, rule := range rules {
ruleResult := ruleToResult(rule)
ruleResults = append(ruleResults, ruleResult)
}
return ruleResults
}
//单个转换
func ruleToResult(rule wt.WtRule) wtRes.WtRuleResult {
ruleResult := wtRes.WtRuleResult{}
ruleResult.GLOBAL_MODEL = rule.GLOBAL_MODEL
ruleResult.UserId = rule.UserId
ruleResult.StartTime = rule.StartTime
ruleResult.EndTime = rule.EndTime
json.Unmarshal([]byte(rule.Reporters), &ruleResult.Reporters)
return ruleResult
}