package sgc.portal.cw.cw0609.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.cw0609.model.CW06090001U;
import sgc.portal.cw.cw0609.dto.CW06090001USearch;
import sgc.portal.cw.cw0609.persistence.CW06090001UMapper;

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

@Service
public class CW06090001UService {
    private final CW06090001UMapper mapper;

    public CW06090001UService(CW06090001UMapper mapper) {
        this.mapper = mapper;
    }

    public List<EasyHashMap<String, Object>> getList(CW06090001USearch search) {
        return mapper.getList(search);
    }
    
    @Transactional
    public Map<String, String> save(List<CW06090001U> CW06090001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
        for (CW06090001U cW06090001U : CW06090001U) {
        	save(cW06090001U);
        }
        return result;
    }
    
    private void save(CW06090001U cW06090001U) {
        mapper.save(cW06090001U);
    }
    
    @Transactional
    public Map<String, String> updateConf(List<CW06090001U> CW06090001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
        for (CW06090001U cW06090001U : CW06090001U) {
        	updateConf(cW06090001U);
        }
        return result;
    }
    
    private void updateConf(CW06090001U cW06090001U) {
        mapper.updateConf(cW06090001U);
    }
    
    @Transactional
    public Map<String, String> updateReturn(List<CW06090001U> CW06090001U) {
    	
    	Map<String,String> result = new HashMap<>();
    	
        for (CW06090001U cW06090001U : CW06090001U) {
        	updateReturn(cW06090001U);
        }
        return result;
    }
    
    private void updateReturn(CW06090001U cW06090001U) {
        mapper.updateReturn(cW06090001U);
    }
    
    
}
