package com.microservices.pms.product.controller;

import com.microservices.common.core.web.controller.BaseController;
import com.microservices.common.core.web.domain.GenericsAjaxResult;
import com.microservices.pms.product.domain.vo.PmsTypeDataVo;
import com.microservices.pms.product.domain.vo.PmsTypeSearchVo;
import com.microservices.pms.product.service.IPmsProductStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 产品状态Controller
 * 
 * @author otto
 * @date 2023-10-16
 */
@Api(tags = "项目管理-产品下状态相关接口")
@RestController
@RequestMapping("/{enterpriseIdentifier}/pmsProductStatus")
@ApiImplicitParams({
        @ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
})
public class PmsProductStatusController extends BaseController
{
    @Autowired
    private IPmsProductStatusService pmsProductStatusService;

    /**
     * 查询产品状态列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "查询产品状态列表")
    public  List<PmsTypeDataVo> list(@Validated PmsTypeSearchVo pmsTypeSearchVo)
    {
        return pmsProductStatusService.selectPmsProductStatusList(pmsTypeSearchVo.toPmsProductStatus());
    }

    /**
     * 获取产品状态详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取产品状态详细信息")
    public GenericsAjaxResult<PmsTypeDataVo> getInfo(@PathVariable("id") Long id)
    {
        return genericsSuccess(pmsProductStatusService.selectPmsProductStatusById(id));
    }
}
