| | |
| | | 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.constant.dictmap.DeptDict; |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | @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; |
| | | } |
| | |
| | | @RequestMapping(value = "/add") |
| | | @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); |
| | | } |
| | |
| | | @RequestMapping(value = "/list") |
| | | @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)); |
| | | } |
| | | |