"jshERP-web/src/git@ustchcs.com:gujinli1118/JSH_ERP.git" did not exist on "bc3c0a446067377c9aac9322f903f3e8c32f1e61"
Commit 2fb4195f authored by 乾坤平台's avatar 乾坤平台 Committed by 季圣华
Browse files

!35 添加选择人员的功能

Merge pull request !35 from 乾坤平台/master
parents 85d5098d 72e088c6
...@@ -100,8 +100,8 @@ public class MaterialCategoryService { ...@@ -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 { ...@@ -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 { ...@@ -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);
//更新时间 //更新时间
......
...@@ -82,7 +82,7 @@ public class OrganizationService { ...@@ -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 { ...@@ -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{
......
...@@ -10,6 +10,8 @@ import com.jsh.erp.datasource.entities.UserEx; ...@@ -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 { ...@@ -398,4 +400,7 @@ public class UserService {
} }
} }
public List<TreeNodeEx> getOrganizationUserTree() {
return userMapperEx.getNodeTree();
}
} }
...@@ -33,14 +33,14 @@ ...@@ -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 @@ ...@@ -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"
......
...@@ -6,7 +6,7 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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>
......
...@@ -132,4 +132,56 @@ ...@@ -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>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment