package com.yuanchu.mom.common; import cn.hutool.json.JSONUtil; import com.yuanchu.mom.mapper.AuthMapper; import com.yuanchu.mom.utils.Jwt; import com.yuanchu.mom.utils.ServletUtils; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; @Component public class GetLook { @Resource private AuthMapper authMapper; public Map selectPowerByMethodAndUserId(String method){ Integer id = Integer.parseInt(JSONUtil.parseObj(new Jwt().readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id")+""); Map map = new HashMap<>(); map.put("userId", id); map.put("look", authMapper.countPower(id, method)); return map; } }