/*
 * 文 件 名:  DimTableController
 * 版    权:  浩鲸云计算科技股份有限公司
 * 描    述:  <描述>
 * 修 改 人:  lvwenbin
 * 修改时间:  2024/7/30
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.ruoyi.ems.controller;

import com.huashe.common.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.ems.domain.DevProcess;
import com.ruoyi.ems.domain.ElecPriceType;
import com.ruoyi.ems.domain.EmsCls;
import com.ruoyi.ems.domain.EmsTag;
import com.ruoyi.ems.model.TreeEntity;
import com.ruoyi.ems.service.IDevProcessService;
import com.ruoyi.ems.service.IElecPriceTypeService;
import com.ruoyi.ems.service.IEmsClsService;
import com.ruoyi.ems.service.IEmsTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 公共数据接口
 * <功能详细描述>
 *
 * @author lvwenbin
 * @version [版本号, 2024/7/30]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@RestController
@RequestMapping("/common")
@Api(value = "CommonController", description = "公共数据接口")
public class CommonController extends BaseController {
    @Autowired
    private IElecPriceTypeService valencyTypeService;

    @Autowired
    private IEmsClsService emsClsService;

    @Autowired
    private IEmsTagService emsTagService;

    @Autowired
    private IDevProcessService processService;

    /**
     * 电价分类
     *
     * @return 分类列表
     */
    @GetMapping(value = "/elecprice/type")
    @ApiOperation(value = "getElecPriceType", notes = "维表-查询电价分类列表")
    public AjaxResult getElecPriceType() {
        List<ElecPriceType> types = valencyTypeService.selectElecPriceTypeList(new ElecPriceType());
        return success(types);
    }

    /**
     * 能源种类数
     *
     * @return 能源种类数
     */
    @GetMapping(value = "/emscls/tree")
    @ApiOperation(value = "getEmsClsTree", notes = "树结构-查询能源种类树")
    public AjaxResult getEmsClsTree() {
        List<TreeEntity> types = emsClsService.selectEmsClsTreeList(new EmsCls());
        return success(types);
    }

    /**
     * 标签列表
     *
     * @return 标签列表
     */
    @GetMapping(value = "/emstag")
    @ApiOperation(value = "getEmsTag", notes = "维表-查询标签列表")
    public AjaxResult getEmsTag(@RequestParam(name = "tagModel", required = false) String tagModel) {
        EmsTag param = new EmsTag();
        param.setTagModel(tagModel);
        List<EmsTag> types = emsTagService.selectEmsTagList(param);
        return success(types);
    }


    @GetMapping("/devProcess")
    @ApiOperation(value = "getDevProcess", notes = "维表-查询工艺类型")
    public AjaxResult getDevProcess(DevProcess devProcess)
    {
        List<DevProcess> list =  processService.selectDevProcessList(devProcess);
        return success(list);
    }
}