package com.persagy.dye.controller;

import cn.hutool.core.collection.CollectionUtil;
import com.persagy.common.utils.ResponseResult;
import com.persagy.common.utils.ResponseUtil;
import com.persagy.dye.pojo.vo.DyeScaleplateVO;
import com.persagy.dye.service.IDyeSdkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @description: sdk调用染色标尺相关接口
 * @author: YangWanYi
 * @create: 2021-10-25 18:16
 **/
@Api(tags = "sdk调用相关接口")
@RestController
@RequestMapping(value = "/dye/sdk", method = RequestMethod.POST)
public class DyeSdkController {

    @Autowired
    private IDyeSdkService dyeSdkService;


    /**
     * 查询空间对应的染色标尺
     * @param dyeScaleplateVO
     * @return
     */
    @ApiOperation(value = "根据空间查询对应染色标尺")
    @RequestMapping(value = "listDyeScaleplateWithSpaceIds")
    public ResponseResult listDyeScaleplateWithSpaceIds(@RequestBody DyeScaleplateVO dyeScaleplateVO) {
        List<Map<String, Object>> result = this.dyeSdkService.listDyeScaleplateWithSpaceIds(dyeScaleplateVO);
        return ResponseUtil.successResult(result, CollectionUtil.isEmpty(result) ? 0L : result.size());
    }

    /**
     * 查询指定集团、项目和类型的染色标尺列表
     * @param dyeScaleplateVO
     * @return
     */
    @ApiOperation(value = "查询指定集团、项目和类型的染色标尺列表")
    @RequestMapping(value = "listDyeScaleplateByType")
    public ResponseResult listDyeScaleplateByType(@RequestBody DyeScaleplateVO dyeScaleplateVO) {
        List<Map<String, Object>> result = this.dyeSdkService.listDyeScaleplateByType(dyeScaleplateVO);
        return ResponseUtil.successResult(result, CollectionUtil.isEmpty(result) ? 0L : result.size());
    }


}
