BPM:简化 userGroup 的实现

This commit is contained in:
YunaiV 2024-03-19 12:13:49 +08:00
parent 8c32eb24ec
commit d5e28d4c57
14 changed files with 65 additions and 146 deletions

View File

@ -1,27 +1,27 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition; package cn.iocoder.yudao.module.bpm.controller.admin.definition;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO;
import cn.iocoder.yudao.module.bpm.convert.definition.BpmUserGroupConvert;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import cn.iocoder.yudao.module.bpm.service.definition.BpmUserGroupService;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.tags.Tag; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import io.swagger.v3.oas.annotations.Parameter; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupSaveReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import cn.iocoder.yudao.module.bpm.service.definition.BpmUserGroupService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Tag(name = "管理后台 - 用户组") @Tag(name = "管理后台 - 用户组")
@RestController @RestController
@ -35,14 +35,14 @@ public class BpmUserGroupController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建用户组") @Operation(summary = "创建用户组")
@PreAuthorize("@ss.hasPermission('bpm:user-group:create')") @PreAuthorize("@ss.hasPermission('bpm:user-group:create')")
public CommonResult<Long> createUserGroup(@Valid @RequestBody BpmUserGroupCreateReqVO createReqVO) { public CommonResult<Long> createUserGroup(@Valid @RequestBody BpmUserGroupSaveReqVO createReqVO) {
return success(userGroupService.createUserGroup(createReqVO)); return success(userGroupService.createUserGroup(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新用户组") @Operation(summary = "更新用户组")
@PreAuthorize("@ss.hasPermission('bpm:user-group:update')") @PreAuthorize("@ss.hasPermission('bpm:user-group:update')")
public CommonResult<Boolean> updateUserGroup(@Valid @RequestBody BpmUserGroupUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateUserGroup(@Valid @RequestBody BpmUserGroupSaveReqVO updateReqVO) {
userGroupService.updateUserGroup(updateReqVO); userGroupService.updateUserGroup(updateReqVO);
return success(true); return success(true);
} }
@ -62,7 +62,7 @@ public class BpmUserGroupController {
@PreAuthorize("@ss.hasPermission('bpm:user-group:query')") @PreAuthorize("@ss.hasPermission('bpm:user-group:query')")
public CommonResult<BpmUserGroupRespVO> getUserGroup(@RequestParam("id") Long id) { public CommonResult<BpmUserGroupRespVO> getUserGroup(@RequestParam("id") Long id) {
BpmUserGroupDO userGroup = userGroupService.getUserGroup(id); BpmUserGroupDO userGroup = userGroupService.getUserGroup(id);
return success(BpmUserGroupConvert.INSTANCE.convert(userGroup)); return success(BeanUtils.toBean(userGroup, BpmUserGroupRespVO.class));
} }
@GetMapping("/page") @GetMapping("/page")
@ -70,16 +70,14 @@ public class BpmUserGroupController {
@PreAuthorize("@ss.hasPermission('bpm:user-group:query')") @PreAuthorize("@ss.hasPermission('bpm:user-group:query')")
public CommonResult<PageResult<BpmUserGroupRespVO>> getUserGroupPage(@Valid BpmUserGroupPageReqVO pageVO) { public CommonResult<PageResult<BpmUserGroupRespVO>> getUserGroupPage(@Valid BpmUserGroupPageReqVO pageVO) {
PageResult<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(pageVO); PageResult<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(pageVO);
return success(BpmUserGroupConvert.INSTANCE.convertPage(pageResult)); return success(BeanUtils.toBean(pageResult, BpmUserGroupRespVO.class));
} }
@GetMapping("/list-all-simple") @GetMapping("/simple-list")
@Operation(summary = "获取用户组精简信息列表", description = "只包含被开启的用户组,主要用于前端的下拉选项") @Operation(summary = "获取用户组精简信息列表", description = "只包含被开启的用户组,主要用于前端的下拉选项")
public CommonResult<List<BpmUserGroupRespVO>> getSimpleUserGroups() { public CommonResult<List<BpmUserGroupRespVO>> getUserGroupSimpleList() {
// 获用户门列表只要开启状态的
List<BpmUserGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus()); List<BpmUserGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus());
// 排序后返回给前端 return success(convertList(list, group -> new BpmUserGroupRespVO().setId(group.getId()).setName(group.getName())));
return success(BpmUserGroupConvert.INSTANCE.convertList2(list));
} }
} }

View File

@ -1,11 +0,0 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@Schema(description = "管理后台 - 用户组创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BpmUserGroupCreateReqVO extends BpmUserGroupBaseVO {
}

View File

@ -16,6 +16,9 @@ import java.time.LocalDateTime;
@ToString(callSuper = true) @ToString(callSuper = true)
public class BpmUserGroupPageReqVO extends PageParam { public class BpmUserGroupPageReqVO extends PageParam {
@Schema(description = "编号", example = "1024")
private Long id;
@Schema(description = "组名", example = "芋道") @Schema(description = "组名", example = "芋道")
private String name; private String name;

View File

@ -1,19 +1,30 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group; package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Set;
@Schema(description = "管理后台 - 用户组 Response VO") @Schema(description = "管理后台 - 用户组 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) public class BpmUserGroupRespVO {
@ToString(callSuper = true)
public class BpmUserGroupRespVO extends BpmUserGroupBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id; private Long id;
@Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
private String description;
@Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
private Set<Long> userIds;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime; private LocalDateTime createTime;

View File

@ -1,29 +1,27 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group; package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Set; import java.util.Set;
/** @Schema(description = "管理后台 - 用户组创建/修改 Request VO")
* 用户组 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data @Data
public class BpmUserGroupBaseVO { public class BpmUserGroupSaveReqVO {
@Schema(description = "编号", example = "1024")
private Long id;
@Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") @Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
@NotNull(message = "组名不能为空") @NotNull(message = "组名不能为空")
private String name; private String name;
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") @Schema(description = "描述", example = "芋道源码")
@NotNull(message = "描述不能为空")
private String description; private String description;
@Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3") @Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
@NotNull(message = "成员编号数组不能为空") @NotNull(message = "成员编号数组不能为空")
private Set<Long> memberUserIds; private Set<Long> userIds;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空") @NotNull(message = "状态不能为空")

View File

@ -1,20 +0,0 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "管理后台 - 用户组精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BpmUserGroupSimpleRespVO {
@Schema(description = "用户组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "用户组名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
}

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 用户组更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BpmUserGroupUpdateReqVO extends BpmUserGroupBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "编号不能为空")
private Long id;
}

View File

@ -1,38 +0,0 @@
package cn.iocoder.yudao.module.bpm.convert.definition;
import java.util.*;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;
/**
* 用户组 Convert
*
* @author 芋道源码
*/
@Mapper
public interface BpmUserGroupConvert {
BpmUserGroupConvert INSTANCE = Mappers.getMapper(BpmUserGroupConvert.class);
BpmUserGroupDO convert(BpmUserGroupCreateReqVO bean);
BpmUserGroupDO convert(BpmUserGroupUpdateReqVO bean);
BpmUserGroupRespVO convert(BpmUserGroupDO bean);
List<BpmUserGroupRespVO> convertList(List<BpmUserGroupDO> list);
PageResult<BpmUserGroupRespVO> convertPage(PageResult<BpmUserGroupDO> page);
@Named("convertList2")
List<BpmUserGroupRespVO> convertList2(List<BpmUserGroupDO> list);
}

View File

@ -47,6 +47,6 @@ public class BpmUserGroupDO extends BaseDO {
* 成员用户编号数组 * 成员用户编号数组
*/ */
@TableField(typeHandler = JsonLongSetTypeHandler.class) @TableField(typeHandler = JsonLongSetTypeHandler.class)
private Set<Long> memberUserIds; private Set<Long> userIds;
} }

View File

@ -41,7 +41,7 @@ public class BpmTaskCandidateGroupStrategy implements BpmTaskCandidateStrategy {
public Set<Long> calculateUsers(DelegateExecution execution, String param) { public Set<Long> calculateUsers(DelegateExecution execution, String param) {
Set<Long> groupIds = StrUtils.splitToLongSet(param); Set<Long> groupIds = StrUtils.splitToLongSet(param);
List<BpmUserGroupDO> groups = userGroupService.getUserGroupList(groupIds); List<BpmUserGroupDO> groups = userGroupService.getUserGroupList(groupIds);
return convertSetByFlatMap(groups, BpmUserGroupDO::getMemberUserIds, Collection::stream); return convertSetByFlatMap(groups, BpmUserGroupDO::getUserIds, Collection::stream);
} }
} }

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.bpm.service.definition; package cn.iocoder.yudao.module.bpm.service.definition;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupSaveReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
@ -23,14 +22,14 @@ public interface BpmUserGroupService {
* @param createReqVO 创建信息 * @param createReqVO 创建信息
* @return 编号 * @return 编号
*/ */
Long createUserGroup(@Valid BpmUserGroupCreateReqVO createReqVO); Long createUserGroup(@Valid BpmUserGroupSaveReqVO createReqVO);
/** /**
* 更新用户组 * 更新用户组
* *
* @param updateReqVO 更新信息 * @param updateReqVO 更新信息
*/ */
void updateUserGroup(@Valid BpmUserGroupUpdateReqVO updateReqVO); void updateUserGroup(@Valid BpmUserGroupSaveReqVO updateReqVO);
/** /**
* 删除用户组 * 删除用户组

View File

@ -2,13 +2,10 @@ package cn.iocoder.yudao.module.bpm.service.definition;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupSaveReqVO;
import cn.iocoder.yudao.module.bpm.convert.definition.BpmUserGroupConvert;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmUserGroupMapper; import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmUserGroupMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -20,6 +17,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_IS_DISABLE; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_IS_DISABLE;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS;
@ -36,20 +34,18 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
private BpmUserGroupMapper userGroupMapper; private BpmUserGroupMapper userGroupMapper;
@Override @Override
public Long createUserGroup(BpmUserGroupCreateReqVO createReqVO) { public Long createUserGroup(BpmUserGroupSaveReqVO createReqVO) {
// 插入 BpmUserGroupDO userGroup = BeanUtils.toBean(createReqVO, BpmUserGroupDO.class);
BpmUserGroupDO userGroup = BpmUserGroupConvert.INSTANCE.convert(createReqVO);
userGroupMapper.insert(userGroup); userGroupMapper.insert(userGroup);
// 返回
return userGroup.getId(); return userGroup.getId();
} }
@Override @Override
public void updateUserGroup(BpmUserGroupUpdateReqVO updateReqVO) { public void updateUserGroup(BpmUserGroupSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
this.validateUserGroupExists(updateReqVO.getId()); validateUserGroupExists(updateReqVO.getId());
// 更新 // 更新
BpmUserGroupDO updateObj = BpmUserGroupConvert.INSTANCE.convert(updateReqVO); BpmUserGroupDO updateObj = BeanUtils.toBean(updateReqVO, BpmUserGroupDO.class);
userGroupMapper.updateById(updateObj); userGroupMapper.updateById(updateObj);
} }
@ -63,7 +59,7 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
private void validateUserGroupExists(Long id) { private void validateUserGroupExists(Long id) {
if (userGroupMapper.selectById(id) == null) { if (userGroupMapper.selectById(id) == null) {
throw ServiceExceptionUtil.exception(USER_GROUP_NOT_EXISTS); throw exception(USER_GROUP_NOT_EXISTS);
} }
} }
@ -95,12 +91,12 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService {
} }
// 获得用户组信息 // 获得用户组信息
List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids); List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids);
Map<Long, BpmUserGroupDO> userGroupMap = CollectionUtils.convertMap(userGroups, BpmUserGroupDO::getId); Map<Long, BpmUserGroupDO> userGroupMap = convertMap(userGroups, BpmUserGroupDO::getId);
// 校验 // 校验
ids.forEach(id -> { ids.forEach(id -> {
BpmUserGroupDO userGroup = userGroupMap.get(id); BpmUserGroupDO userGroup = userGroupMap.get(id);
if (userGroup == null) { if (userGroup == null) {
throw ServiceExceptionUtil.exception(USER_GROUP_NOT_EXISTS); throw exception(USER_GROUP_NOT_EXISTS);
} }
if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) { if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) {
throw exception(USER_GROUP_IS_DISABLE, userGroup.getName()); throw exception(USER_GROUP_IS_DISABLE, userGroup.getName());

View File

@ -29,8 +29,8 @@ public class BpmTaskCandidateGroupStrategyTest extends BaseMockitoUnitTest {
// 准备参数 // 准备参数
String param = "1,2"; String param = "1,2";
// mock 方法 // mock 方法
BpmUserGroupDO userGroup1 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(11L, 12L))); BpmUserGroupDO userGroup1 = randomPojo(BpmUserGroupDO.class, o -> o.setUserIds(asSet(11L, 12L)));
BpmUserGroupDO userGroup2 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(21L, 22L))); BpmUserGroupDO userGroup2 = randomPojo(BpmUserGroupDO.class, o -> o.setUserIds(asSet(21L, 22L)));
when(userGroupService.getUserGroupList(eq(asSet(1L, 2L)))).thenReturn(Arrays.asList(userGroup1, userGroup2)); when(userGroupService.getUserGroupList(eq(asSet(1L, 2L)))).thenReturn(Arrays.asList(userGroup1, userGroup2));
// 调用 // 调用

View File

@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.framework.test.core.util.AssertUtils; import cn.iocoder.yudao.framework.test.core.util.AssertUtils;
import cn.iocoder.yudao.framework.test.core.util.RandomUtils; import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupSaveReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
@ -39,7 +39,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
@Test @Test
public void testCreateUserGroup_success() { public void testCreateUserGroup_success() {
// 准备参数 // 准备参数
BpmUserGroupCreateReqVO reqVO = RandomUtils.randomPojo(BpmUserGroupCreateReqVO.class); BpmUserGroupSaveReqVO reqVO = RandomUtils.randomPojo(BpmUserGroupSaveReqVO.class);
// 调用 // 调用
Long userGroupId = userGroupService.createUserGroup(reqVO); Long userGroupId = userGroupService.createUserGroup(reqVO);