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

  • 相关阅读:
    Spring boot unable to determine jdbc url from datasouce
    Unable to create initial connections of pool. spring boot mysql
    spring boot MySQL Public Key Retrieval is not allowed
    spring boot no identifier specified for entity
    Establishing SSL connection without server's identity verification is not recommended
    eclipse unable to start within 45 seconds
    Oracle 数据库,远程访问 ora-12541:TNS:无监听程序
    macOS 下安装tomcat
    在macOS 上添加 JAVA_HOME 环境变量
    Maven2: Missing artifact but jars are in place
  • 原文地址:https://www.cnblogs.com/liuwenjun/p/11077186.html
Copyright © 2011-2022 走看看