Commit cf55039f authored by gaodongdong's avatar gaodongdong

修改bug

parent bd456242
...@@ -35,11 +35,12 @@ public interface IOrgUsrService { ...@@ -35,11 +35,12 @@ public interface IOrgUsrService {
* @param NAMEMethodName * @param NAMEMethodName
* @param PARENTIDMethodName * @param PARENTIDMethodName
* @param OrgTypeMethodName * @param OrgTypeMethodName
* @param KeyMethodName
* @return * @return
* @throws Exception * @throws Exception
*/ */
List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception; String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception;
/** /**
* 获取子数据集合 * 获取子数据集合
...@@ -55,7 +56,7 @@ public interface IOrgUsrService { ...@@ -55,7 +56,7 @@ public interface IOrgUsrService {
* @throws Exception * @throws Exception
*/ */
List<OrgMenuVo> getSub(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, List<OrgMenuVo> getSub(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception; String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception;
/** /**
* 组装融合调度单位人员信息 * 组装融合调度单位人员信息
......
...@@ -14,26 +14,28 @@ import java.util.List; ...@@ -14,26 +14,28 @@ import java.util.List;
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value="OrgMenuVo", description="树菜单") @ApiModel(value="OrgMenuVo", description="树菜单")
public class OrgMenuVo { public class OrgMenuVo {
public Long key; public String key;
public String title; public String title;
public Long id;
public Long parentId; public Long parentId;
public boolean leaf = true; public boolean leaf = true;
public List<OrgMenuVo> children; public List<OrgMenuVo> children;
public String bizOrgType; public String bizOrgType;
public OrgMenuVo(Long key, String title, Long parentId, String bizOrgType, boolean leaf) { public OrgMenuVo(String key, String title, Long parentId, String bizOrgType, boolean leaf, Long id) {
super(); super();
this.key = key; this.key = key;
this.title = title; this.title = title;
this.parentId = parentId; this.parentId = parentId;
this.bizOrgType = bizOrgType; this.bizOrgType = bizOrgType;
this.leaf = leaf; this.leaf = leaf;
this.id= id;
} }
public OrgMenuVo(Long key, String title, Long parentId, String bizOrgType) { public OrgMenuVo(String key, String title, Long parentId, String bizOrgType, Long id) {
this.key = key; this.key = key;
this.id = id;
this.title = title; this.title = title;
this.parentId = parentId; this.parentId = parentId;
this.children = children;
this.bizOrgType = bizOrgType; this.bizOrgType = bizOrgType;
} }
......
...@@ -29,20 +29,21 @@ ...@@ -29,20 +29,21 @@
cb_org_usr u LEFT JOIN cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId} where
AND u.biz_org_type = #{bizOrgType} u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0 AND u.is_delete = 0
<if test="bizOrgName != null">
AND u.biz_org_name = #{bizOrgName}
</if>
<if test="bizOrgCode != null and bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY GROUP BY
u.sequence_nbr , u.sequence_nbr ,
u.biz_org_name , u.biz_org_name ,
u.biz_org_code u.biz_org_code
)a where a.sequenceNbr is not null )a where a.sequenceNbr is not null
<if test="bizOrgName != null">
AND u.bizOrgName = #{bizOrgName}
</if>
<if test="bizOrgCode != null">
AND u.bizOrgName = #{bizOrgCode}
</if>
<if test="fieldsValue != null"> <if test="fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item"> AND a.${item} = #{fieldsValue[${item}]} </foreach> <foreach collection="fieldsValue.keys" item="item"> AND a.${item} = #{fieldsValue[${item}]} </foreach>
</if> </if>
...@@ -63,20 +64,20 @@ ...@@ -63,20 +64,20 @@
cb_org_usr u LEFT JOIN cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId} where
AND u.biz_org_type = #{bizOrgType} u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0 AND u.is_delete = 0
<if test="bizOrgName != null">
AND u.biz_org_name = #{bizOrgName}
</if>
<if test="bizOrgCode != null and bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY GROUP BY
u.sequence_nbr , u.sequence_nbr ,
u.biz_org_name , u.biz_org_name ,
u.biz_org_code u.biz_org_code
)a where a.sequenceNbr is not null )a where a.sequenceNbr is not null
<if test="bizOrgName != null">
AND u.bizOrgName = #{bizOrgName}
</if>
<if test="bizOrgCode != null">
AND u.bizOrgName = #{bizOrgCode}
</if>
<if test="fieldsValue != null"> <if test="fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item" > AND a.${item} = #{fieldsValue[${item}]} </foreach> <foreach collection="fieldsValue.keys" item="item" > AND a.${item} = #{fieldsValue[${item}]} </foreach>
</if> </if>
...@@ -114,6 +115,7 @@ ...@@ -114,6 +115,7 @@
SELECT SELECT
sequence_nbr, sequence_nbr,
biz_org_name, biz_org_name,
biz_org_code,
biz_org_type, biz_org_type,
parent_id parent_id
FROM FROM
......
...@@ -140,7 +140,7 @@ public class OrgUsrController extends BaseController { ...@@ -140,7 +140,7 @@ public class OrgUsrController extends BaseController {
@RequestMapping(value = "/companyTree", method = RequestMethod.GET) @RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取单位部门树", notes = "获取单位部门树") @ApiOperation(httpMethod = "GET", value = "获取单位部门树", notes = "获取单位部门树")
public ResponseModel< List<OrgMenuVo>>selectCompanyTree() throws Exception { public ResponseModel< List<OrgMenuVo>>selectCompanyTree() throws Exception {
List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType"); List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType", "getBizOrgCode");
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
......
...@@ -69,7 +69,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -69,7 +69,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
@Override @Override
public List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception { public List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception {
List<OrgMenuVo> resultList = new ArrayList<>(); List<OrgMenuVo> resultList = new ArrayList<>();
Class<?> clazz = Class.forName(packageURL); Class<?> clazz = Class.forName(packageURL);
Method IDMethodNameme = null; Method IDMethodNameme = null;
...@@ -91,6 +91,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -91,6 +91,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName); Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
Method KeyMethodNameme = clazz.getDeclaredMethod(KeyMethodName);
//获取顶层元素集合 //获取顶层元素集合
Long parentId; Long parentId;
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -100,20 +101,20 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -100,20 +101,20 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null; parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null || topId == parentId) { if (parentId == null || topId == parentId) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false); OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
resultList.add(menu); resultList.add(menu);
} }
} }
//获取每个顶层元素的子数据集合 //获取每个顶层元素的子数据集合
for (OrgMenuVo entity : resultList) { for (OrgMenuVo entity : resultList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName)); entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName, KeyMethodName));
} }
return resultList; return resultList;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<OrgMenuVo> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception { public List<OrgMenuVo> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception {
List<OrgMenuVo> childList = new ArrayList<>(); List<OrgMenuVo> childList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -135,7 +136,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -135,7 +136,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName); Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method KeyMethodNameme = clazz.getDeclaredMethod(KeyMethodName);
Long parentId; Long parentId;
//子集的直接子对象 //子集的直接子对象
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -145,12 +146,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -145,12 +146,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (parentId == null) { if (parentId == null) {
if (topId == parentId) { if (topId == parentId) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity))); OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
childList.add(menu); childList.add(menu);
} }
} else { } else {
if (topId.longValue() == parentId.longValue()) { if (topId.longValue() == parentId.longValue()) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity))); OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
childList.add(menu); childList.add(menu);
} }
} }
...@@ -159,7 +160,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -159,7 +160,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
//子集的间接子对象 //子集的间接子对象
for (OrgMenuVo entity : childList) { for (OrgMenuVo entity : childList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName)); entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName, KeyMethodName));
if (entity.getChildren() != null) { if (entity.getChildren() != null) {
entity.setLeaf(false); entity.setLeaf(false);
} }
...@@ -261,11 +262,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -261,11 +262,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) { if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) {
map.put("bizOrgName", req.get("bizOrgName")); map.put("bizOrgName", req.get("bizOrgName"));
} }
map.put("parentId", req.get("parentId")); map.put("bizOrgCode", req.get("bizOrgCode"));
req.remove("bizOrgName"); req.remove("bizOrgName");
req.remove("pageSize"); req.remove("pageSize");
req.remove("pageNum"); req.remove("pageNum");
req.remove("parentId"); req.remove("bizOrgCode");
map.put("fieldsValue", req); map.put("fieldsValue", req);
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode())); map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
pageBean.setTotal(this.baseMapper.selectPersonListCount(map)); pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
...@@ -584,7 +585,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -584,7 +585,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
columnMap.put("is_delete", CommonConstant.IS_DELETE_00); columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON); columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
Collection<OrgUsr> list = listByMap(columnMap); Collection<OrgUsr> list = listByMap(columnMap);
return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType"); return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType", "getBizOrgCode");
} }
......
Markdown is supported
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