|
|
package BaseBusinessController
|
|
|
|
|
|
import (
|
|
|
"dsBaseWeb/Business/BaseBusiness/BaseBusinessService"
|
|
|
"dsBaseWeb/Model"
|
|
|
"dsBaseWeb/Utils/CommonUtil"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
|
)
|
|
|
|
|
|
//模块的路由配置
|
|
|
func Routers(r *gin.RouterGroup) {
|
|
|
rr := r.Group("/business")
|
|
|
//配置接口
|
|
|
rr.POST("/AddBaseBusiness", AddBaseBusiness)
|
|
|
rr.POST("/DeleteBaseBusiness", DeleteBaseBusiness)
|
|
|
rr.POST("/UpdateBaseBusiness", UpdateBaseBusiness)
|
|
|
rr.GET("/GetBaseBusiness", GetBaseBusiness)
|
|
|
rr.GET("/PageBaseBusiness", PageBaseBusiness)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// @Summary 增加业务系统信息
|
|
|
// @Description 增加业务系统信息
|
|
|
// @Tags 业务系统维护
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param businessCode formData string true "业务系统编码"
|
|
|
// @Param businessName formData string true "业务系统名称"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /base/business/AddBaseBusiness [post]
|
|
|
// @X-EmptyLimit ["businessCode","businessName"]
|
|
|
// @X-LengthLimit [{"businessCode":"6:6"},{"businessName":"1:50"}]
|
|
|
// @X-RoleLimit ["1"]
|
|
|
func AddBaseBusiness(c *gin.Context) {
|
|
|
//业务系统编码
|
|
|
businessCode := c.PostForm("businessCode")
|
|
|
//业务系统名称
|
|
|
businessName := c.PostForm("businessName")
|
|
|
r, err := BaseBusinessService.AddBaseBusiness(businessCode, businessName, 1)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: r.Success,
|
|
|
Message: r.Message,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 删除业务系统信息
|
|
|
// @Description 删除业务系统信息
|
|
|
// @Tags 业务系统维护
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param businessCode formData string true "业务系统编码"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /base/business/DeleteBaseBusiness [post]
|
|
|
// @X-EmptyLimit ["businessCode"]
|
|
|
// @X-LengthLimit [{"businessCode":"6,6"}]
|
|
|
// @X-RoleLimit ["1"]
|
|
|
func DeleteBaseBusiness(c *gin.Context) {
|
|
|
//业务系统编码
|
|
|
/*
|
|
|
businessCode := c.PostForm("businessCode")
|
|
|
r, err := BaseBusinessService.DeleteBaseBusiness(businessCode)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: r.Success,
|
|
|
Message: r.Message,
|
|
|
})
|
|
|
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
// @Summary 修改业务系统信息
|
|
|
// @Description 修改业务系统信息
|
|
|
// @Tags 业务系统维护
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param businessCode formData string true "业务系统编码"
|
|
|
// @Param businessName formData string true "业务系统名称"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /base/business/UpdateBaseBusiness [post]
|
|
|
// @X-EmptyLimit ["businessCode","businessName"]
|
|
|
// @X-LengthLimit [{"businessCode":"6,6"},{"businessName":"1:50"}]
|
|
|
// @X-RoleLimit ["1"]
|
|
|
func UpdateBaseBusiness(c *gin.Context) {
|
|
|
//业务系统编码
|
|
|
businessCode := c.PostForm("businessCode")
|
|
|
//业务系统名称
|
|
|
businessName := c.PostForm("businessName")
|
|
|
r, err := BaseBusinessService.UpdateBaseBusiness(businessCode, businessName)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: r.Success,
|
|
|
Message: r.Message,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取业务系统信息(单条)
|
|
|
// @Description 获取业务系统信息(单条)
|
|
|
// @Tags 业务系统维护
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param businessCode query string true "业务系统编码"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /base/business/GetBaseBusiness [get]
|
|
|
// @X-EmptyLimit ["businessCode"]
|
|
|
// @X-LengthLimit [{"businessCode":"6,6"}]
|
|
|
// @X-RoleLimit ["1"]
|
|
|
func GetBaseBusiness(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
// @Summary 获取业务系统信息(列表)
|
|
|
// @Description 获取业务系统信息(列表)
|
|
|
// @Tags 业务系统维护
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param page query int true "第几页"
|
|
|
// @Param limit query int true "一页显示多少条"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /base/business/PageBaseBusiness [get]
|
|
|
// @X-EmptyLimit ["page","limit"]
|
|
|
// @X-IntLimit ["page","limit"]
|
|
|
// @X-RoleLimit ["1"]
|
|
|
func PageBaseBusiness(c *gin.Context) {
|
|
|
//第几页
|
|
|
page := CommonUtil.ConvertStringToInt32(c.Query("page"))
|
|
|
//一页显示多少条
|
|
|
limit := CommonUtil.ConvertStringToInt32(c.Query("limit"))
|
|
|
r, err := BaseBusinessService.PageBaseBusiness(page, limit)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: r.Success,
|
|
|
Message: r.Message,
|
|
|
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
|
|
|
Count: r.Count,
|
|
|
})
|
|
|
}
|