| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /**
- * @Author: zou.yingbin
- * @Create : 2021/1/13 11:15
- * @Modify : 2021/1/13 11:15
- */
- package ermcp
- import (
- "github.com/gin-gonic/gin"
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/models"
- "mtp2_if/mtpcache"
- "net/http"
- )
- //查询现货商品请求
- type QryWrStandardReq struct {
- UserId int `form:"userid" binding:"required"` //用户ID
- }
- //查询现货商品响应
- type QryWrStandardRsp models.ErmcpWrstandard
- // QueryWrStandard 企业风险管理查询现货商品
- // @Summary 查询现货商品
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "所属机构ID"
- // @Success 200 {array} QryWrStandardRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QueryWrStandard [get]
- // @Tags 企业风险管理(app)
- func QueryWrStandard(c *gin.Context) {
- appG := app.Gin{C: c}
- var req QryWrStandardReq
- if err := c.ShouldBind(&req); err != nil {
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- m := models.ErmcpWrstandard{AREAUSERID: req.UserId}
- if d, err := m.GetData(); err == nil {
- for i := range d {
- d[i].EnumdicName = mtpcache.GetEnumDicitemName(d[i].UNITID)
- }
- appG.Response(http.StatusOK, e.SUCCESS, d)
- } else {
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- }
- }
- ///////////////////////////////
- //查询现货商品请求
- type QryWrStandardDetailReq struct {
- UserId int `form:"userid" binding:"required"` //用户ID
- Wrstandardid int `form:"wrstandardid" binding:"required"` // 现货商品ID
- }
- //查询现货商品响应
- type QryWrStandardDetailRsp models.ErmcpWrstandDetail
- // @Summary 查询现货商品详情(菜单:现货品种/现货品种详情)
- // @Produce json
- // @Security ApiKeyAuth
- // @Param userid query int true "所属机构ID"
- // @Param wrstandardid query int true "现货商品ID"
- // @Success 200 {array} QryWrStandardDetailRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QueryWrStandardDetail [get]
- // @Tags 企业风险管理(app)
- func QueryWrStandardDetail(c *gin.Context) {
- appG := app.Gin{C: c}
- var req QryWrStandardDetailReq
- if err := c.ShouldBind(&req); err != nil {
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- m := models.ErmcpWrstandDetail{Wrd: models.ErmcpWrstandard{AREAUSERID: req.UserId,
- WRSTANDARDID: int64(req.Wrstandardid)}}
- if d, err := m.GetData(); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, d)
- } else {
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- }
- }
|