|
13 | 13 | import com.tipdm.framework.model.dmserver.ComponentIO;
|
14 | 14 | import com.tipdm.framework.model.dmserver.Widget;
|
15 | 15 | import com.tipdm.framework.service.dmserver.ComponentService;
|
16 |
| -//import io.swagger.annotations.*; |
17 | 16 | import org.apache.shiro.authz.annotation.RequiresPermissions;
|
18 | 17 | import org.springframework.beans.BeanUtils;
|
19 | 18 | import org.springframework.beans.factory.annotation.Autowired;
|
20 | 19 | import org.springframework.context.annotation.PropertySource;
|
21 |
| -import org.springframework.http.HttpStatus; |
22 | 20 | import org.springframework.web.bind.annotation.*;
|
23 | 21 |
|
24 | 22 | import javax.servlet.http.HttpServletResponse;
|
|
30 | 28 | import java.util.function.Predicate;
|
31 | 29 | import java.util.stream.Collectors;
|
32 | 30 |
|
| 31 | +//import io.swagger.annotations.*; |
| 32 | + |
33 | 33 | /**
|
34 | 34 | * Created by TipDM on 2017/1/3.
|
35 | 35 |
|
@@ -159,25 +159,7 @@ public Result delete(/*@ApiParam(required = true, value = "用户访问令牌")*
|
159 | 159 | HttpServletResponse response) throws Exception {
|
160 | 160 |
|
161 | 161 | Result result = new Result();
|
162 |
| - Component com = componentService.findOne(componentId);//查询,先获取com.getSequence() |
163 |
| - if (com == null) { |
164 |
| - response.setStatus(HttpStatus.NOT_FOUND.value()); |
165 |
| - throw new ElementNotFoundException("组件不存在"); |
166 |
| - } |
167 |
| - List<Component> child = componentService.findChild(com.getParentId(), com.getCreatorId());//根据父节点的ID,获取该父节点下所有子节点 |
168 |
| - Integer sequence = com.getSequence(); |
169 |
| - sequence = sequence == null ? 0 : sequence; |
170 |
| - if (sequence == child.size() - 1) {//已是最底下不需要更新 |
171 |
| - } else { |
172 |
| - Integer number = sequence + 1;//删除一个,从下一个排序的数据开始更新所有sequence |
173 |
| - for (int i = number; i < child.size(); i++) { |
174 |
| - Component component = child.get(i); |
175 |
| - Integer seq = component.getSequence(); |
176 |
| - seq = seq == null ? 0 : seq - 1; |
177 |
| - component.setSequence(seq); |
178 |
| - componentService.update(component.getId(), component); |
179 |
| - } |
180 |
| - } |
| 162 | + |
181 | 163 | componentService.delete(componentId);
|
182 | 164 |
|
183 | 165 | result.setMessage("组件删除成功");
|
@@ -220,19 +202,6 @@ public Result deleteCat(/*@ApiParam(required = true, value = "用户访问令牌
|
220 | 202 |
|
221 | 203 | Result result = new Result();
|
222 | 204 |
|
223 |
| - Component com = componentService.findOne(catId);//查询,先获取com.getSequence() |
224 |
| - List<Component> child = componentService.findChild(com.getParentId(), com.getCreatorId());//根据父节点的ID,获取该父节点下所有子节点 |
225 |
| - Integer sequence = com.getSequence(); |
226 |
| - if (sequence == child.size() - 1) {//已是最底下不需要更新 |
227 |
| - } else { |
228 |
| - Integer number = sequence + 1;//删除一个,从下一个排序的数据开始更新所有sequence |
229 |
| - for (int i = number; i < child.size(); i++) { |
230 |
| - Component comList = child.get(i); |
231 |
| - comList.setSequence(comList.getSequence() - 1); |
232 |
| - componentService.update(comList.getId(), comList); |
233 |
| - } |
234 |
| - } |
235 |
| - |
236 | 205 | componentService.delete(catId);
|
237 | 206 | result.setMessage("组件分类删除成功");
|
238 | 207 | return result;
|
|
0 commit comments