| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package workflow
- import (
- "github.com/gin-gonic/gin"
- "server/dao"
- "server/global"
- "server/model/common/response"
- "strconv"
- )
- type DescriptionApi struct{}
- func (da *DescriptionApi) QueryDescriptionByProjectProcessId(c *gin.Context) {
- id := c.Query("projectProcessId")
- projectProcessId, err := strconv.Atoi(id)
- if err != nil {
- response.FailWithMessage("参数错误", c)
- global.GVA_LOG.Error("QueryDescriptionByProjectProcessId ====== " + err.Error())
- return
- }
- description, err := descriptionService.QueryDescriptionByProjectProcessId(projectProcessId)
- if err != nil {
- response.FailWithMessage("查询失败", c)
- global.GVA_LOG.Error("QueryDescriptionByProjectProcessId ====== " + err.Error())
- return
- }
- response.OkWithData(description, c)
- }
- func (da *DescriptionApi) CreateDescription(c *gin.Context) {
- var description dao.Description
- err := c.ShouldBindJSON(&description)
- if err != nil {
- response.FailWithMessage("参数错误", c)
- global.GVA_LOG.Error("CreateDescription ====== " + err.Error())
- return
- }
- err = descriptionService.CreateDescription(description)
- if err != nil {
- response.FailWithMessage("创建失败", c)
- global.GVA_LOG.Error("CreateDescription ====== " + err.Error())
- return
- }
- response.OkWithMessage("创建成功", c)
- }
- func (da *DescriptionApi) UpdateDescription(c *gin.Context) {
- var description dao.Description
- err := c.ShouldBindJSON(&description)
- if err != nil {
- response.FailWithMessage("参数错误", c)
- global.GVA_LOG.Error("UpdateDescription ====== " + err.Error())
- return
- }
- err = descriptionService.UpdateDescription(description)
- if err != nil {
- response.FailWithMessage("更新失败", c)
- global.GVA_LOG.Error("UpdateDescription ====== " + err.Error())
- return
- }
- response.OkWithMessage("更新成功", c)
- }
- func (da *DescriptionApi) DeleteDescription(c *gin.Context) {
- var description dao.Description
- err := c.ShouldBindJSON(&description)
- if err != nil {
- response.FailWithMessage("参数错误", c)
- global.GVA_LOG.Error("UpdateDescription ====== " + err.Error())
- return
- }
- err = descriptionService.DeleteDescription(description)
- if err != nil {
- response.FailWithMessage("删除失败", c)
- global.GVA_LOG.Error("DeleteDescription ====== " + err.Error())
- return
- }
- response.OkWithMessage("删除成功", c)
- }
|