Junjie
11 小时以前 71a5ae03389119dc6975d7cfb87e63601f3c5305
src/main/java/com/zy/asrs/controller/BasMapController.java
@@ -13,6 +13,7 @@
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.*;
@@ -71,6 +72,9 @@
    @ManagerAuth
    public R add(BasMap basMap) {
        basMapService.save(basMap);
        if (basMap != null && basMap.getLev() != null) {
            NavigateSolution.refreshMapCache(basMap.getLev());
        }
        return R.ok();
    }
@@ -80,7 +84,17 @@
        if (Cools.isEmpty(basMap) || null==basMap.getId()){
            return R.error();
        }
        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);
        }
        return R.ok();
    }
@@ -88,7 +102,11 @@
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Integer[] ids){
         for (Integer id : ids){
            BasMap basMap = basMapService.getById(id);
            basMapService.removeById(id);
            if (basMap != null && basMap.getLev() != null) {
                NavigateSolution.clearMapCache(basMap.getLev());
            }
        }
        return R.ok();
    }