| | |
| | | import zy.cloud.wms.common.web.BaseController; |
| | | import zy.cloud.wms.manager.entity.Tag; |
| | | import zy.cloud.wms.manager.service.TagService; |
| | | import zy.cloud.wms.manager.utils.NodeUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class TagController extends BaseController { |
| | |
| | | @RequestMapping(value = "/tag/add/auth") |
| | | @ManagerAuth |
| | | public R add(Tag tag) { |
| | | tag.setLevel(1); |
| | | if (tag.getParentId() != null && tag.getParentId() > 0) { |
| | | Tag parent = tagService.selectById(tag.getParentId()); |
| | | if (parent != null) { |
| | | tag.setParentName(parent.getName()); |
| | | tag.setLevel(parent.getLevel() + 1); |
| | | } |
| | | } |
| | | // path |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(tag); |
| | | tag.setPath(nodeUtils.path.toString()); |
| | | tag.setPathName(nodeUtils.pathName.toString()); |
| | | |
| | | tag.setCreateBy(getUserId()); |
| | | tag.setCreateTime(new Date()); |
| | | tag.setUpdateBy(getUserId()); |
| | | tag.setUpdateTime(new Date()); |
| | | tag.setStatus(1); |
| | | tagService.insert(tag); |
| | | return R.ok(); |
| | | } |