package sgc.portal.cw.cw0603.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.base.websquare.GridRowStatus;
import sgc.portal.cw.cw0603.dto.CW06030001USearch;
import sgc.portal.cw.cw0603.model.CW06030001U;
import sgc.portal.cw.cw0603.persistence.CW06030001UMapper;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CW06030001UService {
    private final CW06030001UMapper mapper;

    public CW06030001UService(CW06030001UMapper mapper) {
        this.mapper = mapper;
    }

    public List<EasyHashMap<String, Object>> getList(CW06030001USearch search) {
        return mapper.getList(search);
    }
    
    @Transactional
    public Map<String, String> approve(List<CW06030001U> CW06030001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
        for (CW06030001U cW06030001U : CW06030001U) {
        	approve(cW06030001U);
        }
        return result;
    }
    
    private void approve(CW06030001U cW06030001U) {
        mapper.approve(cW06030001U);
    }
}
