/**
* @Author: zou.yingbin
* @Create  : 2021/3/10 15:04
* @Modify  : 2021/3/10 15:04
 */

package ermcp

import (
	"github.com/gin-gonic/gin"
	"mtp2_if/global/app"
	"mtp2_if/models"
	"mtp2_if/mtpcache"
)

// QryWarehouseReq 仓库查询请求参数
type QryWarehouseReq struct {
	UserId int64  `form:"userid" binding:"required"` //用户ID
	Status string `form:"status"`                    // 仓库状态(可多项,逗号隔开) 1:正常 2:注销 3:待审核 4:审核拒绝
}

// QryWarehouseRsp 仓库查询响应
type QryWarehouseRsp models.ErmcpWareHouseInfo

// QryWarehouseInfo
// @Summary 查询仓库信息
// @Produce json
// @Security ApiKeyAuth
// @Param userid query int true "用户ID"
// @Param status query string false "仓库状态(可多项,逗号隔开) 1:正常 2:注销 3:待审核 4:审核拒绝"
// @Success 200 {array} QryWarehouseRsp
// @Failure 500 {object} app.Response
// @Router /Ermcp/QueryWarehouseInfo [get]
// @Tags 企业风险管理(app)
func QueryWarehouseInfo(c *gin.Context) {
	a := app.NewGinUtils(c)
	req := QryWarehouseReq{}
	a.DoBindReq(&req)
	m := models.ErmcpWareHouseInfo{AREAUSERID: mtpcache.GetAreaUserId(req.UserId, 0),
		FilterStatus: req.Status}
	a.DoGetDataI(&m)
}
