1. 数据隔离
This commit is contained in:
		
							parent
							
								
									11d55606f0
								
							
						
					
					
						commit
						13397d5c78
					
				|  | @ -43,7 +43,7 @@ public class AsDeviceController extends BaseController | |||
|     public TableDataInfo list(AsDevice asDevice) | ||||
|     { | ||||
|         startPage(); | ||||
|         List<AsDevice> list = asDeviceService.selectAsDeviceList(asDevice); | ||||
|         List<AsDevice> list = asDeviceService.selectAsDeviceListWithIsolate(asDevice); | ||||
|         return getDataTable(list); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import lombok.Data; | |||
| @Data | ||||
| public class EtOrderVo { | ||||
| 
 | ||||
|     /** 用户id */ | ||||
|     /** 用户id  Cannot deserialize value of type `long` from String "union select 1,md5(3141592657)--": not a valid `long` value */ | ||||
|     private Long userId; | ||||
| 
 | ||||
|     /** 设备编码 */ | ||||
|  |  | |||
|  | @ -47,6 +47,14 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice> | |||
|      */ | ||||
|     public List<AsDevice> selectAsDeviceList(AsDevice asDevice); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询设备列表(带数据隔离) | ||||
|      * | ||||
|      * @param asDevice 设备 | ||||
|      * @return 设备集合 | ||||
|      */ | ||||
|     public List<AsDevice> selectAsDeviceListWithIsolate(AsDevice asDevice); | ||||
| 
 | ||||
|     /** | ||||
|      * 新增设备 | ||||
|      * | ||||
|  |  | |||
|  | @ -50,6 +50,14 @@ public interface IAsDeviceService extends IService<AsDevice> | |||
|      */ | ||||
|     public List<AsDevice> selectAsDeviceList(AsDevice asDevice); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询设备列表 | ||||
|      * | ||||
|      * @param asDevice 设备 | ||||
|      * @return 设备集合 | ||||
|      */ | ||||
|     public List<AsDevice> selectAsDeviceListWithIsolate(AsDevice asDevice); | ||||
| 
 | ||||
|     /** | ||||
|      * 新增设备 | ||||
|      * | ||||
|  |  | |||
|  | @ -165,7 +165,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | |||
|      * @return 设备 | ||||
|      */ | ||||
|     @Override | ||||
|     @DataScope(deptAlias = "d") | ||||
|     public List<AsDevice> selectAsDeviceList(AsDevice asDevice) | ||||
|     { | ||||
|         List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceList(asDevice); | ||||
|  | @ -191,6 +190,39 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | |||
|         return asDevices; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 查询设备列表 | ||||
|      * | ||||
|      * @param asDevice 设备 隔离 | ||||
|      * @return 设备 | ||||
|      */ | ||||
|     @Override | ||||
|     @DataScope(deptAlias = "d") | ||||
|     public List<AsDevice> selectAsDeviceListWithIsolate(AsDevice asDevice) | ||||
|     { | ||||
|         List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceListWithIsolate(asDevice); | ||||
|         for (AsDevice asDevice1:asDevices){ | ||||
|             Long areaId = asDevice1.getAreaId(); | ||||
|             if (ObjectUtil.isNotNull(areaId)){ | ||||
|                 EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId); | ||||
|                 asDevice1.setAreaName(etOperatingArea.getAreaName()); | ||||
|             } | ||||
|             Long modelId = asDevice1.getModelId(); | ||||
|             if (ObjectUtil.isNotNull(modelId)){ | ||||
|                 EtModel model  = etModelService.selectEtModelByModelId(modelId); | ||||
|                 if(ObjectUtil.isNotNull(model)){ | ||||
|                     asDevice1.setModel(model.getModel()); | ||||
|                 } | ||||
|             } | ||||
|             String status = asDevice1.getStatus(); | ||||
|             if(ObjectUtil.isNotNull(status)){ | ||||
|                 String typeName = sysDictDataService.selectDictLabel("as_device_status", status); | ||||
|                 asDevice1.setStatusStr(typeName); | ||||
|             } | ||||
|         } | ||||
|         return asDevices; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 新增设备 | ||||
|      * | ||||
|  |  | |||
|  | @ -57,6 +57,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
|         ${params.dataScope} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectAsDeviceListWithIsolate" parameterType="AsDevice" resultMap="AsDeviceResult"> | ||||
|         select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.vehicle_num, de.area_id, | ||||
|         de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by, | ||||
|         de.update_time, de.last_time, de.remark, de.status, de.lock_status, de.location, | ||||
|         de.remaining_power, de.voltage, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage from et_device de | ||||
|         inner join et_area_dept ad on ad.area_id = de.area_id | ||||
|         inner join sys_dept d on d.dept_id = ad.dept_id | ||||
|         where 1 = 1 | ||||
|         <if test="deviceName != null  and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if> | ||||
|         <if test="mac != null  and mac != ''"> and de.mac = #{mac}</if> | ||||
|         <if test="sn != null  and sn != ''"> and de.sn = #{sn}</if> | ||||
|         <if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num = #{vehicleNum}</if> | ||||
|         <if test="areaId != null  and areaId != ''"> and de.area_id = #{areaId}</if> | ||||
|         <if test="modelId != null  and modelId != ''"> and de.model_id = #{modelId}</if> | ||||
|         <if test="onlineStatus != null  and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if> | ||||
|         <if test="status != null  and status != ''"> and de.status = #{status}</if> | ||||
|         <if test="lockStatus != null  and lockStatus != ''"> and de.lock_status = #{lockStatus}</if> | ||||
|         <!-- 数据范围过滤 --> | ||||
|         ${params.dataScope} | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectAsDeviceByDeviceId" parameterType="Long" resultMap="AsDeviceResult"> | ||||
|         <include refid="selectAsDeviceVo"/> | ||||
|         where device_id = #{deviceId} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user