package org.dromara.erp.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.erp.domain.query.ErpColorQuery;
import org.dromara.erp.domain.vo.ErpColorVo;
import org.dromara.erp.service.IErpColorService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ERP 颜色控制器
 *
 * @Author: Antigravity
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/erp/color")
public class ErpColorController {

    private final IErpColorService erpColorService;

    /**
     * 查询 ERP 颜色列表（按父级ID分级）
     * parentRowId 为空时查询第一级（parentRowId IS NULL），非空时查询下级
     * @Author: Trae
     */
    @GetMapping("/list")
    public R<List<ErpColorVo>> list(ErpColorQuery query) {
        return R.ok(erpColorService.queryList(query));
    }

}
