|
|
@@ -375,3 +375,141 @@ func toString(v interface{}) string {
|
|
|
}
|
|
|
return ""
|
|
|
}
|
|
|
+
|
|
|
+// FindNewFuncmenu 获取菜单表数据
|
|
|
+// @Summary 获取菜单表数据
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param resourcecode query string false "资源代码"
|
|
|
+// @Param parentcode query string false "上级资源代码"
|
|
|
+// @Param resourcename query string false "资源名(Title), 模糊查询"
|
|
|
+// @Success 200 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Common/FindNewFuncmenu [get]
|
|
|
+// @Tags 通用服务
|
|
|
+func FindNewFuncmenu(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req models.NewFuncmenulistReq
|
|
|
+ if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("FindNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ newFuncmenulist := models.NewFuncmenulist{}
|
|
|
+ rst, err := newFuncmenulist.Find(req)
|
|
|
+ if err != nil {
|
|
|
+ // 查询失败
|
|
|
+ logger.GetLogger().Errorf("FindNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询成功
|
|
|
+ logger.GetLogger().Debugln("FindNewFuncmenu successed")
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, rst)
|
|
|
+}
|
|
|
+
|
|
|
+// InsertNewFuncmenu 插入菜单表数据
|
|
|
+// @Summary 插入菜单表数据
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param data body models.NewFuncmenulist true "菜单表数据"
|
|
|
+// @Success 200 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Common/InsertNewFuncmenu [post]
|
|
|
+// @Tags 通用服务
|
|
|
+func InsertNewFuncmenu(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req models.NewFuncmenulist
|
|
|
+ if err := appG.C.ShouldBindJSON(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("InsertNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err := req.Insert()
|
|
|
+ if err != nil {
|
|
|
+ // 失败
|
|
|
+ logger.GetLogger().Errorf("InsertNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ logger.GetLogger().Debugln("InsertNewFuncmenu successed")
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, struct{}{})
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateNewFuncmenu 更新菜单表数据
|
|
|
+// @Summary 更新菜单表数据
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param data body models.NewFuncmenulist true "菜单表数据"
|
|
|
+// @Success 200 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Common/UpdateNewFuncmenu [put]
|
|
|
+// @Tags 通用服务
|
|
|
+func UpdateNewFuncmenu(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req models.NewFuncmenulist
|
|
|
+ if err := appG.C.ShouldBindJSON(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("UpdateNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err := req.Update()
|
|
|
+ if err != nil {
|
|
|
+ // 失败
|
|
|
+ logger.GetLogger().Errorf("UpdateNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ logger.GetLogger().Debugln("UpdateNewFuncmenu successed")
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, struct{}{})
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteNewFuncmenu 删除菜单表数据
|
|
|
+// @Summary 删除菜单表数据
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param data body models.NewFuncmenulist true "菜单表数据,只需要resourcecode字段即可"
|
|
|
+// @Success 200 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Common/DeleteNewFuncmenu [delete]
|
|
|
+// @Tags 通用服务
|
|
|
+func DeleteNewFuncmenu(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req models.NewFuncmenulist
|
|
|
+ if err := appG.C.ShouldBindJSON(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("DeleteNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ err := req.Delete()
|
|
|
+ if err != nil {
|
|
|
+ // 失败
|
|
|
+ logger.GetLogger().Errorf("DeleteNewFuncmenu failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ logger.GetLogger().Debugln("DeleteNewFuncmenu successed")
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, struct{}{})
|
|
|
+}
|