package com.dsk.cscec.controller;

import com.dsk.common.core.domain.R;
import com.dsk.cscec.domain.DProjectType;
import com.dsk.cscec.domain.TreeSelect;
import com.dsk.cscec.service.DProjectTypeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 维表：工程类型，源于IPM(DProjectType)表控制层
 *
 * @author sxk
 * @since 2024-01-05 11:45:43
 */
@RestController
@RequestMapping("/dProjectType")
public class DProjectTypeController {
    /**
     * 服务对象
     */
    @Resource
    private DProjectTypeService dProjectTypeService;

    /**
     * 获取所有工程类型
     * @param
     * @return
     */
    @GetMapping("/getAll")
    public R<List<TreeSelect>> selectList() {
        return R.ok(dProjectTypeService.getList(new DProjectType()));
    }

    /**
     * 根据工程类型id获取子级
     * @param projectTypeId
     * @return
     */
    @GetMapping("/getChildren")
    public R<List<DProjectType>> getChildren(String projectTypeId) {
        return R.ok(dProjectTypeService.getChildren(projectTypeId));
    }
}

