package com.sckw.usual.controller;

import com.sckw.usual.entity.req.KwOrderDictReq;
import com.sckw.usual.service.OrderDictService;
import com.sckw.core.web.response.HttpResult;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @desc:
 * @author: lt
 * @date: 2024/4/3 17:33
 */
@Validated
@RestController
@RequestMapping("/dict")
public class DictController {


    @Autowired
    OrderDictService orderDictService;

    /**
     * @desc: 字典新增
     * @author: lt
     * @date: 2024/4/3 17:35
     */
    @PostMapping(value = "/dictInsert")
    public HttpResult dictInsert(@RequestBody @Valid KwOrderDictReq kwOrderDictReq)
    {
        return HttpResult.ok(orderDictService.dictInsert(kwOrderDictReq));
    }

    @GetMapping("/getDictData")
    public HttpResult getDictData(@RequestParam("group") String group)
    {
        return HttpResult.ok(orderDictService.getDictData(group));
    }

}
