package sgc.portal.cw.cw0103.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import sgc.portal.base.util.AddressUtils;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.base.websquare.GridRowStatus;
import sgc.portal.cw.cw0103.dto.CW01030001USearch;
import sgc.portal.cw.cw0103.model.CW01030001U;
import sgc.portal.cw.cw0103.persistence.CW01030001UMapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class CW01030001UService {
    private final CW01030001UMapper mapper;

    public CW01030001UService(CW01030001UMapper mapper) {
        this.mapper = mapper;
    }

    public List<EasyHashMap<String, Object>> getList(CW01030001USearch search) {
        return mapper.getList(search);
    }

    @Transactional
    public Map<String, String> save(List<CW01030001U> CW01030001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
    	for (CW01030001U cW01030001U : CW01030001U) {
            insert(cW01030001U);
        }
    	return result;
    }

    private void insert(CW01030001U cW01030001U) {
        mapper.insert(cW01030001U);
    }
}
