package sgc.portal.com.com.web;

import org.springframework.web.bind.annotation.GetMapping;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.com.com.model.Cmpn;
import sgc.portal.com.com.service.ComCmpnMngService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import sgc.portal.security.annotation.Secured;
import sgc.portal.security.annotation.SecurityPolicy;

import java.util.List;

/**********************************************************
 * 시스템명  : 시스템관리(COM)
 * 프로그램ID : ComCmpnMngController
 * 프로그램명   : 회사정보관리 Controller
 * @author      : Kim Gyu Yong(aaaa@aaa.co.kr)
 * @version   :  2020-08-28
 * @since JDK1.8
 * @see
 * 1. 최초 작성
**********************************************************/
@RestController
public class ComCmpnMngController {
	@Autowired
	private ComCmpnMngService comCmpnMngService;

	@GetMapping("/com/companies")
    @Secured(policy = SecurityPolicy.NONE)
    public List<EasyHashMap<String, Object>> getAll() {
        return comCmpnMngService.getAll();
    }

    @GetMapping("/com/companies_as")
    @Secured(policy = SecurityPolicy.NONE)
    public List<EasyHashMap<String, Object>> getAsAll() {
        return comCmpnMngService.getAsAll();
    }
    
    @PostMapping(value = "/com/com/companies")
    public List<EasyHashMap<String, Object>> getCmpn(@RequestBody Cmpn cmpns) {
        return comCmpnMngService.getCmpn(cmpns);
    }
    
	@PostMapping(value = "/com/com/selectComCmpnMng")
    public List<EasyHashMap<String, Object>> selectComCmpnMng(@RequestBody Cmpn cmpns) {
	    return comCmpnMngService.selectComCmpnMng(cmpns);
    }

    @PostMapping(value = "/com/com/saveComCmpnMng")
    public void saveComCmpnMng(@RequestBody List<Cmpn> cmpns) {
        comCmpnMngService.saveComCmpnMng(cmpns);
    }
}
