mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-29 22:56:40 +08:00
添加模型人员用户,组查询
This commit is contained in:
parent
59f005d74a
commit
550bfdf8bf
@ -1,11 +1,14 @@
|
||||
package org.dromara.workflow.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
@ -14,16 +17,27 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.SysRole;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.mapper.SysRoleMapper;
|
||||
import org.dromara.system.mapper.SysUserMapper;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.workflow.domain.bo.ModelBo;
|
||||
import org.dromara.workflow.domain.vo.AccountVo;
|
||||
import org.dromara.workflow.domain.vo.GroupRepresentation;
|
||||
import org.dromara.workflow.domain.vo.ResultListDataRepresentation;
|
||||
import org.dromara.workflow.domain.vo.UserRepresentation;
|
||||
import org.dromara.workflow.service.IActModelService;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -41,6 +55,10 @@ public class ActModelController extends BaseController {
|
||||
|
||||
private final IActModelService iActModelService;
|
||||
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
private final SysRoleMapper sysRoleMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询模型
|
||||
@ -141,4 +159,48 @@ public class ActModelController extends BaseController {
|
||||
iActModelService.exportZip(modelId, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param filter 参数
|
||||
*/
|
||||
@GetMapping(value = "/rest/editor-users")
|
||||
public ResultListDataRepresentation getUsers(@RequestParam(value = "filter", required = false) String filter) {
|
||||
LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtils.isNotBlank(filter), SysUser::getNickName, filter);
|
||||
List<SysUser> sysUsers = sysUserMapper.selectList(wrapper);
|
||||
List<UserRepresentation> userRepresentations = new ArrayList<>();
|
||||
for (SysUser sysUser : sysUsers) {
|
||||
UserRepresentation userRepresentation = new UserRepresentation();
|
||||
userRepresentation.setFullName(sysUser.getNickName());
|
||||
userRepresentation.setLastName(sysUser.getNickName());
|
||||
userRepresentation.setTenantId(sysUser.getTenantId());
|
||||
userRepresentation.setEmail(sysUser.getEmail());
|
||||
userRepresentation.setId(sysUser.getUserId().toString());
|
||||
userRepresentations.add(userRepresentation);
|
||||
}
|
||||
return new ResultListDataRepresentation(userRepresentations);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户组
|
||||
*
|
||||
* @param filter 参数
|
||||
*/
|
||||
@GetMapping(value = "/rest/editor-groups")
|
||||
public ResultListDataRepresentation getGroups(@RequestParam(required = false, value = "filter") String filter) {
|
||||
LambdaQueryWrapper<SysRole> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtils.isNotBlank(filter), SysRole::getRoleName, filter);
|
||||
List<SysRole> sysRoles = sysRoleMapper.selectList(wrapper);
|
||||
List<GroupRepresentation> result = new ArrayList<>();
|
||||
for (SysRole sysRole : sysRoles) {
|
||||
GroupRepresentation groupRepresentation = new GroupRepresentation();
|
||||
groupRepresentation.setId(sysRole.getRoleId().toString());
|
||||
groupRepresentation.setName(sysRole.getRoleName());
|
||||
groupRepresentation.setType(sysRole.getRoleKey());
|
||||
result.add(groupRepresentation);
|
||||
}
|
||||
return new ResultListDataRepresentation(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Joram Barrez
|
||||
*/
|
||||
@Data
|
||||
public class GroupRepresentation{
|
||||
|
||||
protected String id;
|
||||
protected String name;
|
||||
protected String type;
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
public class ResultListDataRepresentation {
|
||||
|
||||
protected Integer size;
|
||||
protected Long total;
|
||||
protected Integer start;
|
||||
protected List<? extends Object> data;
|
||||
|
||||
public ResultListDataRepresentation() {
|
||||
}
|
||||
|
||||
public ResultListDataRepresentation(List<? extends Object> data) {
|
||||
this.data = data;
|
||||
if (data != null) {
|
||||
size = data.size();
|
||||
total = (long) data.size();
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(Integer start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public List<? extends Object> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<? extends Object> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Joram Barrez
|
||||
*/
|
||||
@Data
|
||||
public class UserRepresentation {
|
||||
|
||||
protected String id;
|
||||
protected String firstName;
|
||||
protected String lastName;
|
||||
protected String email;
|
||||
protected String fullName;
|
||||
protected String tenantId;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user