|
@@ -9,13 +9,19 @@ import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
|
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
+import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
+import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author mazq
|
|
@@ -68,24 +74,38 @@ public class EnvElementController {
|
|
|
@ApiOperation(value = "关联用户分页查询")
|
|
|
@PostMapping("userRelPage")
|
|
|
public Result<List<ElementUserRelRespVo>> userRelPage(SearchDTO searchDTO) {
|
|
|
- return envElementFacade.userRelPage(searchDTO);
|
|
|
+ Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+ Condition elementIdCondition = searchable.getSearchFilter("elementId", SearchOperator.eq);
|
|
|
+ if (null == elementIdCondition) {
|
|
|
+ return Result.failMessage("请选择环境要素");
|
|
|
+ }
|
|
|
+ Page<ElementUserRelRespVo> page = envElementFacade.userRelPage(searchDTO);
|
|
|
+ return Result.success(page.getTotalElements(),page.getContent());
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "非关联用户分页查询")
|
|
|
@PostMapping("notInUserRelPage")
|
|
|
public Result<List<AuthUserVo>> notInUserRelPage(SearchDTO searchDTO) {
|
|
|
- return envElementFacade.notInUserRelPage(searchDTO);
|
|
|
+ Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+ Condition elementIdCondition = searchable.getSearchFilter("elementId", SearchOperator.eq);
|
|
|
+ if (null == elementIdCondition) {
|
|
|
+ return Result.failMessage("请选择环境要素");
|
|
|
+ }
|
|
|
+ Page<AuthUserVo> page = envElementFacade.notInUserRelPage(searchDTO);
|
|
|
+ return Result.success(page.getTotalElements(),page.getContent());
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "关联关系添加")
|
|
|
@PostMapping("userRelSave")
|
|
|
public Result<Object> userRelSave(@Valid @RequestBody ElementUserSaveVo relSaveVo) {
|
|
|
- return envElementFacade.userRelSave(relSaveVo);
|
|
|
+ envElementFacade.userRelSave(relSaveVo);
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "关联关系移除")
|
|
|
@DeleteMapping("deleteUserRel/{id}")
|
|
|
public Result<Object> deleteUserRel(@PathVariable("id") String id) {
|
|
|
- return envElementFacade.deleteUserRel(id);
|
|
|
+ envElementFacade.deleteUserRel(id);
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
}
|