!35 添加选择人员的功能

Merge pull request !35 from 乾坤平台/master
This commit is contained in:
乾坤平台
2019-03-15 22:27:31 +08:00
committed by 季圣华
26 changed files with 360 additions and 66 deletions

View File

@@ -99,4 +99,7 @@
} }
.icon-basket_add{ .icon-basket_add{
background:url('icons/basket_add.png') no-repeat center center; background:url('icons/basket_add.png') no-repeat center center;
}
.icon-user{
background:url('icons/user.png') no-repeat center center;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

View File

@@ -4,6 +4,7 @@
<title>ERP系统</title> <title>ERP系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=8" > <meta http-equiv="X-UA-Compatible" content="IE=8" >
<meta name="referrer" content="Webkit">
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<link type="text/css" rel="stylesheet" href="/css/css.css"/> <link type="text/css" rel="stylesheet" href="/css/css.css"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script> <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>

View File

@@ -80,8 +80,11 @@
<td>负责人</td> <td>负责人</td>
<td style="padding:5px"> <td style="padding:5px">
<input name="principalName" id="principalName" <input name="principalName" id="principalName"
style="width: 230px;height: 20px" readonly="readonly"/> style="width: 175px;height: 20px" readonly="readonly"/>
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectUser">
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
<input name="principal" id="principal" type="hidden"/> <input name="principal" id="principal" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -104,6 +107,9 @@
<a href="javascript:void(0)" id="cancelDepot" class="easyui-linkbutton" iconCls="icon-cancel" <a href="javascript:void(0)" id="cancelDepot" class="easyui-linkbutton" iconCls="icon-cancel"
onclick="javascript:$('#depotDlg').dialog('close')">取消</a> onclick="javascript:$('#depotDlg').dialog('close')">取消</a>
</div> </div>
<div id="forSelectUserDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
closed="true" modal="true" cache="false" collapsible="false" closable="true">
</div>
<script type="text/javascript"> <script type="text/javascript">
//初始化界面 //初始化界面
@@ -164,7 +170,7 @@
formatter: function (value, rec) { formatter: function (value, rec) {
var str = ''; var str = '';
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.sort + 'AaBb' + rec.remark + 'AaBb' var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.sort + 'AaBb' + rec.remark + 'AaBb'
+ rec.address + 'AaBb' + rec.warehousing + 'AaBb' + rec.truckage+ transferUndefined(rec.principalName)+transferUndefined(rec.principal); + rec.address + 'AaBb' + rec.warehousing + 'AaBb' + rec.truckage+'AaBb'+ transferUndefined(rec.principalName)+'AaBb'+transferUndefined(rec.principal);
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepot(\'' + rowInfo + '\');"/>&nbsp;&nbsp;&nbsp;'; str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepot(\'' + rowInfo + '\');"/>&nbsp;&nbsp;&nbsp;';
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepot(' + rec.id + ');"/>'; str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepot(' + rec.id + ');"/>';
return str; return str;
@@ -324,7 +330,7 @@
$(".window-mask").css({width: webW, height: webH}); $(".window-mask").css({width: webW, height: webH});
$('#depotFM').form('clear'); $('#depotFM').form('clear');
$("#name").focus(); $("#name").focus();
$("#selectType").val("principal");
oldDepot = ""; oldDepot = "";
depotID = 0; depotID = 0;
url = '/depot/add'; url = '/depot/add';
@@ -370,7 +376,9 @@
$("#address").val(depotInfo[4]); $("#address").val(depotInfo[4]);
$("#warehousing").val(depotInfo[5]); $("#warehousing").val(depotInfo[5]);
$("#truckage").val(depotInfo[6]); $("#truckage").val(depotInfo[6]);
$("#principalName").val(depotInfo[7]);
$("#principal").val(depotInfo[8]);
$("#selectType").val("principal");
oldDepot = depotInfo[1]; oldDepot = depotInfo[1];
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑仓库信息'); $('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑仓库信息');
$(".window-mask").css({width: webW, height: webH}); $(".window-mask").css({width: webW, height: webH});
@@ -486,6 +494,19 @@
parent.addTab(currentRow[0].id + "单元", "/pages/materials/building.jsp?ProjectId=" + currentRow[0].id, ""); parent.addTab(currentRow[0].id + "单元", "/pages/materials/building.jsp?ProjectId=" + currentRow[0].id, "");
}); });
//查询负责人信息
$("#lookForSelectUser").on("click", function () {
$('#forSelectUserDlg').dialog({
title: '负责人选择',
width: webW/2,
height: webH/2,
closed: false,
cache: false,
href: '/pages/manage/user_forselect.html',
modal: true,
resizable:true
});
});
</script> </script>
</body> </body>
</html> </html>

View File

@@ -116,6 +116,7 @@
var url; var url;
//初始化界面 //初始化界面
$(function () { $(function () {
var id=$("#id").val();
var treeHeight=webH-35; var treeHeight=webH-35;
//初始化系统基础信息 //初始化系统基础信息
$('#tableData').datagrid({ $('#tableData').datagrid({
@@ -142,7 +143,7 @@
}); });
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>"); $('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
$('#tt').tree({ $('#tt').tree({
url: '/organization/getOrganizationTree', url: '/organization/getOrganizationTree?id='+id,
animate: true, animate: true,
checkbox: true, checkbox: true,
onDblClick: function(node){ onDblClick: function(node){

View File

@@ -23,8 +23,9 @@
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var id=$("#id").val();
$('#ttForSelect').tree({ $('#ttForSelect').tree({
url: '/organization/getOrganizationTree', url: '/organization/getOrganizationTree?id='+id,
animate: true, animate: true,
onDblClick: function (node) { onDblClick: function (node) {
//双击修改 //双击修改

View File

@@ -70,6 +70,8 @@
<input name="orgaId" id="orgaId" type="hidden"/> <input name="orgaId" id="orgaId" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/> <input name="selectType" id="selectType" type="hidden"/>
<input name="orgaUserRelId" id="orgaUserRelId" type="hidden"/> <input name="orgaUserRelId" id="orgaUserRelId" type="hidden"/>
<!--一个兼容input框没有实际用处但是必须存在-->
<input name="id" id="id" type="hidden"/>
</div> </div>
<div class="fitem" style="padding:5px"> <div class="fitem" style="padding:5px">
<label id="userBlngOrgaDsplSeqLabel">用户排序&nbsp;&nbsp;</label> <label id="userBlngOrgaDsplSeqLabel">用户排序&nbsp;&nbsp;</label>

View File

@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<title>机构选择</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
<ul id="ttForSelect"></ul>
</div>
<script type="text/javascript">
$(function () {
$('#ttForSelect').tree({
url: '/user/getOrganizationUserTree',
animate: true,
onDblClick: function (node) {
//双击修改
forSelectUser(node);
}
});
function forSelectUser(node) {
var selectType=$("#selectType").val();
console.log(node);
if(!node.attributes.type){
return;
}
if(selectType=='principal'){
$("#principalName").val(node.text);
$("#principal").val(node.id);
}else if(selectType=='org'){
$("#orgAbr").val(node.text);
$("#orgaId").val(node.id);
}
$('#forSelectUserDlg').dialog('close');
}
});
</script>
</body>
</html>

View File

@@ -82,6 +82,7 @@
//初始化界面 //初始化界面
$(function () { $(function () {
var treeHeight=webH-35; var treeHeight=webH-35;
var id=$("#id").val();
//初始化系统基础信息 //初始化系统基础信息
$('#tableData').datagrid({ $('#tableData').datagrid({
height: treeHeight, height: treeHeight,
@@ -107,7 +108,7 @@
}); });
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>"); $('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
$('#tt').tree({ $('#tt').tree({
url: '/materialCategory/getMaterialCategoryTree', url: '/materialCategory/getMaterialCategoryTree?id='+id,
animate: true, animate: true,
checkbox: true, checkbox: true,
onDblClick: function(node){ onDblClick: function(node){

View File

@@ -21,10 +21,19 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
/**
* create by: qiankunpingtai
* create time: 2019/3/14 11:41
* description:
* 为了防止当前节点选择父级目录为其子代节点造成闭环无法获取的问题
* 决定对树结构可选父级目录做一个筛选,只能为其上级目录
*
*/
$(function () { $(function () {
var id=$("#id").val();
console.log(id);
$('#ttForSelect').tree({ $('#ttForSelect').tree({
url: '/materialCategory/getMaterialCategoryTree', url: '/materialCategory/getMaterialCategoryTree?id='+id,
animate: true, animate: true,
onDblClick: function (node) { onDblClick: function (node) {
//双击修改 //双击修改

View File

@@ -83,7 +83,14 @@ public class BusinessConstants {
/** /**
* 商品类别根目录id * 商品类别根目录id
* */ * */
public static final Long MATERIAL_CATEGORY_ROOT_ID = 1L; /**
* create by: qiankunpingtai
* create time: 2019/3/14 11:41
* description:
* 为了使用户可以自己建初始目录设定根目录的父级目录id为-1
*
*/
public static final Long MATERIAL_CATEGORY_ROOT_PARENT_ID = -1L;
/** /**
* 商品类别状态 * 商品类别状态
* 0系统默认1启用2删除 * 0系统默认1启用2删除
@@ -101,10 +108,10 @@ public class BusinessConstants {
public static final String ORGANIZATION_STCD_BUSINESS_TERMINATED = "4"; public static final String ORGANIZATION_STCD_BUSINESS_TERMINATED = "4";
public static final String ORGANIZATION_STCD_REMOVED = "5"; public static final String ORGANIZATION_STCD_REMOVED = "5";
/** /**
* 根机构编号 * 根机构父级编号
* 根机构编号默认为-1 * 根机父级构编号默认为-1
* */ * */
public static final String ORGANIZATION_ROOT_NO = "-1"; public static final String ORGANIZATION_ROOT_PARENT_NO = "-1";
/** /**
* 新增用户默认密码 * 新增用户默认密码
* */ * */

View File

@@ -92,9 +92,9 @@ public class MaterialCategoryController {
* @return com.alibaba.fastjson.JSONArray * @return com.alibaba.fastjson.JSONArray
*/ */
@RequestMapping(value = "/getMaterialCategoryTree") @RequestMapping(value = "/getMaterialCategoryTree")
public JSONArray getMaterialCategoryTree() throws Exception{ public JSONArray getMaterialCategoryTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray(); JSONArray arr=new JSONArray();
List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree(); List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree(id);
if(materialCategoryTree!=null&&materialCategoryTree.size()>0){ if(materialCategoryTree!=null&&materialCategoryTree.size()>0){
for(TreeNode node:materialCategoryTree){ for(TreeNode node:materialCategoryTree){
String str=JSON.toJSONString(node); String str=JSON.toJSONString(node);

View File

@@ -95,9 +95,9 @@ public class OrganizationController {
* @return com.alibaba.fastjson.JSONArray * @return com.alibaba.fastjson.JSONArray
*/ */
@RequestMapping(value = "/getOrganizationTree") @RequestMapping(value = "/getOrganizationTree")
public JSONArray getOrganizationTree() throws Exception{ public JSONArray getOrganizationTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray(); JSONArray arr=new JSONArray();
List<TreeNode> organizationTree= organizationService.getOrganizationTree(); List<TreeNode> organizationTree= organizationService.getOrganizationTree(id);
if(organizationTree!=null&&organizationTree.size()>0){ if(organizationTree!=null&&organizationTree.size()>0){
for(TreeNode node:organizationTree){ for(TreeNode node:organizationTree){
String str=JSON.toJSONString(node); String str=JSON.toJSONString(node);

View File

@@ -1,6 +1,7 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; 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.SerialNumberEx;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx; 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.service.user.UserService;
import com.jsh.erp.utils.*; import com.jsh.erp.utils.*;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -311,5 +314,18 @@ public class UserController {
userService.batDeleteUser(ids); userService.batDeleteUser(ids);
return result; 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

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Description * Description
@@ -24,8 +25,8 @@ public interface MaterialCategoryMapperEx {
@Param("name") String name, @Param("name") String name,
@Param("parentId") Integer parentId); @Param("parentId") Integer parentId);
List<TreeNode> getNodeTree(); List<TreeNode> getNodeTree(@Param("currentId")Long currentId);
List<TreeNode> getNextNodeTree(@Param("id") Long id); List<TreeNode> getNextNodeTree(Map<String, Object> parameterMap);
int addMaterialCategory(MaterialCategory mc); int addMaterialCategory(MaterialCategory mc);

View File

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Description * Description
@@ -17,8 +18,8 @@ import java.util.List;
public interface OrganizationMapperEx { public interface OrganizationMapperEx {
List<TreeNode> getNodeTree(); List<TreeNode> getNodeTree(@Param("currentId")Long currentId);
List<TreeNode> getNextNodeTree(@Param("id") Long id); List<TreeNode> getNextNodeTree(Map<String, Object> parameterMap);
int addOrganization(Organization org); int addOrganization(Organization org);

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.User;
import com.jsh.erp.datasource.entities.UserEx; import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample; 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 org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
@@ -31,4 +33,7 @@ public interface UserMapperEx {
@Param("loginame") String loginame); @Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status); 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

@@ -100,8 +100,8 @@ public class MaterialCategoryService {
* @Param: * @Param:
* @return java.util.List<com.jsh.erp.datasource.vo.TreeNode> * @return java.util.List<com.jsh.erp.datasource.vo.TreeNode>
*/ */
public List<TreeNode> getMaterialCategoryTree() throws Exception{ public List<TreeNode> getMaterialCategoryTree(Long id) throws Exception{
return materialCategoryMapperEx.getNodeTree(); return materialCategoryMapperEx.getNodeTree(id);
} }
/** /**
* create by: cjl * create by: cjl
@@ -117,8 +117,8 @@ public class MaterialCategoryService {
return 0; return 0;
} }
if(mc.getParentid()==null){ if(mc.getParentid()==null){
//没有给定父级目录的id默认设置父级目录为根目录 //没有给定父级目录的id默认设置父级目录为根目录的父目录
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_ID); mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
} }
//检查商品类型编号是否已存在 //检查商品类型编号是否已存在
checkMaterialCategorySerialNo(mc); checkMaterialCategorySerialNo(mc);
@@ -148,40 +148,16 @@ public class MaterialCategoryService {
if(strArray.length<1){ if(strArray.length<1){
return 0; return 0;
} }
/**
* create by: qiankunpingtai
* create time: 2019/3/13 14:49
* description:
* 添加一个限制,根目录不允许删除
*/
String rootIdStr=BusinessConstants.MATERIAL_CATEGORY_ROOT_ID.toString();
for(String s:strArray){
if(rootIdStr.equals(s)){
logger.error("异常码[{}],异常提示[{}],参数,id:[{}]",
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG,s);
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG);
}
}
return materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray); return materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int editMaterialCategory(MaterialCategory mc) { public int editMaterialCategory(MaterialCategory mc) {
/** if(mc.getParentid()==null){
* create by: qiankunpingtai //没有给定父级目录的id默认设置父级目录为根目录的父目录
* create time: 2019/3/13 14:49 mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
* description:
* 添加一个限制根目录不允许修改
*/
if(BusinessConstants.MATERIAL_CATEGORY_ROOT_ID.equals(mc.getId())){
logger.error("异常码[{}],异常提示[{}],参数,id:[{}]",
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG,mc.getId());
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG);
} }
//检查商品类型编号是否已存在 //检查商品类型编号是否已存在
checkMaterialCategorySerialNo(mc); checkMaterialCategorySerialNo(mc);
//更新时间 //更新时间

View File

@@ -82,7 +82,7 @@ public class OrganizationService {
* 未指定父级机构的时候默认为根机构 * 未指定父级机构的时候默认为根机构
* */ * */
if(StringUtil.isEmpty(org.getOrgParentNo())){ if(StringUtil.isEmpty(org.getOrgParentNo())){
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_NO); org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
} }
return organizationMapperEx.addOrganization(org); return organizationMapperEx.addOrganization(org);
} }
@@ -103,13 +103,13 @@ public class OrganizationService {
* 未指定父级机构的时候默认为根机构 * 未指定父级机构的时候默认为根机构
* */ * */
if(StringUtil.isEmpty(org.getOrgParentNo())){ if(StringUtil.isEmpty(org.getOrgParentNo())){
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_NO); org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_PARENT_NO);
} }
return organizationMapperEx.editOrganization(org); return organizationMapperEx.editOrganization(org);
} }
public List<TreeNode> getOrganizationTree()throws Exception { public List<TreeNode> getOrganizationTree(Long id)throws Exception {
return organizationMapperEx.getNodeTree(); return organizationMapperEx.getNodeTree(id);
} }
public List<Organization> findById(Long id) throws Exception{ public List<Organization> findById(Long id) throws Exception{

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

View File

@@ -33,14 +33,14 @@
<resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode"> <resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="name" property="text"/> <result column="name" property="text"/>
<collection column="id" property="children" javaType="java.util.ArrayList" <collection column="{currentId=currentId,id=id}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/> ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap> </resultMap>
<resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode"> <resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="name" property="text"/> <result column="name" property="text"/>
<collection column="id" property="children" javaType="java.util.ArrayList" <collection column="{currentId=currentId,id=id}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/> ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap> </resultMap>
@@ -50,19 +50,25 @@
<select id="getNextNodeTree" resultMap="NextTreeResultMap"> <select id="getNextNodeTree" resultMap="NextTreeResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_materialcategory FROM jsh_materialcategory
WHERE ParentId = #{id} WHERE ParentId = #{id}
<if test="currentId != null">
and id !=#{currentId}
</if>
and status !='2' and status !='2'
order by sort asc order by sort asc
</select> </select>
<select id="getNodeTree" resultMap="BaseTreeResultMap"> <select id="getNodeTree" resultMap="BaseTreeResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_materialcategory FROM jsh_materialcategory
WHERE ParentId = -1 WHERE ParentId = -1
and status !='2' and status !='2'
<if test="currentId != null">
and id !=#{currentId}
</if>
order by sort asc order by sort asc
</select> </select>
<insert id="addMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategory" <insert id="addMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategory"

View File

@@ -6,7 +6,7 @@
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="org_abr" property="text"/> <result column="org_abr" property="text"/>
<result column="org_no" property="attributes"/> <result column="org_no" property="attributes"/>
<collection column="org_no" property="children" javaType="java.util.ArrayList" <collection column="{currentId=currentId,org_no=org_no}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/> ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap> </resultMap>
@@ -14,7 +14,7 @@
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="org_abr" property="text"/> <result column="org_abr" property="text"/>
<result column="org_no" property="attributes"/> <result column="org_no" property="attributes"/>
<collection column="org_no" property="children" javaType="java.util.ArrayList" <collection column="{currentId=currentId,org_no=org_no}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/> ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap> </resultMap>
@@ -24,18 +24,24 @@
<select id="getNextNodeTree" resultMap="NextTreeResultMap"> <select id="getNextNodeTree" resultMap="NextTreeResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_organization FROM jsh_organization
WHERE org_parent_no = #{org_no} WHERE org_parent_no = #{org_no}
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5' and org_stcd !='5'
order by sort asc order by sort asc
</select> </select>
<select id="getNodeTree" resultMap="BaseTreeResultMap"> <select id="getNodeTree" resultMap="BaseTreeResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_organization FROM jsh_organization
WHERE org_parent_no = -1 WHERE org_parent_no = -1
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5' and org_stcd !='5'
order by sort asc order by sort asc
</select> </select>

View File

@@ -132,4 +132,56 @@
</foreach> </foreach>
) )
</update> </update>
<resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNodeEx">
<result column="id" property="id"/>
<result column="text" property="text"/>
<association property="attributes" javaType="com.jsh.erp.datasource.vo.NodeAttributes">
<id column="orgNo" property="no"></id>
<result column="type" property="type"></result>
</association>
<collection column="{orgId=id,orgNo=orgNo}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNodeEx">
<result column="id" property="id"/>
<result column="text" property="text"/>
<result column="iconCls" property="iconCls"/>
<association property="attributes" javaType="com.jsh.erp.datasource.vo.NodeAttributes">
<id column="orgNo" property="no"></id>
<result column="type" property="type"></result>
</association>
<collection column="{orgId=id,orgNo=orgNo}" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<select id="getNextNodeTree" resultMap="NextTreeResultMap">
select id , text,orgNo,sort ,iconCls,type from (
SELECT
org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type
FROM jsh_organization org
WHERE org.org_parent_no = #{orgNo}
and org.org_stcd !='5'
union all
select
user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type
from jsh_user user,jsh_orga_user_rel rel
where
1=1
and user.id=rel.user_id
and rel.orga_id=#{orgId}
and rel.delete_flag !='1'
and user.status not in ('1','2')
) node
order by sort asc
</select>
<select id="getNodeTree" resultMap="BaseTreeResultMap">
SELECT
id, org_abr as text,org_no as orgNo,'0' as type
FROM jsh_organization
WHERE org_parent_no = -1
and org_stcd !='5'
order by sort asc
</select>
</mapper> </mapper>