package com.ruoyi.applet.contoller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.model.domain.Indexconfig;
import com.ruoyi.model.domain.IndexconfigIcon;
import com.ruoyi.model.service.IIndexconfigIconService;
import com.ruoyi.model.service.IIndexconfigService;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(description = "工作台图标")
@RestController
@RequestMapping("/applet/indexIcon")
public class AppletIndexIconController extends BaseController {

    @Autowired
    private IIndexconfigIconService indexconfigIconService;

    @Autowired
    private IIndexconfigService indexConfigService;

    @ApiOperation("未加入的工作台图标配置查询")
    @GetMapping("/indexConfigIcon/{identity}")
    public AjaxResult getIndexConfigIcon(@PathVariable Long identity){
        IndexconfigIcon indexconfigIconByIdentity = indexconfigIconService.getIndexconfigIconByIdentity(identity);
        return AjaxResult.success(indexconfigIconByIdentity);
    }

    @ApiOperation("已加入的工作台图标配置查询")
    @GetMapping("/indexConfig/{indexType}")
    public TableDataInfo getIndexConfig(@PathVariable Long indexType){
        return getDataTable(indexConfigService.getIndexconfigList(indexType));
    }
}
