|
@@ -0,0 +1,75 @@
|
|
|
+package com.dragoninfo.dcuc.authweb.restcontroller.attr.controller;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.attr.AttrAcceptDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.facade.attr.IAttrFacade;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.attr.vo.AttrAcceptVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.util.VersionUtils;
|
|
|
+import com.dragoninfo.duceap.core.response.Result;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 主客体属性管理controller
|
|
|
+ * @author mazq
|
|
|
+ * @date 2021/5/20
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Api(tags = {"主客体授权-属性管理接口"})
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/attrsvr/"+ VersionUtils.VERSION_UID)
|
|
|
+public class AttrController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAttrFacade attrFacade;
|
|
|
+
|
|
|
+ @ApiOperation(value = "添加主客体属性")
|
|
|
+ @ApiImplicitParam(name = "AttrAcceptVo", value = "主体属性新增Vo")
|
|
|
+ @PostMapping(value = "attrAdds")
|
|
|
+ public Result attrAdds(@RequestBody AttrAcceptVo vo){
|
|
|
+ AttrAcceptDTO dto = new AttrAcceptDTO();
|
|
|
+ BeanUtils.copyProperties(vo,dto);
|
|
|
+ Boolean b = attrFacade.attrSave(dto);
|
|
|
+ if (b) {
|
|
|
+ return Result.success();
|
|
|
+ } else {
|
|
|
+ return Result.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据父级id,删除主客体属性")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "parentId", value = "parentId属性父类id"),
|
|
|
+ @ApiImplicitParam(name = "attrType", value = "属性类别 SUB:主体属性 OBJ:客体属性")
|
|
|
+ })
|
|
|
+ @PostMapping(value = "deleteByParentId")
|
|
|
+ public Result deleteByParentId(@RequestParam("parentId") String parentId, @RequestParam("attrType") String attrType) {
|
|
|
+ Boolean b = attrFacade.deleteByParentId(parentId,attrType);
|
|
|
+ if (b) {
|
|
|
+ return Result.success();
|
|
|
+ } else {
|
|
|
+ return Result.fail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据属性所属类别获取属性列表,返回树结构")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "attrBelongType", value = "parentId属性父类id"),
|
|
|
+ @ApiImplicitParam(name = "attrType", value = "属性类别 SUB:主体属性 OBJ:客体属性")
|
|
|
+ })
|
|
|
+ @PostMapping(value = "getAttrTreeList")
|
|
|
+ public Result getAttrTreeList(@RequestParam("attrBelongType") String attrBelongType, @RequestParam("attrType") String attrType) {
|
|
|
+ List<AttrAcceptDTO> list = attrFacade.getAttrTreeList(attrBelongType,attrType);
|
|
|
+ return Result.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|