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、效果:

  • 相关阅读:
    NoClassDefFoundError问题
    Spring-Batch处理MySQL数据后存到CSV文件
    jQuery EasyUI + struts2.3 + mongoDB 列表查询翻页JAVA样例
    mongodb exception in initAndListen: 12596 old lock file, terminating 解决方法
    硬盘安装RedHat Enterprise Linux 6(转载)
    jQuery zxxbox弹出框插件(v3.0)
    在html页面中利用ftp访问协议格式载入服务器图片
    eclipse中 com.sun.image.codec.jpeg.JPEGCodec 无法编译通过问题
    java 去掉字符串右侧空格
    去掉eclipse js 错误提示
  • 原文地址:https://www.cnblogs.com/liuwenjun/p/11077186.html
Copyright © 2011-2022 走看看