package com.yiqi.admin.controller.core;

import java.util.List;

import com.yiqi.core.domain.dto.ClothFlawTopDTO;
import com.yiqi.core.domain.vo.ClothFlawTopVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yiqi.common.annotation.Log;
import com.yiqi.common.core.controller.BaseController;
import com.yiqi.common.core.domain.AjaxResult;
import com.yiqi.common.enums.BusinessType;
import com.yiqi.core.domain.ClothFlawTop;
import com.yiqi.core.service.IClothFlawTopService;
import com.yiqi.common.core.page.TableDataInfo;

/**
 * 衣服瑕疵置顶Controller
 *
 * @author ruoyi
 * @date 2023-08-08
 */
@RestController
@RequestMapping("/mapi/core/flawTop")
public class ClothFlawTopController extends BaseController {
    @Autowired
    private IClothFlawTopService clothFlawTopService;

    /**
    * 查询衣服瑕疵置顶列表
    */
    @PreAuthorize("@ss.hasPermi('cloth:flawTop:list')")
    @GetMapping("/list")
    public TableDataInfo list(ClothFlawTop clothFlawTop) {
        startPage();
        List<ClothFlawTopVo> list = clothFlawTopService.selectClothFlawTopList(clothFlawTop);
        return getDataTable(list);
    }

    /**
     * 获取衣服瑕疵置顶详细信息
     */
    @PreAuthorize("@ss.hasPermi('cloth:flawTop:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(clothFlawTopService.selectClothFlawTopById(id));
    }

    /**
     * 修改衣服瑕疵置顶
     */
    @PreAuthorize("@ss.hasPermi('cloth:flawTop:edit')")
    @Log(title = "衣服瑕疵置顶", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ClothFlawTopDTO clothFlawTopDTO) {
        return toAjax(clothFlawTopService.updateClothFlawTop(clothFlawTopDTO));
    }


}
