Commit e2de8df7 by lanmw

u

parent e07a1e41
package com.keymobile.tagmanager.api;
import org.springframework.beans.factory.annotation.Autowired;
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;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(value = "标签相关", tags = "标签相关")
@RestController
@RequestMapping(value = "/tagCtrl")
//@PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_operator')].size() > 0")
public class TagCtrl {
@Autowired
private TagService tagService;
@ApiOperation(value = "新增或更新标签", notes = "新增或更新标签")
@PostMapping(value = "/addOrUpdateTag")
public Tag addTag(@RequestParam(value = "parentId", required = false) String parentId,
@RequestBody Tag tag) throws Exception {
String userName = UserInfoUtils.getUserName();
tag.setCreator(userName);
return tagService.addOrUpdateTag(parentId, tag);
}
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
@ApiOperation(value = "查询系统标签树", notes = "查询系统标签树")
@PostMapping(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);
}
@ApiOperation(value = "查询个人标签树", notes = "查询个人标签树")
@PostMapping(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);
}
@ApiOperation(value = "搜索系統标签", notes = "搜索系統标签")
@PostMapping(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));
}
@ApiOperation(value = "搜索个人标签", notes = "搜索个人标签")
@PostMapping(value = "/searchPersonalTagByPage")
public Page searchPersonalTagByPage(@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.searchPersonalTagByPage(userName, keyword, domain, new Page(pageSize, pageNo));
}
}
package com.keymobile.tagmanager.api;
import org.springframework.beans.factory.annotation.Autowired;
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;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(value = "标签相关", tags = "标签相关")
@RestController
//@PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_operator')].size() > 0")
public class TagCtrl {
@Autowired
private TagService tagService;
@ApiOperation(value = "新增或更新标签", notes = "新增或更新标签")
@PostMapping(value = "/addOrUpdateTag")
public Tag addTag(@RequestParam(value = "parentId", required = false) String parentId,
@RequestBody Tag tag) throws Exception {
String userName = UserInfoUtils.getUserName();
tag.setCreator(userName);
return tagService.addOrUpdateTag(parentId, tag);
}
// @PreAuthorize("principal.authorities.?[authority.startsWith('ROLE_tagmanager_admin')].size() > 0")
@ApiOperation(value = "查询系统标签树", notes = "查询系统标签树")
@PostMapping(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);
}
@ApiOperation(value = "查询个人标签树", notes = "查询个人标签树")
@PostMapping(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);
}
@ApiOperation(value = "搜索系統标签", notes = "搜索系統标签")
@PostMapping(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));
}
@ApiOperation(value = "搜索个人标签", notes = "搜索个人标签")
@PostMapping(value = "/searchPersonalTagByPage")
public Page searchPersonalTagByPage(@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.searchPersonalTagByPage(userName, keyword, domain, new Page(pageSize, 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