package com.sqx.modules.sys.controller.app;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sqx.common.utils.Result;
import com.sqx.modules.sys.entity.SysDictEntity;
import com.sqx.modules.sys.service.SysDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据字典
 *
 */
@RestController
@RequestMapping("app/dict")
@Api(value = "项目分类", tags = {"项目分类"})
public class AppDictController {
    @Autowired
    private SysDictService sysDictService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ApiOperation("项目分类列表")
    public Result list(String type){
        SysDictEntity sysDictEntity = sysDictService.getOne(new QueryWrapper<SysDictEntity>().eq("type", type));
        List<SysDictEntity> sysDictEntityList = sysDictService.list(new QueryWrapper<SysDictEntity>().eq("status",1).eq( "parent_id", sysDictEntity.getId()).orderByDesc("order_num"));
        return Result.success().put("data", sysDictEntityList);
    }



}
