机构树形列表修改。
This commit is contained in:
parent
4682bd75e4
commit
31559ec869
@ -50,6 +50,11 @@ public class DataScopeAspect {
|
|||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_AGENCY = "6";
|
public static final String DATA_SCOPE_AGENCY = "6";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构及下属机构数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_AGENCY_AND_CHILD = "7";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据权限过滤关键字
|
* 数据权限过滤关键字
|
||||||
*/
|
*/
|
||||||
@ -95,7 +100,9 @@ public class DataScopeAspect {
|
|||||||
role.getRoleId()));
|
role.getRoleId()));
|
||||||
} else if(DATA_SCOPE_AGENCY.equals(dataScope)){ // 机构数据权限
|
} else if(DATA_SCOPE_AGENCY.equals(dataScope)){ // 机构数据权限
|
||||||
sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", agencyAlias, user.getHospitalAgencyId()));
|
sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", agencyAlias, user.getHospitalAgencyId()));
|
||||||
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限
|
} else if(DATA_SCOPE_AGENCY_AND_CHILD.equals(dataScope)){ // 本机构及下属机构数据权限
|
||||||
|
sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} OR {}.hospital_agency_id IN (SELECT id FROM AGENCY WHERE parent_id = {})", agencyAlias, user.getHospitalAgencyId(), agencyAlias, user.getHospitalAgencyId()));
|
||||||
|
}else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限
|
||||||
sqlString.append(StringUtils.format(" OR {}.department_id = {} ", deptAlias, user.getDepartmentId()));
|
sqlString.append(StringUtils.format(" OR {}.department_id = {} ", deptAlias, user.getDepartmentId()));
|
||||||
} else if (StringUtils.equals(dataScope, DATA_SCOPE_SELF) && StringUtils.isNotBlank(userAlias)) { // 本人数据权限
|
} else if (StringUtils.equals(dataScope, DATA_SCOPE_SELF) && StringUtils.isNotBlank(userAlias)) { // 本人数据权限
|
||||||
sqlString.append(StringUtils.format(" OR {} = {} ", userAlias, user.getUserId()));
|
sqlString.append(StringUtils.format(" OR {} = {} ", userAlias, user.getUserId()));
|
||||||
|
|||||||
@ -11,15 +11,21 @@ import com.xinelu.manage.domain.agency.Agency;
|
|||||||
import com.xinelu.manage.dto.agency.AgencyDTO;
|
import com.xinelu.manage.dto.agency.AgencyDTO;
|
||||||
import com.xinelu.manage.dto.agency.HospitalDTO;
|
import com.xinelu.manage.dto.agency.HospitalDTO;
|
||||||
import com.xinelu.manage.service.agency.IAgencyService;
|
import com.xinelu.manage.service.agency.IAgencyService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构信息Controller
|
* 机构信息Controller
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.xinelu.manage.dto.agency;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 机构树形列表查询传输对象
|
||||||
|
* @author: haown
|
||||||
|
* @create: 2024-11-26 14:40
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class AgencyTreeDto extends Agency {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否本机构及下属机构,0:否,1:是
|
||||||
|
*/
|
||||||
|
private String agencyAndChild;
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ package com.xinelu.manage.mapper.agency;
|
|||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
||||||
import com.xinelu.manage.dto.agency.AgencyDTO;
|
import com.xinelu.manage.dto.agency.AgencyDTO;
|
||||||
|
import com.xinelu.manage.dto.agency.AgencyTreeDto;
|
||||||
import com.xinelu.manage.vo.agency.AgencyVO;
|
import com.xinelu.manage.vo.agency.AgencyVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ public interface AgencyMapper {
|
|||||||
* @param agency 机构信息
|
* @param agency 机构信息
|
||||||
* @return 机构信息集合
|
* @return 机构信息集合
|
||||||
*/
|
*/
|
||||||
List<AgencyVO> selectAgencyVOList(Agency agency);
|
List<AgencyVO> selectAgencyVOList(AgencyTreeDto agency);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增机构信息
|
* 新增机构信息
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.xinelu.manage.domain.agency.Agency;
|
|||||||
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
|
||||||
import com.xinelu.manage.domain.department.Department;
|
import com.xinelu.manage.domain.department.Department;
|
||||||
import com.xinelu.manage.dto.agency.AgencyDTO;
|
import com.xinelu.manage.dto.agency.AgencyDTO;
|
||||||
|
import com.xinelu.manage.dto.agency.AgencyTreeDto;
|
||||||
import com.xinelu.manage.dto.agency.HospitalDTO;
|
import com.xinelu.manage.dto.agency.HospitalDTO;
|
||||||
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||||
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
||||||
@ -188,7 +189,20 @@ public class AgencyServiceImpl implements IAgencyService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AgencyTreeVO> agencyList() {
|
public List<AgencyTreeVO> agencyList() {
|
||||||
List<AgencyVO> agencies = agencyMapper.selectAgencyVOList(null);
|
// 根据角色判断取数据
|
||||||
|
AgencyTreeDto query = new AgencyTreeDto();
|
||||||
|
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")) {// 全部数据权限
|
||||||
|
} else if (dataScopeList.contains("7")) { // 本机构及下属机构
|
||||||
|
query.setAgencyAndChild("1");
|
||||||
|
query.setId(SecurityUtils.getLoginUser().getUser().getHospitalAgencyId());
|
||||||
|
} else if (dataScopeList.contains("6")) { // 本机构
|
||||||
|
query.setId(SecurityUtils.getLoginUser().getUser().getHospitalAgencyId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<AgencyVO> agencies = agencyMapper.selectAgencyVOList(query);
|
||||||
for (AgencyVO agency : agencies) {
|
for (AgencyVO agency : agencies) {
|
||||||
agency.setValue(agency.getId().toString());
|
agency.setValue(agency.getId().toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,41 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAgencyVOList" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
<select id="selectAgencyVOList" resultType="com.xinelu.manage.vo.agency.AgencyVO">
|
||||||
<include refid="selectAgencyVo"/>
|
select id,
|
||||||
|
parent_id,
|
||||||
|
agency_category_id,
|
||||||
|
agency_category_name,
|
||||||
|
area_code,
|
||||||
|
area_name,
|
||||||
|
agency_name,
|
||||||
|
agency_code,
|
||||||
|
agency_abbreviation,
|
||||||
|
agency_status,
|
||||||
|
node_type,
|
||||||
|
org_agency_code,
|
||||||
|
agency_category_manage_level,
|
||||||
|
agency_contacts,
|
||||||
|
agency_phone,
|
||||||
|
agency_address,
|
||||||
|
agency_remark,
|
||||||
|
agency_sort,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time
|
||||||
|
from agency
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
<choose>
|
||||||
|
<when test='agencyAndChild != null and agencyAndChild == "1"'>
|
||||||
|
and (id = #{id} or parent_id = #{id})
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and id = #{id}
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
order by agency_sort asc
|
order by agency_sort asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user