Pu Zhibing
1 天以前 28e148e28986a08414a4c690a5e5e7ecdc87f9a7
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/DeptController.java
@@ -1,14 +1,15 @@
package com.stylefeng.guns.modular.system.controller.system;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.common.annotion.BussinessLog;
import com.stylefeng.guns.core.common.annotion.Permission;
import com.stylefeng.guns.core.common.constant.dictmap.DeptDict;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.common.exception.BizExceptionEnum;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.Dept;
import com.stylefeng.guns.modular.system.service.IDeptService;
@@ -38,6 +39,8 @@
    @Autowired
    private IDeptService deptService;
    @Autowired
    private ShiroExtUtil shiroExtUtil;
    /**
@@ -59,7 +62,6 @@
    /**
     * 跳转到修改部门
     */
    @Permission
    @RequestMapping("/dept_update/{deptId}")
    public String deptUpdate(@PathVariable Integer deptId, Model model) {
        Dept dept = deptService.selectById(deptId);
@@ -75,7 +77,8 @@
    @RequestMapping(value = "/tree")
    @ResponseBody
    public List<ZTreeNode> tree() {
        List<ZTreeNode> tree = this.deptService.tree();
        ShiroUser user1 = shiroExtUtil.getUser();
        List<ZTreeNode> tree = this.deptService.tree(user1.getObjectId());
        tree.add(ZTreeNode.createParent());
        return tree;
    }
@@ -85,15 +88,15 @@
     */
    @BussinessLog(value = "添加部门", key = "simplename", dict = DeptDict.class)
    @RequestMapping(value = "/add")
    @Permission
    @ResponseBody
    public Object add(Dept dept) {
        ShiroUser user1 = shiroExtUtil.getUser();
        if (ToolUtil.isOneEmpty(dept, dept.getSimplename())) {
            throw new GunsException(BizExceptionEnum.REQUEST_NULL);
        }
        //完善pids,根据pid拿到pid的pids
        deptSetPids(dept);
        dept.setObjectId(user1.getObjectId());
        return this.deptService.insert(dept);
    }
@@ -102,10 +105,10 @@
     * 获取所有部门列表
     */
    @RequestMapping(value = "/list")
    @Permission
    @ResponseBody
    public Object list(String condition) {
        List<Map<String, Object>> list = this.deptService.list(condition);
        ShiroUser user1 = shiroExtUtil.getUser();
        List<Map<String, Object>> list = this.deptService.list(condition, user1.getObjectId());
        return super.warpObject(new DeptWarpper(list));
    }
@@ -113,7 +116,6 @@
     * 部门详情
     */
    @RequestMapping(value = "/detail/{deptId}")
    @Permission
    @ResponseBody
    public Object detail(@PathVariable("deptId") Integer deptId) {
        return deptService.selectById(deptId);
@@ -124,7 +126,6 @@
     */
    @BussinessLog(value = "修改部门", key = "simplename", dict = DeptDict.class)
    @RequestMapping(value = "/update")
    @Permission
    @ResponseBody
    public Object update(Dept dept) {
        if (ToolUtil.isEmpty(dept) || dept.getId() == null) {
@@ -141,7 +142,6 @@
     */
    @BussinessLog(value = "删除部门", key = "deptId", dict = DeptDict.class)
    @RequestMapping(value = "/delete")
    @Permission
    @ResponseBody
    public Object delete(@RequestParam Integer deptId) {