Explorar el Código

部门添加编辑的时候给ancestors赋值

liyuanyuan hace 5 meses
padre
commit
7bdcd93f51

+ 5 - 0
ltrq-api/src/main/java/api/controller/system/DeptController.java

@@ -123,8 +123,11 @@ public class DeptController extends BaseController {
123 123
         }
124 124
         input.setCreateBy(CurrentUser().getUserName());
125 125
         input.setCreateTime(new Date());
126
+        Dept parentdept=   deptService.getEntity(input.getParentId());
126 127
         boolean result = deptService.insert(input);
127 128
         if (result) {
129
+            input.setAncestors(parentdept.getAncestors()+","+input.getDeptId());
130
+            deptService.update(input);
128 131
             if (redisHelper.getCache("deptTree")!=null){
129 132
                 redisHelper.deleteCache("deptTree");
130 133
             }
@@ -191,6 +194,8 @@ public class DeptController extends BaseController {
191 194
         if (redisHelper.getCache("deptTree")!=null){
192 195
             redisHelper.deleteCache("deptTree");
193 196
         }
197
+        Dept parentdept=   deptService.getEntity(input.getParentId());
198
+        input.setAncestors(parentdept.getAncestors()+","+input.getDeptId());
194 199
         boolean result = deptService.update(input);
195 200
         if (result) {
196 201
             if (redisHelper.getCache("deptTree")!=null){