添加选择人员的功能

This commit is contained in:
qiankunpingtai
2019-03-14 11:09:38 +08:00
parent 85d5098d0d
commit 08d3490a5f
11 changed files with 286 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -10,6 +11,8 @@ import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
@@ -311,5 +314,18 @@ public class UserController {
userService.batDeleteUser(ids);
return result;
}
@RequestMapping("/getOrganizationUserTree")
public JSONArray getOrganizationUserTree()throws Exception{
JSONArray arr=new JSONArray();
List<TreeNodeEx> organizationUserTree= userService.getOrganizationUserTree();
if(organizationUserTree!=null&&organizationUserTree.size()>0){
for(TreeNodeEx node:organizationUserTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
}

View File

@@ -3,6 +3,8 @@ package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@@ -31,4 +33,7 @@ public interface UserMapperEx {
@Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
List<TreeNodeEx> getNodeTree();
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
}

View File

@@ -0,0 +1,30 @@
package com.jsh.erp.datasource.vo;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:11
*/
public class NodeAttributes {
//编号
private String no;
//类型
private Integer type;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}

View File

@@ -0,0 +1,96 @@
package com.jsh.erp.datasource.vo;
import java.util.List;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:10
*/
public class TreeNodeEx {
/**
* id主键
* */
private Long id;
/**
* text显示的文本
* */
private String text;
/**
*state节点状态'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
* */
private String state="open";
/**
*iconCls 节点图标id
* */
private String iconCls;
/**
* checked 是否被选中
* */
private boolean checked;
/**
*attributes 自定义属性
* */
private NodeAttributes attributes;
/**
* children 子节点
* */
private List<TreeNode> children;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public NodeAttributes getAttributes() {
return attributes;
}
public void setAttributes(NodeAttributes attributes) {
this.attributes = attributes;
}
public List<TreeNode> getChildren() {
return children;
}
public void setChildren(List<TreeNode> children) {
this.children = children;
}
}

View File

@@ -10,6 +10,8 @@ import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample;
import com.jsh.erp.datasource.mappers.UserMapper;
import com.jsh.erp.datasource.mappers.UserMapperEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
import com.jsh.erp.utils.ExceptionCodeConstants;
@@ -398,4 +400,7 @@ public class UserService {
}
}
public List<TreeNodeEx> getOrganizationUserTree() {
return userMapperEx.getNodeTree();
}
}