package com.ruoyi.cms.controller.app;

import com.ruoyi.cms.domain.BussinessDictData;
import com.ruoyi.cms.domain.CommercialArea;
import com.ruoyi.cms.domain.SubwayLine;
import com.ruoyi.cms.service.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.TreeSelect;
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;
import java.util.Map;

@RestController
@RequestMapping("/app/common")
@Api(tags = "移动端：常用参数查询")
public class AppCommonController extends BaseController {
    @Autowired
    private ISubwayLineService iSubwayLineService;
    @Autowired
    private ICommercialAreaService iCommercialAreaService;
    @Autowired
    private IJobTitleService iJobTitleService;
    @Autowired
    private IIndustryService industryService;
    @Autowired
    private IBussinessDictTypeService iBussinessDictTypeService;
    @ApiOperation("查询地铁")
    @GetMapping("/subway")
    public AjaxResult subway()
    {
        List<SubwayLine> list = iSubwayLineService.appSubway();
        return success(list);
    }
    @ApiOperation("查询商圈")
    @GetMapping("/commercialArea")
    public AjaxResult commercialArea()
    {
        List<CommercialArea> list = iCommercialAreaService.appCommercialArea();
        return success(list);
    }
    @ApiOperation("查询职业 树结构")
    @GetMapping("/jobTitle/treeselect")
    public AjaxResult jobTitle()
    {
        List<TreeSelect> jobTitleList = iJobTitleService.appJobTitle();
        return success(jobTitleList);
    }
    @ApiOperation("查询行业 树结构")
    @GetMapping("/industry/treeselect")
    public AjaxResult industry()
    {
        List<TreeSelect> industryList = industryService.appIndustry();
        return success(industryList);
    }
    @ApiOperation("查询字典")
    @GetMapping("/dict/{dictType}")
    public AjaxResult listDict(@PathVariable String dictType)
    {
        List<BussinessDictData> dictData = iBussinessDictTypeService.selectDictDataByType(dictType);
        return success(dictData);
    }
    @ApiOperation("字段标准")
    @GetMapping("/standar/filed")
    public AjaxResult standarFiled()
    {
        Map<String,Object> filed = iBussinessDictTypeService.standarFiled();
        return success(filed);
    }
}
