package sgc.portal.base.web;

import sgc.portal.base.model.ComData;
import sgc.portal.base.model.FileAll;
import sgc.portal.base.service.ComSearchService;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.base.util.ValidChk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**********************************************************
 * 시스템명  : 시스템관리(COM)
 * 프로그램ID : ComPopupController
 * 프로그램명   : 공통으로 사용하는  Controller
 * @author  : mir(aaaa@aaa.co.kr)
 * @version  :  2020-10-12
 * @since JDK1.8
 * @see   1.최초 작성
 */
@RestController
public class ComSearchController {

    @Autowired
    private ComSearchService comSearchService;

    /**
     * Select prg auth list.
     * 사용자별프로그램 권한정보 조회
     *
     * @param comdatas the comdatas
     * @return list
     * @throws Exception
     */
    @GetMapping(value = "/com/cmm/selectPrgAuth")
    public EasyHashMap<String, Object> selectPrgAuth(ComData comdatas) {
        if (!ValidChk.isStringDouble(comdatas.getSearchData1()) || !ValidChk.isStringDouble(comdatas.getSearchData2())) {
            return null;
        }
        return comSearchService.selectPrgAuth(comdatas);
    }

    /**
     * Select pymtdedc list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//지급공제항목
    @PostMapping(value = "/com/cmm/selectPymtdedc")
    public List<EasyHashMap<String, Object>> selectPymtdedc(@RequestBody ComData comdatas) {
        return comSearchService.selectPymtdedc(comdatas);
    }

    /**
     * Select acvm pool list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//일반직 업적평가Pool 조회
    @PostMapping(value = "/com/cmm/selectAcvmPool")
    public List<EasyHashMap<String, Object>> selectAcvmPool(@RequestBody ComData comdatas) {
        return comSearchService.selectAcvmPool(comdatas);
    }

    /**
     * Select rewa pr list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//상벌공통코드 조회
    @PostMapping(value = "/com/cmm/selectRewaPR")
    public List<EasyHashMap<String, Object>> selectRewaPR(@RequestBody ComData comdatas) {
        return comSearchService.selectRewaPR(comdatas);
    }

    /**
     * Select com dtl list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//공통코드 조회(대분류코드와 설정코드1의 조건으로 공통코드 조회)
    @PostMapping(value = "/com/cmm/selectComDtl")
    public List<EasyHashMap<String, Object>> selectComDtl(@RequestBody ComData comdatas) {
        return comSearchService.selectComDtl(comdatas);
    }

    /**
     * Select com dtl 2 list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//공통코드 조회(대분류코드와 설정코드2의 조건으로 공통코드 조회)
    @PostMapping(value = "/com/cmm/selectComDtl2")
    public List<EasyHashMap<String, Object>> selectComDtl2(@RequestBody ComData comdatas) {
        return comSearchService.selectComDtl2(comdatas);
    }

    /**
     * Select com dtl 4 list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//공통코드 조회(대분류코드와 설정코드4의 조건으로 공통코드 조회)
    @PostMapping(value = "/com/cmm/selectComDtl4")
    public List<EasyHashMap<String, Object>> selectComDtl4(@RequestBody ComData comdatas) {
        return comSearchService.selectComDtl4(comdatas);
    }

    /**
     * Select com evdc list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//증빙코드정보 조회( 2020-04-12 mir)
    @PostMapping(value = "/com/cmm/selectComEvdc")
    public List<EasyHashMap<String, Object>> selectComEvdc(@RequestBody ComData comdatas) {
        return comSearchService.selectComEvdc(comdatas);
    }

    /**
     * Select hdlg auth list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//업무 취급 권한 정보 조회( 2020-07-02 blue3819)
    @PostMapping(value = "/com/cmm/selectHdlgAuth")
    public List<EasyHashMap<String, Object>> selectHdlgAuth(@RequestBody ComData comdatas) {
        return comSearchService.selectHdlgAuth(comdatas);
    }

    /**
     * Select com bank list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//은행정보 조회( 2020-07-02 mir)
    @PostMapping(value = "/com/cmm/selectComBank")
    public List<EasyHashMap<String, Object>> selectComBank(@RequestBody ComData comdatas) {
        return comSearchService.selectComBank(comdatas);
    }

    /**
     * Select com acct list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//은행계좌정보 조회( 2020-07-02 mir)
    @PostMapping(value = "/com/cmm/selectComAcct")
    public List<EasyHashMap<String, Object>> selectComAcct(@RequestBody ComData comdatas) {
        return comSearchService.selectComAcct(comdatas);
    }

    /**
     * Select com map bsu cd list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//사업장 코드 조회( 2020-08-28 ax5656)
    @PostMapping(value = "/com/cmm/selectComMapBsuCd")
    public List<EasyHashMap<String, Object>> selectComMapBsuCd(@RequestBody ComData comdatas) {
        return comSearchService.selectComMapBsuCd(comdatas);
    }


    /**
     * Select ba lacl cd list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//사업운영의 집행예산코드 대분류 조회(2019-07-22 Mir)
    @PostMapping(value = "/com/cmm/selectBaLaclCd")
    public List<EasyHashMap<String, Object>> selectBaLaclCd(@RequestBody ComData comdatas) {
        return comSearchService.selectBaLaclCd(comdatas);
    }

    /**
     * Select ba mdcl cd list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//사업운영의 집행예산코드 중분류 조회(2019-07-22 Mir)
    @PostMapping(value = "/com/cmm/selectBaMdclCd")
    public List<EasyHashMap<String, Object>> selectBaMdclCd(@RequestBody ComData comdatas) {
        return comSearchService.selectBaMdclCd(comdatas);
    }

    /**
     * Select ba com exto std list.
     *
     * @param comdatas the comdatas
     * @return the list
     */
//표준집행예산코드 조회 (2019-07-30 Mir)
    @PostMapping(value = "/com/cmm/selectBaComExtoStd")
    public List<EasyHashMap<String, Object>> selectBaComExtoStd(@RequestBody ComData comdatas) {
        return comSearchService.selectBaComExtoStd(comdatas);
    }

    /**
     * 파일ID에 맞는 모든 파일을 조회한다.
     *
     * @return 파일목록
     */
    @PostMapping("/com/cmm/selectAllFileList")
    public List<FileAll> selectAllFileList(@RequestBody FileAll fileAll) {
        return comSearchService.selectAllFileList(fileAll);
    }
}
