package top.cardone.usercenter.func;

import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import top.cardone.context.ApplicationContextHolder;
import top.cardone.security.shiro.func.ReadPrincipalFunc;
import top.cardone.usercenter.service.UserService;

import java.util.Map;

/**
 * Created by Administrator on 2016/7/11.
 */
public class ReadOneCreatedByIdFunc extends ReadPrincipalFunc {
    @Override
    public String func() {
        String userCode = super.func();

        if (StringUtils.isBlank(userCode)) {
            return null;
        }

        Map<String, Object> readOneInputs = Maps.newHashMap();

        readOneInputs.put("userCode", userCode);
        readOneInputs.put("object_id", "userId");

        return ApplicationContextHolder.getBean(UserService.class).readOneCache(String.class, readOneInputs);
    }

    @Override
    public String func(Map<String, Object> stringObjectMap) {
        return this.func();
    }
}

package top.cardone.usercenter.func;

import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import top.cardone.context.ApplicationContextHolder;
import top.cardone.security.shiro.func.ReadPrincipalFunc;
import top.cardone.usercenter.service.UserService;

import java.util.Map;

/**
 * Created by Administrator on 2016/7/11.
 */
public class ReadOneCreatedByIdFunc extends ReadPrincipalFunc {
    @Override
    public String func() {
        String userCode = super.func();

        if (StringUtils.isBlank(userCode)) {
            return null;
        }

        Map<String, Object> readOneInputs = Maps.newHashMap();

        readOneInputs.put("userCode", userCode);
        readOneInputs.put("object_id", "userId");

        return ApplicationContextHolder.getBean(UserService.class).readOneCache(String.class, readOneInputs);
    }

    @Override
    public String func(Object object) {
        return this.func();
    }
}

fix bug