mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
【更新】更新restful
This commit is contained in:
@@ -10,37 +10,19 @@ type GenApi struct {
|
||||
GenTableApp services.SysGenTableModel
|
||||
}
|
||||
|
||||
// @Summary 代码视图
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/gen/preview/{tableId} [get]
|
||||
// @Security X-TOKEN
|
||||
// Preview 代码视图
|
||||
func (e *GenApi) Preview(rc *restfulx.ReqCtx) {
|
||||
tableId := restfulx.PathParamInt(rc, "tableId")
|
||||
rc.ResData = gen.Preview(int64(tableId))
|
||||
}
|
||||
|
||||
// @Summary 代码生成
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/gen/code/{tableId} [get]
|
||||
// @Security X-TOKEN
|
||||
// GenCode 代码生成
|
||||
func (e *GenApi) GenCode(rc *restfulx.ReqCtx) {
|
||||
tableId := restfulx.PathParamInt(rc, "tableId")
|
||||
gen.GenCode(int64(tableId))
|
||||
}
|
||||
|
||||
// @Summary 配置生成
|
||||
// @Description 生成API和菜单
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/gen/configure/{tableId} [get]
|
||||
// @Security X-TOKEN
|
||||
// GenConfigure 配置生成
|
||||
func (e *GenApi) GenConfigure(rc *restfulx.ReqCtx) {
|
||||
tableId := restfulx.PathParamInt(rc, "tableId")
|
||||
menuId := restfulx.QueryInt(rc, "menuId", 0)
|
||||
|
||||
@@ -14,14 +14,7 @@ type GenTableApi struct {
|
||||
GenTableApp services.SysGenTableModel
|
||||
}
|
||||
|
||||
// @Summary 分页列表数据 / page list data
|
||||
// @Description 数据库表列分页列表 / database table column page list
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Param pageSize query int false "pageSize / 页条数"
|
||||
// @Param pageNum query int false "pageNum / 页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/table/db/list [get]
|
||||
// GetDBTableList 分页列表数据 / page list data
|
||||
func (g *GenTableApi) GetDBTableList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -36,15 +29,7 @@ func (g *GenTableApi) GetDBTableList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 分页列表数据
|
||||
// @Description 生成表分页列表
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Param tableComment query string false "tableComment / 数据表描述"
|
||||
// @Param pageSize query int false "pageSize / 页条数"
|
||||
// @Param pageIndex query int false "pageIndex / 页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/table/list [get]
|
||||
// GetTablePage 分页列表数据
|
||||
func (g *GenTableApi) GetTablePage(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -60,13 +45,7 @@ func (g *GenTableApi) GetTablePage(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取表信息
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/table/info/{tableId} [get]
|
||||
// @Security Bearer
|
||||
// GetTableInfo 获取表信息
|
||||
func (g *GenTableApi) GetTableInfo(rc *restfulx.ReqCtx) {
|
||||
tableId := restfulx.PathParamInt(rc, "tableId")
|
||||
result := g.GenTableApp.FindOne(entity.DevGenTable{TableId: int64(tableId)}, true)
|
||||
@@ -76,13 +55,7 @@ func (g *GenTableApi) GetTableInfo(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = mp
|
||||
}
|
||||
|
||||
// @Summary 获取表信息
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/table/info/tableName [get]
|
||||
// @Security X-TOKEN
|
||||
// GetTableInfoByName 获取表信息
|
||||
func (g *GenTableApi) GetTableInfoByName(rc *restfulx.ReqCtx) {
|
||||
tableName := restfulx.QueryParam(rc, "tableName")
|
||||
result := g.GenTableApp.FindOne(entity.DevGenTable{TableName: tableName}, true)
|
||||
@@ -92,26 +65,12 @@ func (g *GenTableApi) GetTableInfoByName(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = mp
|
||||
}
|
||||
|
||||
// @Summary 获取树表信息
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/table/tableTree [get]
|
||||
// @Security X-TOKEN
|
||||
// GetTableTree 获取树表信息
|
||||
func (g *GenTableApi) GetTableTree(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = g.GenTableApp.FindTree(entity.DevGenTable{})
|
||||
}
|
||||
|
||||
// @Summary 添加表结构
|
||||
// @Description 添加表结构
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /develop/code/table [post]
|
||||
// @Security Bearer
|
||||
// Insert 添加表结构
|
||||
func (g *GenTableApi) Insert(rc *restfulx.ReqCtx) {
|
||||
tablesList := strings.Split(restfulx.QueryParam(rc, "tables"), ",")
|
||||
|
||||
@@ -128,30 +87,14 @@ func (g *GenTableApi) Insert(rc *restfulx.ReqCtx) {
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// @Summary 修改表结构
|
||||
// @Description 修改表结构
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.DevGenTable true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /develop/code/table [put]
|
||||
// @Security Bearer
|
||||
// Update 修改表结构
|
||||
func (g *GenTableApi) Update(rc *restfulx.ReqCtx) {
|
||||
var data entity.DevGenTable
|
||||
restfulx.BindQuery(rc, &data)
|
||||
g.GenTableApp.Update(data)
|
||||
}
|
||||
|
||||
// Delete
|
||||
// @Summary 删除表结构
|
||||
// @Description 删除表结构
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /develop/code/table/{tableId} [delete]
|
||||
// Delete 删除表结构
|
||||
func (g *GenTableApi) Delete(rc *restfulx.ReqCtx) {
|
||||
tableIds := restfulx.PathParam(rc, "tableId")
|
||||
group := utils.IdsStrToIdsIntGroup(tableIds)
|
||||
|
||||
@@ -14,16 +14,6 @@ type JobApi struct {
|
||||
JobApp services.JobModel
|
||||
}
|
||||
|
||||
// @Summary 添加任务
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysJob true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /job/job [post]
|
||||
// @Security X-TOKEN
|
||||
func (j *JobApi) CreateJob(rc *restfulx.ReqCtx) {
|
||||
var job entity.SysJob
|
||||
restfulx.BindQuery(rc, &job)
|
||||
@@ -32,17 +22,6 @@ func (j *JobApi) CreateJob(rc *restfulx.ReqCtx) {
|
||||
j.JobApp.Insert(job)
|
||||
}
|
||||
|
||||
// @Summary job列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务
|
||||
// @Param status query string false "status"
|
||||
// @Param jobName query string false "jobName"
|
||||
// @Param jobGroup query string false "jobGroup"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /job/list [get]
|
||||
// @Security
|
||||
func (j *JobApi) GetJobList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -59,66 +38,29 @@ func (j *JobApi) GetJobList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取一个job
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务
|
||||
// @Param jobId path int true "jobId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /job/{jobId} [get]
|
||||
// @Security
|
||||
func (j *JobApi) GetJob(rc *restfulx.ReqCtx) {
|
||||
jobId := restfulx.PathParamInt(rc, "jobId")
|
||||
rc.ResData = j.JobApp.FindOne(int64(jobId))
|
||||
}
|
||||
|
||||
// @Summary 修改JOB
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysJob true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /job [put]
|
||||
// @Security X-TOKEN
|
||||
func (l *JobApi) UpdateJob(rc *restfulx.ReqCtx) {
|
||||
var job entity.SysJob
|
||||
restfulx.BindQuery(rc, &job)
|
||||
l.JobApp.Update(job)
|
||||
}
|
||||
|
||||
// @Summary 批量删除JOB
|
||||
// @Description 删除数据
|
||||
// @Tags 任务
|
||||
// @Param infoId path string true "以逗号(,)分割的infoId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /job/{jobId} [delete]
|
||||
func (l *JobApi) DeleteJob(rc *restfulx.ReqCtx) {
|
||||
jobIds := restfulx.PathParam(rc, "jobId")
|
||||
group := utils.IdsStrToIdsIntGroup(jobIds)
|
||||
l.JobApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 停止JOB
|
||||
// @Description 停止Job
|
||||
// @Tags 任务
|
||||
// @Param jobId path int true "jobId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /job/stop/{jobId} [get]
|
||||
func (l *JobApi) StopJobForService(rc *restfulx.ReqCtx) {
|
||||
jobId := restfulx.PathParamInt(rc, "jobId")
|
||||
job := l.JobApp.FindOne(int64(jobId))
|
||||
jobs.Remove(jobs.Crontab, job.EntryId)
|
||||
}
|
||||
|
||||
// @Summary 开始JOB
|
||||
// @Description 开始Job
|
||||
// @Tags 任务
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /job/stop/{jobId} [get]
|
||||
func (l *JobApi) StartJobForService(rc *restfulx.ReqCtx) {
|
||||
jobId := restfulx.PathParamInt(rc, "jobId")
|
||||
job := l.JobApp.FindOne(int64(jobId))
|
||||
@@ -152,16 +94,6 @@ func (l *JobApi) StartJobForService(rc *restfulx.ReqCtx) {
|
||||
l.JobApp.Update(*job)
|
||||
}
|
||||
|
||||
// @Summary 修改JOB状态
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body from.JobStatus true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /job/changeStatus [put]
|
||||
// @Security X-TOKEN
|
||||
func (l *JobApi) UpdateStatusJob(rc *restfulx.ReqCtx) {
|
||||
var job from.JobStatus
|
||||
restfulx.BindQuery(rc, &job)
|
||||
|
||||
@@ -11,17 +11,7 @@ type LogJobApi struct {
|
||||
LogJobApp services.LogJobModel
|
||||
}
|
||||
|
||||
// @Summary Job日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 任务日志
|
||||
// @Param status query string false "status"
|
||||
// @Param jobGroup query string false "jobGroup"
|
||||
// @Param name query string false "name"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logJob/list [get]
|
||||
// @Security
|
||||
// GetJobLogList Job日志列表
|
||||
func (l *LogJobApi) GetJobLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -38,25 +28,14 @@ func (l *LogJobApi) GetJobLogList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 批量删除登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 任务日志
|
||||
// @Param logId path string true "以逗号(,)分割的logId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logJob/{logId} [delete]
|
||||
// DeleteJobLog 批量删除登录日志
|
||||
func (l *LogJobApi) DeleteJobLog(rc *restfulx.ReqCtx) {
|
||||
logIds := restfulx.QueryParam(rc, "logId")
|
||||
group := utils.IdsStrToIdsIntGroup(logIds)
|
||||
l.LogJobApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 清空登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 任务日志
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logJob/all [delete]
|
||||
// DeleteAll 清空登录日志
|
||||
func (l *LogJobApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogJobApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -11,16 +11,6 @@ type LogLoginApi struct {
|
||||
LogLoginApp services.LogLoginModel
|
||||
}
|
||||
|
||||
// @Summary 登录日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param status query string false "status"
|
||||
// @Param username query string false "username"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logLogin/list [get]
|
||||
// @Security
|
||||
func (l *LogLoginApi) GetLoginLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -35,53 +25,23 @@ func (l *LogLoginApi) GetLoginLogList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 通过编码获取登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param infoId path int true "infoId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logLogin/{infoId} [get]
|
||||
// @Security
|
||||
func (l *LogLoginApi) GetLoginLog(rc *restfulx.ReqCtx) {
|
||||
infoId := restfulx.PathParamInt(rc, "infoId")
|
||||
rc.ResData = l.LogLoginApp.FindOne(int64(infoId))
|
||||
}
|
||||
|
||||
// @Summary 修改登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.LogLogin true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /log/logLogin [put]
|
||||
// @Security X-TOKEN
|
||||
func (l *LogLoginApi) UpdateLoginLog(rc *restfulx.ReqCtx) {
|
||||
var log entity.LogLogin
|
||||
restfulx.BindQuery(rc, &log)
|
||||
l.LogLoginApp.Update(log)
|
||||
}
|
||||
|
||||
// @Summary 批量删除登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 登录日志
|
||||
// @Param infoId path string true "以逗号(,)分割的infoId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logLogin/{infoId} [delete]
|
||||
func (l *LogLoginApi) DeleteLoginLog(rc *restfulx.ReqCtx) {
|
||||
infoIds := restfulx.PathParam(rc, "infoId")
|
||||
group := utils.IdsStrToIdsIntGroup(infoIds)
|
||||
l.LogLoginApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 清空登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 登录日志
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logLogin/all [delete]
|
||||
func (l *LogLoginApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogLoginApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -12,16 +12,6 @@ type LogOperApi struct {
|
||||
LogOperApp services.LogOperModel
|
||||
}
|
||||
|
||||
// @Summary 操作日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 操作日志
|
||||
// @Param status query string false "status"
|
||||
// @Param operName query string false "operName"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logOper/list [get]
|
||||
// @Security
|
||||
func (l *LogOperApi) GetOperLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -37,25 +27,11 @@ func (l *LogOperApi) GetOperLogList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 通过编码获取操作日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 操作日志
|
||||
// @Param operId path int true "operId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logOper/{operId} [get]
|
||||
// @Security
|
||||
func (l *LogOperApi) GetOperLog(rc *restfulx.ReqCtx) {
|
||||
operId := restfulx.PathParamInt(rc, "operId")
|
||||
rc.ResData = l.LogOperApp.FindOne(int64(operId))
|
||||
}
|
||||
|
||||
// @Summary 批量删除操作日志
|
||||
// @Description 删除数据
|
||||
// @Tags 操作日志
|
||||
// @Param operId path string true "以逗号(,)分割的operId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logOper/{operId} [delete]
|
||||
func (l *LogOperApi) DeleteOperLog(rc *restfulx.ReqCtx) {
|
||||
operIds := restfulx.PathParam(rc, "operId")
|
||||
group := utils.IdsStrToIdsIntGroup(operIds)
|
||||
@@ -63,12 +39,6 @@ func (l *LogOperApi) DeleteOperLog(rc *restfulx.ReqCtx) {
|
||||
l.LogOperApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 清空操作日志
|
||||
// @Description 删除数据
|
||||
// @Tags 操作日志
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logOper/all [delete]
|
||||
func (l *LogOperApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogOperApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -20,15 +20,7 @@ type ResEmailsApi struct {
|
||||
ResEmailsApp services.ResEmailsModel
|
||||
}
|
||||
|
||||
// @Summary ResEmails列表数据
|
||||
// @Tags ResEmails
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Param status query string false "状态"
|
||||
// @Param category query string false "分类"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/email/list [get]
|
||||
// @Security
|
||||
// GetResEmailsList ResEmails列表数据
|
||||
func (p *ResEmailsApi) GetResEmailsList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -52,28 +44,13 @@ func (p *ResEmailsApi) GetResEmailsList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Param mailId path int true "mailId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/email/{mailId} [get]
|
||||
// @Security
|
||||
// GetResEmails 获取ResEmails
|
||||
func (p *ResEmailsApi) GetResEmails(rc *restfulx.ReqCtx) {
|
||||
mailId := restfulx.PathParamInt(rc, "mailId")
|
||||
p.ResEmailsApp.FindOne(int64(mailId))
|
||||
}
|
||||
|
||||
// @Summary 添加ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertResEmails 添加ResEmails
|
||||
func (p *ResEmailsApi) InsertResEmails(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -81,16 +58,7 @@ func (p *ResEmailsApi) InsertResEmails(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateResEmails 修改ResEmails
|
||||
func (p *ResEmailsApi) UpdateResEmails(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -103,29 +71,14 @@ func (p *ResEmailsApi) UpdateResEmails(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除ResEmails
|
||||
// @Description 删除数据
|
||||
// @Tags ResEmails
|
||||
// @Param mailId path string true "mailId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/email/{mailId} [delete]
|
||||
// DeleteResEmails 删除ResEmails
|
||||
func (p *ResEmailsApi) DeleteResEmails(rc *restfulx.ReqCtx) {
|
||||
mailId := restfulx.PathParam(rc, "mailId")
|
||||
mailIds := utils.IdsStrToIdsIntGroup(mailId)
|
||||
p.ResEmailsApp.Delete(mailIds)
|
||||
}
|
||||
|
||||
// @Summary 删除ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateMailStatus 删除ResEmails
|
||||
func (p *ResEmailsApi) UpdateMailStatus(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -133,16 +86,7 @@ func (p *ResEmailsApi) UpdateMailStatus(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Update(entity.ResEmail{MailId: data.MailId, Status: data.Status})
|
||||
}
|
||||
|
||||
// @Summary 测试发邮件
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body from.SendMail true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email/debugMail [post]
|
||||
// @Security X-TOKEN
|
||||
// DebugMail 测试发邮件
|
||||
func (p *ResEmailsApi) DebugMail(rc *restfulx.ReqCtx) {
|
||||
var data from.SendMail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
|
||||
@@ -21,16 +21,7 @@ type ResOssesApi struct {
|
||||
ResOssesApp services.ResOssesModel
|
||||
}
|
||||
|
||||
// @Summary ResOsses列表数据
|
||||
// @Tags ResOsses
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Param status query string false "状态"
|
||||
// @Param category query string false "分类"
|
||||
// @Param ossCode query string false "编号"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/oss/list [get]
|
||||
// @Security
|
||||
// GetResOssesList ResOsses列表数据
|
||||
func (p *ResOssesApi) GetResOssesList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -55,28 +46,13 @@ func (p *ResOssesApi) GetResOssesList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Param ossId path int true "ossId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/oss/{ossId} [get]
|
||||
// @Security
|
||||
// GetResOsses 获取ResOsses
|
||||
func (p *ResOssesApi) GetResOsses(rc *restfulx.ReqCtx) {
|
||||
ossId := restfulx.PathParamInt(rc, "ossId")
|
||||
p.ResOssesApp.FindOne(int64(ossId))
|
||||
}
|
||||
|
||||
// @Summary 添加ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertResOsses 添加ResOsses
|
||||
func (p *ResOssesApi) InsertResOsses(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -84,16 +60,7 @@ func (p *ResOssesApi) InsertResOsses(rc *restfulx.ReqCtx) {
|
||||
p.ResOssesApp.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateResOsses 修改ResOsses
|
||||
func (p *ResOssesApi) UpdateResOsses(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -106,25 +73,14 @@ func (p *ResOssesApi) UpdateResOsses(rc *restfulx.ReqCtx) {
|
||||
p.ResOssesApp.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除ResOsses
|
||||
// @Description 删除数据
|
||||
// @Tags ResOsses
|
||||
// @Param ossId path string true "ossId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/oss/{ossId} [delete]
|
||||
// DeleteResOsses 删除ResOsses
|
||||
func (p *ResOssesApi) DeleteResOsses(rc *restfulx.ReqCtx) {
|
||||
ossId := restfulx.PathParam(rc, "ossId")
|
||||
ossIds := utils.IdsStrToIdsIntGroup(ossId)
|
||||
p.ResOssesApp.Delete(ossIds)
|
||||
}
|
||||
|
||||
// @Summary 上传文件ResOsses
|
||||
// @Description 上传文件
|
||||
// @Tags ResOsses
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/oss/uploadFile [post]
|
||||
// UplaodResOsses 上传文件ResOsses
|
||||
func (p *ResOssesApi) UplaodResOsses(rc *restfulx.ReqCtx) {
|
||||
_, handler, _ := rc.Request.Request.FormFile("file")
|
||||
ossCode := restfulx.QueryParam(rc, "ossCode")
|
||||
@@ -139,16 +95,7 @@ func (p *ResOssesApi) UplaodResOsses(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = fmt.Sprintf("https://%s.%s/%s", li[0].BucketName, li[0].Endpoint, yunFileTmpPath)
|
||||
}
|
||||
|
||||
// @Summary 修改ResOsses状态
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateOssStatus 修改ResOsses状态
|
||||
func (p *ResOssesApi) UpdateOssStatus(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
|
||||
@@ -17,14 +17,6 @@ type DeptApi struct {
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
// @Summary 获取角色的部门树
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param roleId path int false "roleId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc, "roleId")
|
||||
var dept entity.SysDept
|
||||
@@ -43,15 +35,6 @@ func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 部门列表数据
|
||||
// @Description 分页列表
|
||||
// @Tags 部门
|
||||
// @Param deptName query string false "deptName"
|
||||
// @Param status query string false "status"
|
||||
// @Param deptId query int false "deptId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/deptList [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
|
||||
//pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
//pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
@@ -69,12 +52,6 @@ func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 所有部门列表数据
|
||||
// @Description 部门列表
|
||||
// @Tags 部门
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/ordinaryDeptLis [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
if !IsTenantAdmin(rc.LoginAccount.TenantId) {
|
||||
@@ -84,15 +61,6 @@ func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = a.DeptApp.FindList(dept)
|
||||
}
|
||||
|
||||
// @Summary 所有部门树数据
|
||||
// @Description 部门树列表
|
||||
// @Tags 部门
|
||||
// @Param deptName query string false "deptName"
|
||||
// @Param status query string false "status"
|
||||
// @Param deptId query int false "deptId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/deptTree [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
|
||||
deptName := restfulx.QueryParam(rc, "deptName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
@@ -104,28 +72,11 @@ func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = a.DeptApp.SelectDept(dept)
|
||||
}
|
||||
|
||||
// @Summary 部门数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
// @Param deptId path string false "deptId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dept/{deptId} [get]
|
||||
// @Security
|
||||
func (a *DeptApi) GetDept(rc *restfulx.ReqCtx) {
|
||||
deptId := restfulx.PathParamInt(rc, "deptId")
|
||||
rc.ResData = a.DeptApp.FindOne(int64(deptId))
|
||||
}
|
||||
|
||||
// @Summary 添加部门
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDept true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dept [post]
|
||||
// @Security Bearer
|
||||
func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
restfulx.BindQuery(rc, &dept)
|
||||
@@ -134,16 +85,6 @@ func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
|
||||
a.DeptApp.Insert(dept)
|
||||
}
|
||||
|
||||
// @Summary 修改部门
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDept true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/dept [put]
|
||||
// @Security Bearer
|
||||
func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
restfulx.BindQuery(rc, &dept)
|
||||
@@ -152,13 +93,6 @@ func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
|
||||
a.DeptApp.Update(dept)
|
||||
}
|
||||
|
||||
// @Summary 删除部门
|
||||
// @Description 删除数据
|
||||
// @Tags 部门
|
||||
// @Param deptId path string true "deptId, 逗号隔开"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dept/{deptId} [delete]
|
||||
func (a *DeptApi) DeleteDept(rc *restfulx.ReqCtx) {
|
||||
deptId := restfulx.PathParam(rc, "deptId")
|
||||
deptIds := utils.IdsStrToIdsIntGroup(deptId)
|
||||
|
||||
@@ -15,17 +15,6 @@ type DictApi struct {
|
||||
DictData services.SysDictDataModel
|
||||
}
|
||||
|
||||
// @Summary 字典类型列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param dictName query string false "DictName"
|
||||
// @Param dictName query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -42,28 +31,11 @@ func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictId path int true "dictId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/{dictId} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := restfulx.PathParamInt(rc, "dictId")
|
||||
p.DictType.FindOne(int64(dictId))
|
||||
}
|
||||
|
||||
// @Summary 添加字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictType true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
restfulx.BindQuery(rc, &dict)
|
||||
@@ -72,16 +44,6 @@ func (p *DictApi) InsertDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Insert(dict)
|
||||
}
|
||||
|
||||
// @Summary 修改字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictType true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
restfulx.BindQuery(rc, &dict)
|
||||
@@ -90,13 +52,6 @@ func (p *DictApi) UpdateDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Update(dict)
|
||||
}
|
||||
|
||||
// @Summary 删除字典类型
|
||||
// @Description 删除数据
|
||||
// @Tags 字典
|
||||
// @Param dictId path string true "dictId "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/{dictId} [delete]
|
||||
func (p *DictApi) DeleteDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := restfulx.PathParam(rc, "dictId")
|
||||
dictIds := utils.IdsStrToIdsIntGroup(dictId)
|
||||
@@ -114,15 +69,6 @@ func (p *DictApi) DeleteDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Delete(deList)
|
||||
}
|
||||
|
||||
// @Summary 导出字典类型
|
||||
// @Description 导出数据
|
||||
// @Tags 字典
|
||||
// @Param dictName query string false "DictName"
|
||||
// @Param dictName query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
func (p *DictApi) ExportDictType(rc *restfulx.ReqCtx) {
|
||||
filename := restfulx.QueryParam(rc, "filename")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
@@ -135,15 +81,6 @@ func (p *DictApi) ExportDictType(rc *restfulx.ReqCtx) {
|
||||
rc.Download(fileName)
|
||||
}
|
||||
|
||||
// @Summary 字典数据列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictLabel query string false "dictLabel"
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataList(rc *restfulx.ReqCtx) {
|
||||
dictLabel := restfulx.QueryParam(rc, "dictLabel")
|
||||
dictType := restfulx.QueryParam(rc, "dictType")
|
||||
@@ -151,41 +88,17 @@ func (p *DictApi) GetDictDataList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = p.DictData.FindList(entity.SysDictData{Status: status, DictType: dictType, DictLabel: dictLabel})
|
||||
}
|
||||
|
||||
// @Summary 字典数据获取
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictType path string false "dictType"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/type [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataListByDictType(rc *restfulx.ReqCtx) {
|
||||
dictType := restfulx.QueryParam(rc, "dictType")
|
||||
biz.IsTrue(dictType != "", "请传入字典类型")
|
||||
rc.ResData = p.DictData.FindList(entity.SysDictData{DictType: dictType})
|
||||
}
|
||||
|
||||
// @Summary 获取字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictCode path int true "dictCode"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/{dictCode} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictData(rc *restfulx.ReqCtx) {
|
||||
dictCode := restfulx.PathParamInt(rc, "dictCode")
|
||||
p.DictData.FindOne(int64(dictCode))
|
||||
}
|
||||
|
||||
// @Summary 添加字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictData true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -193,16 +106,6 @@ func (p *DictApi) InsertDictData(rc *restfulx.ReqCtx) {
|
||||
p.DictData.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictData true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -211,13 +114,6 @@ func (p *DictApi) UpdateDictData(rc *restfulx.ReqCtx) {
|
||||
p.DictData.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除字典数据
|
||||
// @Description 删除数据
|
||||
// @Tags 字典
|
||||
// @Param dictCode path string true "dictCode "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/data/{dictCode} [delete]
|
||||
func (p *DictApi) DeleteDictData(rc *restfulx.ReqCtx) {
|
||||
dictCode := restfulx.PathParam(rc, "dictCode")
|
||||
p.DictData.Delete(utils.IdsStrToIdsIntGroup(dictCode))
|
||||
|
||||
@@ -16,39 +16,17 @@ type MenuApi struct {
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
// @Summary 获取菜单树
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/menu/menuTreSelect [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeSelect(rc *restfulx.ReqCtx) {
|
||||
lable := m.MenuApp.SelectMenuLable(entity.SysMenu{})
|
||||
rc.ResData = lable
|
||||
}
|
||||
|
||||
// @Summary 登陆成功获取的路由,根据角色名称获取菜单列表数据(左菜单使用)
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuRole [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuRole(rc *restfulx.ReqCtx) {
|
||||
roleKey := restfulx.QueryParam(rc, "roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = Build(*m.MenuApp.SelectMenuRole(roleKey))
|
||||
}
|
||||
|
||||
// @Summary 获取角色的菜单树
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param roleId path int false "roleId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc, "roleId")
|
||||
|
||||
@@ -63,30 +41,12 @@ func (m *MenuApi) GetMenuTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取角色对应的菜单路径数组
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param roleKey query string true "roleKey"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuPaths [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuPaths(rc *restfulx.ReqCtx) {
|
||||
roleKey := restfulx.QueryParam(rc, "roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = m.RoleMenuApp.GetMenuPaths(entity.SysRoleMenu{RoleName: roleKey})
|
||||
}
|
||||
|
||||
// @Summary Menu列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param menuName query string false "menuName"
|
||||
// @Param IsHide query string false "IsHide"
|
||||
// @Param title query string false "title"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuList [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenuList(rc *restfulx.ReqCtx) {
|
||||
menuName := restfulx.QueryParam(rc, "menuName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
@@ -99,28 +59,12 @@ func (m *MenuApi) GetMenuList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary Menu列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param menuId path string true "menuId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/{menuId} [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenu(rc *restfulx.ReqCtx) {
|
||||
menuId := restfulx.PathParamInt(rc, "menuId")
|
||||
|
||||
rc.ResData = m.MenuApp.FindOne(int64(menuId))
|
||||
}
|
||||
|
||||
// @Summary 创建菜单
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param data body entity.SysMenu true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/menu [post]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) InsertMenu(rc *restfulx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
restfulx.BindQuery(rc, &menu)
|
||||
@@ -134,14 +78,6 @@ func (m *MenuApi) InsertMenu(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 修改菜单
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param data body entity.SysMenu true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /system/menu [put]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) UpdateMenu(rc *restfulx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
restfulx.BindQuery(rc, &menu)
|
||||
@@ -155,13 +91,6 @@ func (m *MenuApi) UpdateMenu(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 删除菜单
|
||||
// @Description 删除数据
|
||||
// @Tags 菜单
|
||||
// @Param menuId path int true "menuId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/menu/{menuId} [delete]
|
||||
func (m *MenuApi) DeleteMenu(rc *restfulx.ReqCtx) {
|
||||
menuId := restfulx.PathParam(rc, "menuId")
|
||||
m.MenuApp.Delete(utils.IdsStrToIdsIntGroup(menuId))
|
||||
|
||||
@@ -13,16 +13,7 @@ type NoticeApi struct {
|
||||
NoticeApp services.SysNoticeModel
|
||||
}
|
||||
|
||||
// @Summary 通知列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 通知
|
||||
// @Param noticeType query string false "noticeType"
|
||||
// @Param title query string false "title"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post [get]
|
||||
// @Security
|
||||
// GetNoticeList 通知列表数据
|
||||
func (p *NoticeApi) GetNoticeList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -45,16 +36,7 @@ func (p *NoticeApi) GetNoticeList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 添加通知
|
||||
// @Description 获取JSON
|
||||
// @Tags 通知
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysNotice true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/notice [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertNotice 添加通知
|
||||
func (p *NoticeApi) InsertNotice(rc *restfulx.ReqCtx) {
|
||||
var notice entity.SysNotice
|
||||
restfulx.BindQuery(rc, ¬ice)
|
||||
@@ -62,16 +44,7 @@ func (p *NoticeApi) InsertNotice(rc *restfulx.ReqCtx) {
|
||||
p.NoticeApp.Insert(notice)
|
||||
}
|
||||
|
||||
// @Summary 修改通知
|
||||
// @Description 获取JSON
|
||||
// @Tags 通知
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysNotice true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/notice [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateNotice 修改通知
|
||||
func (p *NoticeApi) UpdateNotice(rc *restfulx.ReqCtx) {
|
||||
var notice entity.SysNotice
|
||||
restfulx.BindQuery(rc, ¬ice)
|
||||
@@ -79,13 +52,7 @@ func (p *NoticeApi) UpdateNotice(rc *restfulx.ReqCtx) {
|
||||
p.NoticeApp.Update(notice)
|
||||
}
|
||||
|
||||
// @Summary 删除通知
|
||||
// @Description 删除数据
|
||||
// @Tags 通知
|
||||
// @Param noticeId path string true "noticeId "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/notice/{noticeId} [delete]
|
||||
// DeleteNotice 删除通知
|
||||
func (p *NoticeApi) DeleteNotice(rc *restfulx.ReqCtx) {
|
||||
noticeId := restfulx.PathParam(rc, "noticeId")
|
||||
noticeIds := utils.IdsStrToIdsIntGroup(noticeId)
|
||||
|
||||
@@ -17,17 +17,7 @@ type PostApi struct {
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
// @Summary 职位列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param postName query string false "postName"
|
||||
// @Param postCode query string false "postCode"
|
||||
// @Param status query string false "status"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post [get]
|
||||
// @Security
|
||||
// GetPostList 职位列表数据
|
||||
func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -51,28 +41,13 @@ func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param postId path int true "postId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post/{postId} [get]
|
||||
// @Security
|
||||
// GetPost 获取职位
|
||||
func (p *PostApi) GetPost(rc *restfulx.ReqCtx) {
|
||||
postId := restfulx.PathParamInt(rc, "postId")
|
||||
p.PostApp.FindOne(int64(postId))
|
||||
}
|
||||
|
||||
// @Summary 添加职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysPost true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertPost 添加职位
|
||||
func (p *PostApi) InsertPost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
restfulx.BindQuery(rc, &post)
|
||||
@@ -81,16 +56,7 @@ func (p *PostApi) InsertPost(rc *restfulx.ReqCtx) {
|
||||
p.PostApp.Insert(post)
|
||||
}
|
||||
|
||||
// @Summary 修改职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysPost true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdatePost 修改职位
|
||||
func (p *PostApi) UpdatePost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
restfulx.BindQuery(rc, &post)
|
||||
@@ -99,13 +65,7 @@ func (p *PostApi) UpdatePost(rc *restfulx.ReqCtx) {
|
||||
p.PostApp.Update(post)
|
||||
}
|
||||
|
||||
// @Summary 删除职位
|
||||
// @Description 删除数据
|
||||
// @Tags 职位
|
||||
// @Param postId path string true "postId "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/post/{postId} [delete]
|
||||
// DeletePost 删除职位
|
||||
func (p *PostApi) DeletePost(rc *restfulx.ReqCtx) {
|
||||
postId := restfulx.PathParam(rc, "postId")
|
||||
postIds := utils.IdsStrToIdsIntGroup(postId)
|
||||
|
||||
@@ -20,17 +20,7 @@ type RoleApi struct {
|
||||
RoleDeptApp services.SysRoleDeptModel
|
||||
}
|
||||
|
||||
// @Summary 角色列表数据
|
||||
// @Description Get JSON
|
||||
// @Tags 角色
|
||||
// @Param roleName query string false "roleName"
|
||||
// @Param status query string false "status"
|
||||
// @Param roleKey query string false "roleKey"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/role/rolelist [get]
|
||||
// @Security
|
||||
// GetRoleList角色列表数据
|
||||
func (r *RoleApi) GetRoleList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -53,14 +43,7 @@ func (r *RoleApi) GetRoleList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取Role数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
// @Param roleId path string true "roleId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/role [get]
|
||||
// @Security X-TOKEN
|
||||
// GetRole 获取Role数据
|
||||
func (r *RoleApi) GetRole(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc, "roleId")
|
||||
role := r.RoleApp.FindOne(int64(roleId))
|
||||
@@ -69,15 +52,7 @@ func (r *RoleApi) GetRole(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = role
|
||||
}
|
||||
|
||||
// @Summary 创建角色
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysRole true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/role [post]
|
||||
// InsertRole 创建角色
|
||||
func (r *RoleApi) InsertRole(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindQuery(rc, &role)
|
||||
@@ -91,15 +66,7 @@ func (r *RoleApi) InsertRole(rc *restfulx.ReqCtx) {
|
||||
casbin.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// @Summary 修改用户角色
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysRole true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role [put]
|
||||
// UpdateRole 修改用户角色
|
||||
func (r *RoleApi) UpdateRole(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindQuery(rc, &role)
|
||||
@@ -115,15 +82,7 @@ func (r *RoleApi) UpdateRole(rc *restfulx.ReqCtx) {
|
||||
casbin.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// @Summary 修改用户角色状态
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysRole true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role/changeStatus [put]
|
||||
// UpdateRoleStatus 修改用户角色状态
|
||||
func (r *RoleApi) UpdateRoleStatus(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindQuery(rc, &role)
|
||||
@@ -132,15 +91,7 @@ func (r *RoleApi) UpdateRoleStatus(rc *restfulx.ReqCtx) {
|
||||
r.RoleApp.Update(role)
|
||||
}
|
||||
|
||||
// @Summary 修改用户角色部门
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysRole true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
|
||||
// @Router /system/role/dataScope [put]
|
||||
// UpdateRoleDataScope 修改用户角色部门
|
||||
func (r *RoleApi) UpdateRoleDataScope(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindQuery(rc, &role)
|
||||
@@ -155,13 +106,7 @@ func (r *RoleApi) UpdateRoleDataScope(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 删除用户角色
|
||||
// @Description 删除数据
|
||||
// @Tags 角色/Role
|
||||
// @Param roleId path string true "roleId 多个用,分割"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/role/{roleId} [delete]
|
||||
// DeleteRole 删除用户角色
|
||||
func (r *RoleApi) DeleteRole(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParam(rc, "roleId")
|
||||
roleIds := utils.IdsStrToIdsIntGroup(roleId)
|
||||
@@ -188,15 +133,7 @@ func (r *RoleApi) DeleteRole(rc *restfulx.ReqCtx) {
|
||||
r.RoleMenuApp.DeleteRoleMenus(delList)
|
||||
}
|
||||
|
||||
// @Summary 导出角色
|
||||
// @Description 导出数据
|
||||
// @Tags 角色
|
||||
// @Param roleName query string false "roleName"
|
||||
// @Param status query string false "status"
|
||||
// @Param roleKey query string false "roleKey"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
// ExportRole 导出角色
|
||||
func (p *RoleApi) ExportRole(rc *restfulx.ReqCtx) {
|
||||
filename := restfulx.QueryParam(rc, "filename")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
|
||||
@@ -56,7 +56,7 @@ func (s *System) ServerInfo(request *restful.Request, response *restful.Response
|
||||
})
|
||||
}
|
||||
|
||||
// 连接websocket
|
||||
// ConnectWs 连接websocket
|
||||
func (s *System) ConnectWs(request *restful.Request, response *restful.Response) {
|
||||
wsConn, err := ws.Upgrader.Upgrade(response, request.Request, nil)
|
||||
defer func() {
|
||||
|
||||
@@ -36,21 +36,13 @@ type UserApi struct {
|
||||
LogLogin logServices.LogLoginModel
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 获取验证码
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/getCaptcha [get]
|
||||
// GenerateCaptcha 获取验证码
|
||||
func (u *UserApi) GenerateCaptcha(request *restful.Request, response *restful.Response) {
|
||||
id, image := captcha.Generate()
|
||||
response.WriteEntity(map[string]any{"base64Captcha": image, "captchaId": id})
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 刷新token
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/refreshToken [get]
|
||||
// RefreshToken 刷新token
|
||||
func (u *UserApi) RefreshToken(rc *restfulx.ReqCtx) {
|
||||
tokenStr := rc.Request.Request.Header.Get("X-TOKEN")
|
||||
j := token.NewJWT("", []byte(global.Conf.Jwt.Key), jwt.SigningMethodHS256)
|
||||
@@ -59,12 +51,7 @@ func (u *UserApi) RefreshToken(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = map[string]any{"token": token, "expire": time.Now().Unix() + global.Conf.Jwt.ExpireTime}
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户登录
|
||||
// @Produce application/json
|
||||
// @Param data body form.Login true "用户名, 密码, 验证码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/login [post]
|
||||
// Login 用户登录
|
||||
func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
||||
var l form.Login
|
||||
restfulx.BindQuery(rc, &l)
|
||||
@@ -112,12 +99,7 @@ func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
||||
u.LogLogin.Insert(loginLog)
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户权限信息
|
||||
// @Param userName query string false "userName"
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"成功"}"
|
||||
// @Router /system/user/auth [get]
|
||||
// Auth 用户权限信息
|
||||
func (u *UserApi) Auth(rc *restfulx.ReqCtx) {
|
||||
userName := restfulx.QueryParam(rc, "username")
|
||||
biz.NotEmpty(userName, "用户名必传")
|
||||
@@ -137,11 +119,7 @@ func (u *UserApi) Auth(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 退出登录
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
|
||||
// @Router /system/user/logout [post]
|
||||
// LogOut 退出登录
|
||||
func (u *UserApi) LogOut(rc *restfulx.ReqCtx) {
|
||||
var loginLog logEntity.LogLogin
|
||||
ua := user_agent.New(rc.Request.Request.UserAgent())
|
||||
@@ -158,18 +136,7 @@ func (u *UserApi) LogOut(rc *restfulx.ReqCtx) {
|
||||
u.LogLogin.Insert(loginLog)
|
||||
}
|
||||
|
||||
// @Summary 列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Param userName query string false "userName"
|
||||
// @Param phone query string false "phone"
|
||||
// @Param status query string false "status"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/user/sysUserList [get]
|
||||
// @Security X-TOKEN
|
||||
// GetSysUserList 列表数据
|
||||
func (u *UserApi) GetSysUserList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -197,12 +164,7 @@ func (u *UserApi) GetSysUserList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取当前登录用户
|
||||
// @Description 获取JSON
|
||||
// @Tags 个人中心
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/profile [get]
|
||||
// @Security
|
||||
// GetSysUserProfile 获取当前登录用户
|
||||
func (u *UserApi) GetSysUserProfile(rc *restfulx.ReqCtx) {
|
||||
|
||||
sysUser := entity.SysUser{}
|
||||
@@ -232,13 +194,7 @@ func (u *UserApi) GetSysUserProfile(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 修改头像
|
||||
// @Description 修改头像
|
||||
// @Tags 用户
|
||||
// @Param file formData file true "file"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/user/profileAvatar [post]
|
||||
// InsetSysUserAvatar 修改头像
|
||||
func (u *UserApi) InsetSysUserAvatar(rc *restfulx.ReqCtx) {
|
||||
form := rc.Request.Request.MultipartForm
|
||||
|
||||
@@ -258,13 +214,7 @@ func (u *UserApi) InsetSysUserAvatar(rc *restfulx.ReqCtx) {
|
||||
u.UserApp.Update(sysuser)
|
||||
}
|
||||
|
||||
// @Summary 修改密码
|
||||
// @Description 修改密码
|
||||
// @Tags 用户
|
||||
// @Param pwd body entity.SysUserPwd true "pwd"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/user/updatePwd [post]
|
||||
// SysUserUpdatePwd 修改密码
|
||||
func (u *UserApi) SysUserUpdatePwd(rc *restfulx.ReqCtx) {
|
||||
var pws entity.SysUserPwd
|
||||
restfulx.BindQuery(rc, &pws)
|
||||
@@ -274,13 +224,7 @@ func (u *UserApi) SysUserUpdatePwd(rc *restfulx.ReqCtx) {
|
||||
u.UserApp.SetPwd(user, pws)
|
||||
}
|
||||
|
||||
// @Summary 获取用户
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Param userId path int true "用户编码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/sysUser/{userId} [get]
|
||||
// @Security
|
||||
// GetSysUser 获取用户
|
||||
func (u *UserApi) GetSysUser(rc *restfulx.ReqCtx) {
|
||||
userId := restfulx.PathParamInt(rc, "userId")
|
||||
|
||||
@@ -309,12 +253,7 @@ func (u *UserApi) GetSysUser(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取添加用户角色和职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/getInit [get]
|
||||
// @Security
|
||||
// GetSysUserInit 获取添加用户角色和职位
|
||||
func (u *UserApi) GetSysUserInit(rc *restfulx.ReqCtx) {
|
||||
|
||||
var role entity.SysRole
|
||||
@@ -333,12 +272,7 @@ func (u *UserApi) GetSysUserInit(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = mp
|
||||
}
|
||||
|
||||
// @Summary 获取添加用户角色和职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/user/getInit [get]
|
||||
// @Security
|
||||
// GetUserRolePost 获取添加用户角色和职位
|
||||
func (u *UserApi) GetUserRolePost(rc *restfulx.ReqCtx) {
|
||||
var user entity.SysUser
|
||||
user.UserId = rc.LoginAccount.UserId
|
||||
@@ -361,15 +295,7 @@ func (u *UserApi) GetUserRolePost(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = mp
|
||||
}
|
||||
|
||||
// @Summary 创建用户
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysUser true "用户数据"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [post]
|
||||
// InsertSysUser 创建用户
|
||||
func (u *UserApi) InsertSysUser(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
restfulx.BindQuery(rc, &sysUser)
|
||||
@@ -377,15 +303,7 @@ func (u *UserApi) InsertSysUser(rc *restfulx.ReqCtx) {
|
||||
u.UserApp.Insert(sysUser)
|
||||
}
|
||||
|
||||
// @Summary 修改用户数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysUser true "用户数据"g
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [put]
|
||||
// UpdateSysUser 修改用户数据
|
||||
func (u *UserApi) UpdateSysUser(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
restfulx.BindQuery(rc, &sysUser)
|
||||
@@ -393,15 +311,7 @@ func (u *UserApi) UpdateSysUser(rc *restfulx.ReqCtx) {
|
||||
u.UserApp.Update(sysUser)
|
||||
}
|
||||
|
||||
// @Summary 修改用户状态
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysUser true "用户数据"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/user/sysUser [put]
|
||||
// UpdateSysUserStu 修改用户状态
|
||||
func (u *UserApi) UpdateSysUserStu(rc *restfulx.ReqCtx) {
|
||||
var sysUser entity.SysUser
|
||||
restfulx.BindQuery(rc, &sysUser)
|
||||
@@ -409,27 +319,13 @@ func (u *UserApi) UpdateSysUserStu(rc *restfulx.ReqCtx) {
|
||||
u.UserApp.Update(sysUser)
|
||||
}
|
||||
|
||||
// @Summary 删除用户数据
|
||||
// @Description 删除数据
|
||||
// @Tags 用户
|
||||
// @Param userId path int true "多个id 使用逗号隔开"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/user/sysuser/{userId} [delete]
|
||||
// DeleteSysUser 删除用户数据
|
||||
func (u *UserApi) DeleteSysUser(rc *restfulx.ReqCtx) {
|
||||
userIds := restfulx.PathParam(rc, "userId")
|
||||
u.UserApp.Delete(utils.IdsStrToIdsIntGroup(userIds))
|
||||
}
|
||||
|
||||
// @Summary 导出用户
|
||||
// @Description 导出数据
|
||||
// @Tags 用户
|
||||
// @Param userName query string false "userName"
|
||||
// @Param phone query string false "phone"
|
||||
// @Param status query string false "status"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
// ExportUser 导出用户
|
||||
func (u *UserApi) ExportUser(rc *restfulx.ReqCtx) {
|
||||
filename := restfulx.QueryParam(rc, "filename")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
|
||||
Reference in New Issue
Block a user