lbq
12 小时以前 2cb2fbb2663d975c3812def5c49c8b7495bfb6aa
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java
@@ -9,13 +9,13 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
 * Created by vincent on 1/30/2024
 */
public class BaseController {
    public User getLoginUser() {
        try {
            Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
@@ -42,6 +42,21 @@
    }
    public <T extends BaseParam> T buildParam(Map<String, Object> map, Class<T> clz) {
        if (!Objects.isNull(map.get("meta"))) {
            Map<String, Object> meta = (Map<String, Object>) map.get("meta");
            meta.keySet().forEach(key -> {
                map.put(key, meta.get(key));
            });
            map.remove("meta");
        }
        // 移除筛选条件里面的 $
        for (String key : map.keySet()) {
            Object value = map.get(key);
            if (key.equals("orderBy")) {
                String newValue = value.toString().replace("$", "");
                map.replace("orderBy", value, newValue);
            }
        }
        T t  = null;
        try {
            t = clz.getDeclaredConstructor().newInstance();