JSK 添加组织权限查询数据。

This commit is contained in:
jiask 2026-01-05 09:48:03 +08:00
parent 30276847ae
commit 4559bdcefa
13 changed files with 61 additions and 8 deletions

View File

@ -62,7 +62,7 @@ public class ApprovalProcess implements Serializable {
@ApiModelProperty("备注")
private String remark;
private Long deptId;
/**
* 审批节点列表非数据库字段
*/

View File

@ -28,6 +28,8 @@ public class ApprovalProcessServiceImpl implements IApprovalProcessService {
@Override
public List<ApprovalProcess> selectProcessList(ApprovalProcess process) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
process.setDeptId(deptId);
return processMapper.selectProcessList(process);
}

View File

@ -31,7 +31,7 @@ public class BmContractServiceImpl implements BmContractService {
@Override
public List<BmContract> list(BmContract bmContract) {
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getDeptId());
List<BmContract> list = bmContractMapper.list(bmContract);
for (BmContract contract : list) {
BmFileInfo bmFileInfo = new BmFileInfo();

View File

@ -202,4 +202,6 @@ public class DevInfoVo extends DevInfo {
private String maType;
private String toolType;
private Long deptId;
}

View File

@ -904,6 +904,8 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public List<DevInfoVo> getDevList(DevInfoVo devInfo) {
// 直接由SQL一次性返回 rentNum maStatus无需循环二次查询
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
devInfo.setDeptId(deptId);
return devInfoMapper.getDevList(devInfo);
}

View File

@ -35,6 +35,7 @@ public class SysDeptController extends BaseController {
@GetMapping("/deptTree")
public AjaxResult deptTree(SysDept dept) {
try {
return success(service.selectDeptTreeList(dept));
} catch (Exception e) {
logger.error(e.toString(), e);

View File

@ -51,6 +51,10 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
public List<SysUser> selectUserList(DeptEquipmentConfig user) {
if(user.getDeptId()==null||"".equals(user.getDeptId())){
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
user.setDeptId(deptId);
}
List<SysUser> sysUsers = mapper.selectUserList(user);
return sysUsers;
}
@ -80,6 +84,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
public List<DeptConfigRateSummary> selectDeptConfigRatePivot(DeptConfigRateSummary entity) {
// 1. 查询配置率项每条代表一个公司+设备+评分项
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
entity.setDeptId(deptId);
List<DeptConfigRateSummary> configList = mapper.selectDeptConfigRatePivot(entity);
BigDecimal max = new BigDecimal("20");
// 2. 查询 ma_own_manage 表中原始设备数据

View File

@ -32,6 +32,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="processName != null and processName != ''">
AND process_name like concat('%', #{processName}, '%')
</if>
<if test="deptId != null and deptId != 0">
AND (org_id = #{deptId} OR org_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>
<if test="businessType != null and businessType != ''">
AND business_type = #{businessType}
</if>

View File

@ -29,7 +29,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBmCompanyAddressList" parameterType="com.bonus.material.basic.domain.BmCompanyAddress" resultMap="BmCompanyAddressResult">
<include refid="selectBmCompanyAddressVo"/>
<where>
<if test="companyId != null "> and bca.company_id = #{companyId}</if>
<if test="companyId != null ">
AND (bca.company_id = #{companyId} OR bca.company_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{companyId},
ancestors) ))
</if>
<if test="provinceCode != null "> and bca.province_code = #{provinceCode}</if>
<if test="cityCode != null "> and bca.city_code = #{cityCode}</if>
<if test="areaCode != null "> and bca.area_code = #{areaCode}</if>

View File

@ -36,6 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contractName != null and contractName != ''">
and contract_name like concat('%', #{contractName}, '%')
</if>
<if test="ownerCom != null and ownerCom != 0">
AND (owner_com = #{ownerCom} OR owner_com IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{ownerCom},
ancestors) ))
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND update_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -985,6 +985,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt1.del_flag = '0'
WHERE
d.is_active = '1' and d.entry_status ='1'
<if test="deptId != null and deptId != 0">
AND (sd.dept_id = #{deptId} OR sd.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>
<if test="deviceName != null and deviceName != ''">
AND d.device_name like concat('%',#{deviceName},'%')
</if>

View File

@ -84,6 +84,10 @@
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="companyId != null and companyId != 0">
AND (d.dept_id = #{companyId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{companyId},
ancestors) ))
</if>
</select>
<select id="selectDeptVOList" resultMap="SysDeptVOResult">
@ -120,7 +124,12 @@
IF(MAX(mdc.config_value) IS NOT NULL AND MAX(mdc.config_value) != '', '已配置', '未配置') AS configStatus
FROM
ma_type_view mtv
LEFT JOIN ma_dept_config mdc ON mdc.type_id = mtv.typeId AND mdc.dept_id = #{deptId}
LEFT JOIN ma_dept_config mdc ON mdc.type_id = mtv.typeId
where 1=1
<if test="deptId != null and deptId != 0">
AND (mdc.dept_id = #{deptId} OR mdc.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>
GROUP BY
mtv.typeId
UNION ALL
@ -136,12 +145,16 @@
END AS configStatus
FROM
tool_type tt
LEFT JOIN ma_dept_config mdc ON mdc.type_id = tt.type_id AND mdc.dept_id = #{deptId}
LEFT JOIN ma_dept_config mdc ON mdc.type_id = tt.type_id
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
WHERE
tt.LEVEL = 4
<if test="deptId != null and deptId != 0">
AND (mdc.dept_id = #{deptId} OR mdc.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>
GROUP BY
tt.type_id
) t
@ -227,6 +240,11 @@
GROUP BY sd.dept_id, mt.type_id) order_stat
ON order_stat.dept_id = grouped.dept_id
AND order_stat.parent_type_id = grouped.type_id
where 1=1
<if test="deptId != null and deptId != 0">
AND (grouped.dept_id = #{deptId} OR grouped.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>
UNION
@ -266,7 +284,12 @@
where devType = 1
GROUP BY sd.dept_id, mt.type_id) order_stat
ON order_stat.dept_id = grouped.dept_id
AND order_stat.parent_type_id = grouped.type_id;
AND order_stat.parent_type_id = grouped.type_id
where 1=1
<if test="deptId != null and deptId != 0">
AND (grouped.dept_id = #{deptId} OR grouped.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
ancestors) ))
</if>;
</select>
<select id="selectDeptConfigTypeSummary" resultType="com.bonus.material.equipment.domain.DeptConfigTypeSummary">

View File

@ -191,10 +191,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and moi.code like concat('%',#{keyWord},'%')
</if>
<if test="buyerCompany != null">
AND moi.buyer_company = #{buyerCompany}
AND (moi.buyer_company = #{buyerCompany} OR moi.buyer_company IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{buyerCompany},
ancestors) ))
</if>
<if test="sellerCompany != null">
AND mdi.on_company = #{sellerCompany}
AND (mdi.on_company = #{sellerCompany} OR mdi.on_company IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{sellerCompany},
ancestors) ))
</if>
<!-- <if test="deviceName != null and deviceName != ''">-->
<!-- AND mdi.device_name like concat('%',#{deviceName},'%')-->