package sgc.portal.cw.cw0631.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.cw0631.model.CW06310001U;
import sgc.portal.cw.cw0631.dto.CW06310001USearch;
import sgc.portal.cw.cw0631.persistence.CW06310001UMapper;

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

@Service
public class CW06310001UService {
    private final CW06310001UMapper mapper;

    public CW06310001UService(CW06310001UMapper mapper) {
        this.mapper = mapper;
    }

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