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.IPmsProductPriorityService;
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}/pmsProductPriority")
@ApiImplicitParams({
        @ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
})
public class PmsProductPriorityController extends BaseController
{
    @Autowired
    private IPmsProductPriorityService pmsProductPriorityService;

    /**
     * 查询产品优先级列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "查询产品优先级列表")
    public List<PmsTypeDataVo> list(@Validated PmsTypeSearchVo pmsTypeSearchVo)
    {
        return pmsProductPriorityService.selectPmsProductPriorityList(pmsTypeSearchVo.toPmsProductPriority());
    }

    /**
     * 获取产品优先级详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取产品优先级详细信息")
    public GenericsAjaxResult<PmsTypeDataVo> getInfo(@PathVariable("id") Long id)
    {
        return genericsSuccess(pmsProductPriorityService.selectPmsProductPriorityById(id));
    }
}
