Junjie
21 小时以前 c97c04770c17c36c554963bf8bb8d8fafc6a8d43
src/main/java/com/zy/asrs/controller/BasMapController.java
@@ -13,7 +13,6 @@
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.common.utils.NavigateSolution;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -37,6 +36,16 @@
        return R.ok(basMapService.getById(String.valueOf(id)));
    }
    @GetMapping("/basMap/payload/{id}/auth")
    @ManagerAuth
    public R getPayload(@PathVariable("id") Integer id) {
        BasMap basMap = basMapService.selectPayloadById(id);
        if (basMap == null) {
            return R.error("地图不存在");
        }
        return R.ok(basMap);
    }
    @RequestMapping(value = "/basMap/list/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
@@ -51,7 +60,7 @@
        allLike(BasMap.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));}
        wrapper.orderBy(true, true, "lev");
        return R.ok(basMapService.page(new Page<>(curr, limit), wrapper));
        return R.ok(basMapService.pageLight(new Page<>(curr, limit), wrapper));
    }
    private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){
@@ -73,7 +82,7 @@
    public R add(BasMap basMap) {
        basMapService.save(basMap);
        if (basMap != null && basMap.getLev() != null) {
            NavigateSolution.refreshMapCache(basMap.getLev());
            basMapService.refreshMapRuntimeCaches(Collections.singletonList(basMap.getLev()));
        }
        return R.ok();
    }
@@ -86,14 +95,16 @@
        }
        BasMap oldBasMap = basMapService.getById(basMap.getId());
        basMapService.updateById(basMap);
        if (oldBasMap != null && oldBasMap.getLev() != null) {
            NavigateSolution.clearMapCache(oldBasMap.getLev());
        }
        Integer refreshLev = basMap.getLev() != null
                ? basMap.getLev()
                : oldBasMap == null ? null : oldBasMap.getLev();
        if (refreshLev != null) {
            NavigateSolution.refreshMapCache(refreshLev);
            List<Integer> refreshLevList = new ArrayList<>();
            if (oldBasMap != null && oldBasMap.getLev() != null) {
                refreshLevList.add(oldBasMap.getLev());
            }
            refreshLevList.add(refreshLev);
            basMapService.refreshMapRuntimeCaches(refreshLevList);
        }
        return R.ok();
    }
@@ -105,7 +116,7 @@
            BasMap basMap = basMapService.getById(id);
            basMapService.removeById(id);
            if (basMap != null && basMap.getLev() != null) {
                NavigateSolution.clearMapCache(basMap.getLev());
                basMapService.refreshMapRuntimeCaches(Collections.singletonList(basMap.getLev()));
            }
        }
        return R.ok();