flowable设计器自定义自己的人员选择器

设计器自定义自己的人员、组选择器

  • 背景
    • 组选择器
    • 人员选择器
    • 实现效果

背景

很多外国的设计是不合适国内的使用习惯,就比方说人员选择器和组选择器,他们都是id和第一个名字,中国哪里能看的懂呀,所以我们自定义修改一下。

组选择器

@RestController
@RequestMapping("/app")
public class EditorGroupsResource {

    @Autowired
    protected IdmIdentityService idmIdentityService;

    @RequestMapping(value = "/rest/editor-groups", method = RequestMethod.GET)
    public ResultListDataRepresentation getGroups(@RequestParam(required = false, value = "filter") String filter) {
        if (StringUtils.isNotBlank(filter)) {
            filter = filter.trim();
            String sql = "select * from act_id_group where NAME_ like #{name}";
            filter = "%" + filter + "%";
            List groups = idmIdentityService.createNativeGroupQuery().sql(sql).parameter("name", filter).listPage(0, 10);
            List result = new ArrayList<>();
            for (Group group : groups) {
                result.add(new GroupRepresentation(group));
            }
            return new ResultListDataRepresentation(result);
        }
        return null;
    }
}

人员选择器

@RestController
@RequestMapping("/app")
public class EditorUsersResource {

    @Autowired
    protected IdmIdentityService idmIdentityService;
    @Autowired
    protected ManagementService managementService;

    @RequestMapping(value = "/rest/editor-users", method = RequestMethod.GET)
    public ResultListDataRepresentation getUsers(@RequestParam(value = "filter", required = false) String filter) {
        if (StringUtils.isNotBlank(filter)) {
            filter = filter.trim();
            String sql = "select * from act_id_user where ID_ like #{id} or LAST_ like #{name}";
            filter = "%"+filter+"%";
            List matchingUsers = idmIdentityService.createNativeUserQuery().sql(sql).parameter("id",filter).parameter("name",filter).listPage(0, 10);List userRepresentations = new ArrayList<>(matchingUsers.size());
            for (User user : matchingUsers) {
                userRepresentations.add(new UserRepresentation(user));
            }
            return new ResultListDataRepresentation(userRepresentations);
        }
       return null;
    }

}

实现效果

flowable设计器自定义自己的人员选择器_第1张图片
flowable设计器自定义自己的人员选择器_第2张图片
flowable交流群:633168411

你可能感兴趣的:(flowable)