中扬CRM客户关系管理系统
#
luxiaotao1123
2022-09-13 8b3f9860cf8e2675c5f9eab86f1939e82e97fac8
src/main/java/com/zy/crm/system/controller/DeptController.java
@@ -10,12 +10,15 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.crm.common.utils.ListUtils;
import com.zy.crm.common.utils.TreeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.system.entity.Dept;
import com.zy.crm.system.service.DeptService;
import java.io.IOException;
import java.util.*;
@RestController
@@ -23,6 +26,8 @@
    @Autowired
    private DeptService deptService;
    @Autowired
    private TreeUtils treeUtils;
    @RequestMapping(value = "/dept/{id}/auth")
    @ManagerAuth
@@ -131,4 +136,17 @@
        return R.ok();
    }
    @PostMapping(value = "/dept/tree/auth")
    @ManagerAuth
    public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
        ArrayList<Map> tree = treeUtils.getDeptTree(String.valueOf(getOriginDept().getId()), getHostId());
        // 深拷贝
        List<Map> result = ListUtils.deepCopy(tree);
        if (!Cools.isEmpty(condition)) {
            treeUtils.remove(condition, result);
            treeUtils.remove(condition, result);
        }
        return R.ok(result);
    }
}