This commit is contained in:
parent
c63a79304f
commit
7db751ab74
|
|
@ -186,7 +186,7 @@ public interface SelectMapper {
|
||||||
* @param bean
|
* @param bean
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SelectVo> getTeamList(ProAuthorizeInfo bean);
|
List<ProjectTreeNode> getTeamList(ProAuthorizeInfo bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取工程下拉选
|
* 获取工程下拉选
|
||||||
|
|
@ -257,4 +257,25 @@ public interface SelectMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AgreementVo> getAgreementInfoByIdBack(SelectDto dto);
|
List<AgreementVo> getAgreementInfoByIdBack(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取无需授权的项目部和后勤单位
|
||||||
|
* @param bmUnit
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ProjectTreeNode> getUnitListXm(BmUnit bmUnit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目部项目
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ProjectTreeNode> getUnitListPro(ProAuthorizeInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门项目
|
||||||
|
* @param bmUnit
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BmUnit selectUnitByLeaseId(BmUnit bmUnit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,13 +209,29 @@ public class SelectServiceImpl implements SelectService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getTeamList(ProAuthorizeInfo bean) {
|
public AjaxResult getTeamList(ProAuthorizeInfo bean) {
|
||||||
|
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||||
|
List<ProjectTreeNode> list;
|
||||||
try {
|
try {
|
||||||
// 班组固定查询,typeId为1731
|
list = mapper.getUnitListPro(bean);
|
||||||
return AjaxResult.success(mapper.getTeamList(bean));
|
list = list.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// 创建树形结构(数据集合作为参数)
|
||||||
|
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
|
||||||
|
// 原查询结果转换树形结构
|
||||||
|
groupList = treeBuild.buildTree();
|
||||||
|
// 获取已授权班组,进行数据拼接
|
||||||
|
List<ProjectTreeNode> newList = mapper.getTeamList(bean);
|
||||||
|
if (CollectionUtils.isNotEmpty(newList)) {
|
||||||
|
groupList.addAll(newList);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("班组-查询失败", e);
|
log.error("单位类型树-查询失败", e);
|
||||||
return AjaxResult.success(new ArrayList<>());
|
|
||||||
}
|
}
|
||||||
|
return AjaxResult.success(groupList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -267,7 +283,18 @@ public class SelectServiceImpl implements SelectService {
|
||||||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||||
List<ProjectTreeNode> list;
|
List<ProjectTreeNode> list;
|
||||||
try {
|
try {
|
||||||
list = mapper.getUnitList(bmUnit);
|
list = mapper.getUnitListXm(bmUnit);
|
||||||
|
// 根据leaseId查询授权单位
|
||||||
|
BmUnit info = mapper.selectUnitByLeaseId(bmUnit);
|
||||||
|
if (info != null && info.getUnitId() != null) {
|
||||||
|
// 根据单位id查询授权单位树
|
||||||
|
bmUnit.setUnitId(info.getUnitId());
|
||||||
|
List<ProjectTreeNode> unitList = mapper.getUnitList(bmUnit);
|
||||||
|
if (CollectionUtils.isNotEmpty(unitList)) {
|
||||||
|
list.addAll(unitList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
list = list.stream()
|
list = list.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="deptId != null">
|
<if test="deptId != null">
|
||||||
AND bu.dept_id = #{deptId}
|
AND bu.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
AND bu.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
|
@ -59,6 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="deptId != null">
|
<if test="deptId != null">
|
||||||
AND bu.dept_id = #{deptId}
|
AND bu.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
AND bu.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="deptId != null">
|
<if test="deptId != null">
|
||||||
AND bu.dept_id = #{deptId}
|
AND bu.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
AND bu.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
) ff
|
) ff
|
||||||
ORDER BY
|
ORDER BY
|
||||||
LEVEL
|
LEVEL
|
||||||
|
|
@ -455,16 +464,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card-->
|
<!-- left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card-->
|
||||||
<!-- WHERE bzgl_bz.project_id = #{externalId}-->
|
<!-- WHERE bzgl_bz.project_id = #{externalId}-->
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
<select id="getTeamList" resultType="com.bonus.material.common.domain.vo.SelectVo">
|
|
||||||
SELECT
|
|
||||||
unit_id as id,
|
|
||||||
unit_name AS name
|
|
||||||
FROM
|
|
||||||
bm_unit
|
|
||||||
WHERE
|
|
||||||
del_flag = '0'
|
|
||||||
and type_id = 1731
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getAgreementInfoBy" resultType="com.bonus.material.common.domain.vo.AgreementVo">
|
<select id="getAgreementInfoBy" resultType="com.bonus.material.common.domain.vo.AgreementVo">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -585,4 +585,179 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM clz_bm_agreement_info
|
FROM clz_bm_agreement_info
|
||||||
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
|
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getUnitListXm" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||||
|
/*根据标段工程id查询无需授权的项目部和后勤*/
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
CONCAT( 'dw', sd.dept_id ) AS id,
|
||||||
|
sd.dept_name AS NAME,
|
||||||
|
0 AS parentId,
|
||||||
|
1 AS LEVEL,
|
||||||
|
null AS typeKey
|
||||||
|
FROM
|
||||||
|
sys_dept sd
|
||||||
|
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sd.del_flag = '0'
|
||||||
|
AND sd.`status` = '0'
|
||||||
|
AND (bu.type_id = 36 or bu.type_id = 1685)
|
||||||
|
<if test="projectId != null">
|
||||||
|
AND bp.pro_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND bu.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT DISTINCT
|
||||||
|
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
|
||||||
|
sda.dict_label AS NAME,
|
||||||
|
CONCAT( 'dw', bu.dept_id ) AS parentId,
|
||||||
|
2 AS LEVEL,
|
||||||
|
sda.dict_value AS typeKey
|
||||||
|
FROM
|
||||||
|
bm_unit bu
|
||||||
|
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||||
|
AND sda.dict_type = 'bm_unit_type'
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sda.STATUS = '0'
|
||||||
|
AND (bu.type_id = 36 or bu.type_id = 1685)
|
||||||
|
<if test="projectId != null">
|
||||||
|
AND bp.pro_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND bu.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
bu.unit_id AS id,
|
||||||
|
bu.unit_name AS NAME,
|
||||||
|
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
|
||||||
|
3 AS LEVEL,
|
||||||
|
sda.dict_value AS typeKey
|
||||||
|
FROM
|
||||||
|
bm_unit bu
|
||||||
|
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||||
|
AND sda.dict_type = 'bm_unit_type'
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sda.STATUS = '0'
|
||||||
|
AND (bu.type_id = 36 or bu.type_id = 1685)
|
||||||
|
<if test="projectId != null">
|
||||||
|
AND bp.pro_id = #{projectId}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND bu.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
) ff
|
||||||
|
ORDER BY
|
||||||
|
LEVEL
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTeamList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||||
|
SELECT
|
||||||
|
unit_id as id,
|
||||||
|
unit_name AS name
|
||||||
|
FROM
|
||||||
|
bm_unit
|
||||||
|
WHERE
|
||||||
|
del_flag = '0'
|
||||||
|
and type_id = 1731
|
||||||
|
</select>
|
||||||
|
<select id="getUnitListPro" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||||
|
/*根据标段工程id查询无需授权的项目部和后勤*/
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
CONCAT( 'dw', sd.dept_id ) AS id,
|
||||||
|
sd.dept_name AS NAME,
|
||||||
|
0 AS parentId,
|
||||||
|
1 AS LEVEL,
|
||||||
|
null AS typeKey
|
||||||
|
FROM
|
||||||
|
sys_dept sd
|
||||||
|
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sd.del_flag = '0'
|
||||||
|
AND sd.`status` = '0'
|
||||||
|
AND bu.type_id not in (36, 1685)
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT DISTINCT
|
||||||
|
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
|
||||||
|
sda.dict_label AS NAME,
|
||||||
|
CONCAT( 'dw', bu.dept_id ) AS parentId,
|
||||||
|
2 AS LEVEL,
|
||||||
|
sda.dict_value AS typeKey
|
||||||
|
FROM
|
||||||
|
bm_unit bu
|
||||||
|
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||||
|
AND sda.dict_type = 'bm_unit_type'
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sda.STATUS = '0'
|
||||||
|
AND bu.type_id not in (36, 1685)
|
||||||
|
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
bu.unit_id AS id,
|
||||||
|
bu.unit_name AS NAME,
|
||||||
|
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
|
||||||
|
3 AS LEVEL,
|
||||||
|
sda.dict_value AS typeKey
|
||||||
|
FROM
|
||||||
|
bm_unit bu
|
||||||
|
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||||
|
AND sda.dict_type = 'bm_unit_type'
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
|
||||||
|
AND bai.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
AND bp.del_flag = '0'
|
||||||
|
WHERE
|
||||||
|
bu.del_flag = '0'
|
||||||
|
AND sda.STATUS = '0'
|
||||||
|
AND bu.type_id not in (36, 1685)
|
||||||
|
) ff
|
||||||
|
ORDER BY
|
||||||
|
LEVEL
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUnitByLeaseId" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||||
|
SELECT id as id,
|
||||||
|
lease_id as leaseId,
|
||||||
|
team_id as unitId
|
||||||
|
FROM pro_authorize_info
|
||||||
|
WHERE lease_id = #{leaseId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue