package com.hssx.pcbms.controller;


import com.hssx.pcbms.entity.GoodsTags;
import com.hssx.pcbms.entity.vo.GoodsVO;
import com.hssx.pcbms.service.GoodsTagsService;
import com.hssx.pcbms.util.HttpRespMsg;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴涛涛
 * @since 2019-10-25
 */
@RestController
@RequestMapping("/goodstags")
public class GoodsTagsController {
    @Autowired
    private GoodsTagsService goodsTagsService;

    /**
     * 标签的添加或修改
     * 参数：
     * name ：名称
     * 修改需要传 id:标签id
     * @return
     */
    @ApiOperation(value = "标签的添加或修改", notes = "标签的添加或修改方法")
    @RequestMapping("/addOrUpdate")
    @ResponseBody
    public HttpRespMsg adaddOrUpdated(GoodsTags goodsTags) {
        HttpRespMsg msg = goodsTagsService.add(goodsTags);
        return msg;
    }

    /**
     * 标签的列表
     * 参数:  keyName:关键字（非必传）
     * @return
     */
    @ApiOperation(value = "标签的列表", notes = "标签的列表")
    @RequestMapping("/list")
    @ResponseBody
    public HttpRespMsg list(@RequestParam(required = false)String keyName) {
        HttpRespMsg msg = goodsTagsService.getListByKeyName(keyName);
        return msg;
    }
    /**
     *
     * 删除分类标签
     * 参数:
     * @return
     */
    @ApiOperation(value = "删除分类标签", notes = "删除分类标签")
    @RequestMapping("/delTags")
    @ResponseBody
    public HttpRespMsg delTags(GoodsTags goodsTags) {
        HttpRespMsg msg = goodsTagsService.delTags(goodsTags);
        return msg;
    }
}

