package com.inkasso.factoring.dict.web;

import com.inkasso.adapter.response.SuccessResponseData;
import com.inkasso.factoring.dict.service.DictionaryService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/dictionary")
public class DictionaryController {

    private static Logger log = LogManager.getLogger(DictionaryController.class);
    @Autowired
    private DictionaryService dictionaryService;

    @RequestMapping("/do_findByParentId")
    @ResponseBody
    public Object do_findByParentId(Long parentId) {
        return dictionaryService.findByParentId(parentId);
    }

    @RequestMapping("/do_findByParentCode")
    @ResponseBody
    public Object do_findByParentName(String parentCode) {
        return new SuccessResponseData(dictionaryService.findByParentCode(parentCode));
    }


}
