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

xyz.erupt.upms.looker.LookerSelf Maven / Gradle / Ivy

The newest version!
package xyz.erupt.upms.looker;

import org.springframework.stereotype.Component;
import xyz.erupt.annotation.PreDataProxy;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.annotation.query.Condition;
import xyz.erupt.core.context.MetaContext;
import xyz.erupt.upms.helper.HyperModelCreatorVo;
import xyz.erupt.upms.service.EruptUserService;

import javax.annotation.Resource;
import javax.persistence.MappedSuperclass;
import java.util.List;

/**
 * @author YuePeng
 * date 2021/3/10 11:30
 */
@MappedSuperclass
@PreDataProxy(LookerSelf.Comp.class)
public class LookerSelf extends HyperModelCreatorVo implements DataProxy {

    @Component
    static class Comp implements DataProxy {

        @Resource
        private EruptUserService eruptUserService;

        @Override
        public String beforeFetch(List conditions) {
            if (eruptUserService.getCurrentEruptUser().getIsAdmin()) return null;
            return MetaContext.getErupt().getName() + ".createUser.id = " + eruptUserService.getCurrentUid();
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy