| | |
| | | "silkserver/extend/code" |
| | | "silkserver/extend/util" |
| | | "silkserver/models" |
| | | "strconv" |
| | | ) |
| | | |
| | | type RawSilkStandardController struct { |
| | |
| | | // @Tags 系统设置/生丝定价标准 |
| | | // @Summary 获取生丝定价标准 |
| | | // @Produce application/json |
| | | // @Param object body models.RawSilkPriceStandard true "参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Param object query request.GetPriceStandard true "参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.RawSilkPriceStandard} "成功" |
| | | // @Router /api-jl/v1/system/getPriceStandardList [get] |
| | | func (slf RawSilkStandardController) GetPriceStandardList(c *gin.Context) { |
| | | var param request.GetPriceStandard |
| | | err := c.BindJSON(¶m) |
| | | err := c.ShouldBindQuery(¶m) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | |
| | | util.ResponseFormat(c, code.SelectError, "查询失败") |
| | | return |
| | | } |
| | | util.ResponseFormatList(c, code.Success, list, int(total)) |
| | | util.ResponseFormatList(c, code.Success, list, total) |
| | | } |
| | | |
| | | // DeletePriceStandard |
| | | // |
| | | // @Tags 系统设置/生丝定价标准 |
| | | // @Summary 删除生丝定价标准 |
| | | // @Produce application/json |
| | | // @Param id path string true "id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-jl/v1/system/deletePriceStandard/{id} [delete] |
| | | func (slf RawSilkStandardController) DeletePriceStandard(c *gin.Context) { |
| | | id := c.Param("id") |
| | | if id == "" { |
| | | util.ResponseFormat(c, code.RequestParamError, "无效的id") |
| | | return |
| | | } |
| | | atoi, err := strconv.Atoi(id) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "数据转换失败") |
| | | return |
| | | } |
| | | err = models.NewRawSilkPriceStandardSearch().SetId(atoi).Delete() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "删除失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.RequestParamError, "删除成功") |
| | | } |