Commit 367267a8 by lanmw

deleteTag

parent e2de8df7
package com.keymobile.tagmanager.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.keymobile.tagmanager.model.Page;
import com.keymobile.tagmanager.model.Tag;
import com.keymobile.tagmanager.service.TagService;
import com.keymobile.tagmanager.util.Constants;
import com.keymobile.tagmanager.util.JsonTreeHelper.JsonNode;
import com.keymobile.tagmanager.util.UserInfoUtils;
......@@ -32,36 +31,49 @@ public class TagCtrl {
@RequestBody Tag tag) throws Exception {
String userName = UserInfoUtils.getUserName();
tag.setCreator(userName);
return tagService.addOrUpdateTag(parentId, tag);
return tagService.addOrUpdateTag(parentId, tag, userName);
}
@ApiOperation(value = "删除标签", notes = "删除标签")
@PostMapping(value = "/deleteTag")
public void deleteTag(@RequestParam(value = "tagId") String tagId) throws Exception {
String userName = UserInfoUtils.getUserName();
tagService.deleteTag(tagId, userName);
}
@ApiOperation(value = "存在节点", notes = "存在节点")
@GetMapping(value = "/hasChild")
public boolean hasChild(@RequestParam(value = "tagId") String tagId) throws Exception {
String userName = UserInfoUtils.getUserName();
return tagService.hasChild(tagId, userName);
}
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
@ApiOperation(value = "查询系统标签树", notes = "查询系统标签树")
@PostMapping(value = "/querySystemTagAsTree")
@GetMapping(value = "/querySystemTagAsTree")
public JsonNode[] querySystemTagAsTree(@RequestParam(value = "parentId", required = false) String parentId) throws Exception {
String userName = UserInfoUtils.getUserName();
return tagService.queryTagAsTreeByTagType(Constants.TAG_SYSTEM_TYPE, parentId, userName);
return tagService.querySystemTagAsTree(parentId);
}
@ApiOperation(value = "查询个人标签树", notes = "查询个人标签树")
@PostMapping(value = "/queryPersonalTagAsTree")
@GetMapping(value = "/queryPersonalTagAsTree")
public JsonNode[] queryPersonalTagAsTree(@RequestParam(value = "parentId", required = false) String parentId) throws Exception {
String userName = UserInfoUtils.getUserName();
return tagService.queryTagAsTreeByTagType(Constants.TAG_PERSONAL_TYPE, parentId, userName);
return tagService.queryPersonalTagAsTree(parentId, userName);
}
@ApiOperation(value = "搜索系統标签", notes = "搜索系統标签")
@PostMapping(value = "/searchSystemTagByPage")
@GetMapping(value = "/searchSystemTagByPage")
public Page searchSystemTagByPage(@RequestParam(required = false, value = "keyword") String keyword,
@RequestParam(required = false, value = "domain") Integer domain,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) throws Exception {
String userName = UserInfoUtils.getUserName();
return tagService.searchSystemTagByPage(userName, keyword, domain, new Page(pageSize, pageNo));
return tagService.searchSystemTagByPage(keyword, domain, new Page(pageSize, pageNo));
}
@ApiOperation(value = "搜索个人标签", notes = "搜索个人标签")
@PostMapping(value = "/searchPersonalTagByPage")
@GetMapping(value = "/searchPersonalTagByPage")
public Page searchPersonalTagByPage(@RequestParam(required = false, value = "keyword") String keyword,
@RequestParam(required = false , value = "domain") Integer domain,
@RequestParam("pageNo") Integer pageNo,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment