根据部门过滤

This commit is contained in:
nyoung 2024-09-21 17:36:52 +08:00
parent 2d83cf1883
commit 38291f3400
4 changed files with 28 additions and 1 deletions

View File

@ -187,4 +187,7 @@ public class RescueInfo extends TenantBaseDO
@TableField(exist = false)
private List<String> roadIds;
@TableField(exist = false)
private List<Long> deptList;
}

View File

@ -55,7 +55,7 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
void dealOverTimeRescue();
List<RescueInfo> getOverTimeRescue();
Map<String,Object> getRescueStatistics(RescueInfo rescueInfo);
Map<String,Object> getRescueStatisticsByAdmin(RescueInfo rescueInfo);
Map<String,Object> getRescueStatisticsByAdmin(@Param("map") RescueInfo rescueInfo);
void deleteOtherInfo1(@Param("rescueId") Long rescueId);
void deleteOtherInfo2(@Param("rescueId") Long rescueId);

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
@ -234,8 +235,15 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Override
public IPage<RescueInfo> selectRescueInfoListByAdmin(RescueInfo rescueInfo, Page<RescueInfo> page) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
List<DeptRespDTO> childDeptList = deptService.getChildDeptList(adminUser.getDeptId());
List<Long> deptList = childDeptList.stream().map(DeptRespDTO::getId).collect(Collectors.toList());
deptList.add(adminUser.getDeptId());
rescueInfo.setDeptList(deptList);
IPage<RescueInfo> rescueInfos = baseMapper.selectRescueInfoList(rescueInfo, page);
for (RescueInfo info : rescueInfos.getRecords()) {
String dljy_type = dictDataService.getDictDataLabel("dljy_type", info.getRescueType());
info.setRescueTypeStr(dljy_type);
@ -821,6 +829,12 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Override
public Map<String, Object> getRescueStatisticsByAdmin(RescueInfo rescueInfo) {
LoginUser user = getLoginUser();
AdminUserRespDTO adminUser = userService.getUser(user.getId());
List<DeptRespDTO> childDeptList = deptService.getChildDeptList(adminUser.getDeptId());
List<Long> deptList = childDeptList.stream().map(DeptRespDTO::getId).collect(Collectors.toList());
deptList.add(adminUser.getDeptId());
rescueInfo.setDeptList(deptList);
Map<String, Object> res = baseMapper.getRescueStatisticsByAdmin(rescueInfo);
return res;

View File

@ -48,6 +48,11 @@
<if test="map.licenseNum != null">
and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if>
<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in <foreach collection="map.deptList" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</if>
</where>
order by ri.create_time desc
</select>
@ -341,6 +346,11 @@
FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id
where 1 = 1
<if test="map.deptList != null and map.deptList.size()>0">
and ri.dept_id in <foreach collection="map.deptList" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</if>
</select>
<delete id="deleteOtherInfo1">
DELETE