All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kasinf.framework.rest.web.service.BaseServiceImpl Maven / Gradle / Ivy

The newest version!
package com.kasinf.framework.rest.web.service;

import cn.hutool.core.util.StrUtil;
import com.kasinf.framework.core.util.ReflectUtils;
import com.kasinf.framework.rest.repository.BaseRepository;
import com.kasinf.framework.rest.eneity.AbstractEntity;
import com.kasinf.framework.rest.web.util.SearchableBeanUtils;

import java.io.Serializable;

public class BaseServiceImpl implements BaseService {

    protected BaseRepository baseRepository;

    @Override
    @SuppressWarnings("unchecked")
    public BaseRepository getBaseRepository() {
        if (baseRepository == null) {
            Class classz = ReflectUtils.findParameterizedType(getClass(), 0);
            if (classz != null) {
                String className = StrUtil.lowerFirst(classz.getSimpleName());
                baseRepository = SearchableBeanUtils.getRepositoryLike(className);
            }
        }
        return baseRepository;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy