This commit is contained in:
2023-05-26 17:52:34 +08:00
parent dd1ab6e74e
commit 21632ef7cb
13 changed files with 96 additions and 18 deletions

View File

@ -354,4 +354,15 @@ public interface RedisService {
* @return // List<clazz>
*/
<T> List<T> getObjectList(String key, Class<T> clazz);
/**
* hGetObject
*
* @param key key
* @param hashKey hashKey
* @param clazz clazz
* @param <T> T
* @return clazz
*/
<T> T hGetObject(String key, String hashKey, Class<T> clazz);
}

View File

@ -229,6 +229,12 @@ public class RedisServiceImpl implements RedisService {
return (List<T>) get(key);
}
@Override
@SuppressWarnings("unchecked")
public <T> T hGetObject(String key, String hashKey, Class<T> clazz) {
return (T) hGet(key, hashKey);
}
private String handleKey(String key) {
StringBuilder sb = new StringBuilder();
sb.append("tenant_").append(BaseContext.getTenantId()).append(":").append(key);

View File

@ -1,5 +1,8 @@
package com.qiaoba.common.web.utils;
import cn.hutool.json.JSONUtil;
import com.qiaoba.common.base.result.AjaxResult;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -18,4 +21,8 @@ public class ResponseUtil {
response.getWriter().write(msg);
}
public static void errorAuth(HttpServletResponse response, Integer code, String msg) throws IOException {
AjaxResult result = AjaxResult.error(code, msg);
response(response, JSONUtil.toJsonStr(result));
}
}