zoukankan      html  css  js  c++  java
  • flowable设计器自定义自己的人员选择器

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

    1、自定义组选择器

    @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<Group> groups = idmIdentityService.createNativeGroupQuery().sql(sql).parameter("name", filter).listPage(0, 10);
                List<GroupRepresentation> result = new ArrayList<>();
                for (Group group : groups) {
                    result.add(new GroupRepresentation(group));
                }
                return new ResultListDataRepresentation(result);
            }
            return null;
        }
    }

    2、自定义人员选择器

    @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<User> matchingUsers = idmIdentityService.createNativeUserQuery().sql(sql).parameter("id",filter).parameter("name",filter).listPage(0, 10);List<UserRepresentation> userRepresentations = new ArrayList<>(matchingUsers.size());
                for (User user : matchingUsers) {
                    userRepresentations.add(new UserRepresentation(user));
                }
                return new ResultListDataRepresentation(userRepresentations);
            }
           return null;
        }
    
    }

    3、效果:

  • 相关阅读:
    音乐播放器
    对象的单体模式和面向对象
    箭头函数详解及this指向
    ES6的基础语法
    房贷灵活计算器
    [译文] SQL JOIN,你想知道的应该都有
    [Perl] 删除数组中重复元素
    [Qt] 自定义 滚动条 样式
    nodejs之异步思想
    导致人生失败的31种原因(转自csdn博客)
  • 原文地址:https://www.cnblogs.com/liuwenjun/p/11077186.html
Copyright © 2011-2022 走看看