package kr.co.jinwoosi.clfd.clfd.dgns.service;

import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsDtlMapper;
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtl;
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtlSearch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DgnsDtlService {

    public static List<DgnsDtl> cashedDgnsDtlList = null;

    @Autowired
    private DgnsDtlMapper dgnsDtlMapper;

    public List<DgnsDtl> selectList(DgnsDtlSearch dgnsDtlSearch) {
        return dgnsDtlMapper.selectList(dgnsDtlSearch);
    }

    public DgnsDtl select(DgnsDtlSearch dgnsDtlSearch) {
        return dgnsDtlMapper.select(dgnsDtlSearch);
    }

    public List<DgnsDtl> getCashedDgnsDtlList(boolean refresh) {
        if (refresh || cashedDgnsDtlList == null) {
            cashedDgnsDtlList = selectList(new DgnsDtlSearch());
        }
        return cashedDgnsDtlList;
    }
}
