修改查询任务执行记录、查询机构列表数据权限。

This commit is contained in:
haown 2024-06-06 08:42:04 +08:00
parent 763fcead28
commit 2ff9acbd2f
6 changed files with 23 additions and 9 deletions

View File

@ -44,7 +44,7 @@ public class SysRole extends BaseEntity {
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限
*/
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限,6=本机构数据权限")
private String dataScope;
/**

View File

@ -49,7 +49,6 @@ public class AgencyController extends BaseController {
*/
@GetMapping("/selectAgencyList")
public AjaxResult selectAgencyByIdList(Agency agency) {
// TODO 根据用户角色确定查询范围
return agencyService.selectAgencyByIdList(agency);
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.service.agency.impl;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.entity.SysRole;
import com.xinelu.common.enums.NodeTypeEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
@ -21,19 +22,18 @@ import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
import com.xinelu.manage.vo.agency.HospitalVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
@ -102,6 +102,14 @@ public class AgencyServiceImpl implements IAgencyService {
*/
@Override
public AjaxResult selectAgencyByIdList(Agency agency) {
// 查询用户角色
List<SysRole> roleList = SecurityUtils.getLoginUser().getUser().getRoles();
if (CollectionUtils.isNotEmpty(roleList)) {
List<String> dataScopeList = roleList.stream().map(SysRole::getDataScope).collect(Collectors.toList());
if (!dataScopeList.contains("1")) { // 不是全部数据权限就只查询本机构
agency.setId(SecurityUtils.getLoginUser().getUser().getHospitalAgencyId());
}
}
return AjaxResult.success(agencyMapper.selectAgencyList(agency));
}

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.patienttaskexecuterecord.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord;
@ -44,6 +45,7 @@ public class PatientTaskExecuteRecordServiceImpl implements IPatientTaskExecuteR
* @return 患者管理任务执行记录
*/
@Override
@DataScope(agencyAlias = "pi", deptAlias = "pi")
public List<PatientTaskExecuteRecordVO> selectPatientTaskExecuteRecordList(PatientTaskExecuteRecordVO patientTaskExecuteRecord) {
return patientTaskExecuteRecordMapper.selectPatientAndExecuteRecordList(patientTaskExecuteRecord);
}

View File

@ -58,6 +58,9 @@
<select id="selectAgencyList" parameterType="Agency" resultMap="AgencyResult">
<include refid="selectAgencyVo"/>
<where>
<if test="id != null ">
and id = #{id}
</if>
<if test="parentId != null ">
and parent_id = #{parentId}
</if>

View File

@ -149,6 +149,8 @@
<if test="manageRouteName != null and manageRouteName != ''">
and pter.manage_route_name like concat('%', #{manageRouteName}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectPatientTaskExecuteRecordById" parameterType="Long"