VehicleMapper.java 12.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
package cn.com.glsx.admin.modules.mapper;

import cn.com.glsx.admin.modules.entity.Vehicle;
import cn.com.glsx.admin.modules.model.*;
import cn.com.glsx.admin.modules.model.dto.BasicInformationDTO;
import cn.com.glsx.admin.modules.model.export.*;
import cn.com.glsx.admin.modules.model.param.*;
import cn.com.glsx.admin.modules.model.stat.StatCountModel;
import cn.com.glsx.admin.modules.model.view.SimpleVehicleDTO;
import cn.com.glsx.admin.modules.model.vo.AlarmVehicleVO;
import cn.com.glsx.admin.modules.model.vo.RegionalSearchVO;
import com.glsx.plat.common.annotation.DataOnlyShared;
import com.glsx.plat.common.annotation.DataPerm;
import com.glsx.plat.common.annotation.DataPermShare;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.Date;
import java.util.List;

@Mapper
public interface VehicleMapper extends CommonBaseMapper<Vehicle> {

    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<VehicleLinkSnsDTO> linkSnsSearch(VehicleSearch search);

    List<VehicleLinkSnsDTO> selectVehicleLinkSnsByUserId(@Param("userId") Long userId, @Param("trialType") Integer trialType);

    /**
     * 获取试驾数据拆除报警基本信息
     *
     * @param keywords
     * @return
     */
    @DataPerm(showSql = true)
    List<TearDownModelExport> searchTearDownAlarmList(@Param("keywords") String keywords);

    /**
     * 分页查询试驾车辆列表
     *
     * @param search
     * @return
     */
    @DataPerm(showSql = true)
    List<TrialDriveVehiclePageDTO> searchTrialDrive(VehicleManageSearch search);

    /**
     * 导出试驾车辆数据
     *
     * @param search
     * @return
     */
    @DataPerm(showSql = true)
    List<TrialDriveVehicleExport> exportDriveVehicle(VehicleManageSearch search);

    /**
     * 根据綁定的设备号查找车辆信息
     *
     * @param sn
     * @return
     */
    List<Vehicle> findVehicleInfoBySn(@Param("sn") String sn);

    /**
     * 车辆监控树-搜索车辆设备信息
     *
     * @param search
     * @return
     */
    List<OrgVehicleModel> selectOrgVehicle(VehicleTreeSearch search);

    /**
     * 车辆监控树-搜索车辆设备信息
     *
     * @param search
     * @return
     */
    List<OrgVehicleModel> selectOrgVehicleSns(VehicleTreeSearch search);

    /**
     * 车辆监控树-获取用户全部车辆(自有权限+授权数据)
     *
     * @param search
     * @return
     */
    List<OrgVehicleModel> selectUserAllVehicleSns(VehicleTreeSearch search);

    /**
     * 分享的车辆数据
     *
     * @param search
     * @return
     */
    List<OrgVehicleModel> selectAbsolutelyVehicleSns(VehicleTreeSearch search);

    Vehicle selectById(@Param("id") Long id);

    List<Vehicle> selectByIds(@Param("ids") Collection<Long> ids);

    /**
     * 根据车架号查找车辆
     *
     * @param vin 车架号
     * @return 车辆数据集合
     */
    Vehicle getVehicleByVin(@Param("vin") String vin);

    /**
     * 根据车架号获取车辆数据集合
     *
     * @param vin 车架号
     * @return
     */
    List<Vehicle> getVehicleListByVin(@Param("vin") String vin);

    /**
     * 根据权限查询车架号对应的车辆
     *
     * @param vin 车架号
     * @return
     */
    @DataPerm(permTable = "tv", showSql = true)
    List<Vehicle> getVehicleListByVinWithAuth(@Param("vin") String vin);

    /**
     * 查询车辆基础信息
     *
     * @param search
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true, permitTypeField = "permitType")
    List<VehicleInfoPageDTO> searchVehicleInfo(VehicleInfoSearch search);

    /**
     * 导出车辆基础信息
     *
     * @param search
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<VehicleInfoExport> exportVehicleInfo(VehicleInfoSearch search);

    @DataPerm(showSql = true)
    List<TestVehicleDTO> listTestDriveVehicle(TestVehicleSearch testVehicleSearch);

    /**
     * 根据权限获取该账户下 所有设备号集合
     *
     * @return 设备集合
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<String> getAllDeviceSnByAuth();

    /**
     * 根据权限获取该账户下 所有设备激活信息集合
     *
     * @param deviceActiveSearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<DeviceActiveExprot> getBaseDeviceActiveListWithAuth(DeviceActiveSearch deviceActiveSearch);

    /**
     * 根据权限获取该账户下 所有设备最后定位点信息集合
     *
     * @param finalPositioningSearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<FinalPositioningExport> findFinalPositioningList(FinalPositioningSearch finalPositioningSearch);

    /**
     * 根据权限获取该账户下 所有设备大数据研判信息集合
     *
     * @param judgmentSearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<JudgmentExport> findJudgmentList(JudgmentSearch judgmentSearch);

    /**
     * 根据权限获取有警情的车辆列表(按车辆ID分组)
     *
     * @param alarmSns 有警情的设备号列表
     * @param search   查询参数
     * @return 警情车辆列表
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<AlarmVehicleVO> findAlarmVehicleList(@Param("alarmSns") List<String> alarmSns, @Param("search") JudgmentSearch search);

    /**
     * 根据权限获取该账户下 所有设备里程基础信息集合
     *
     * @param journeySearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<JourneyExport> findJourneyList(JourneySearch journeySearch);

    /**
     * 根据权限获取该账户下 所有设备里程基础信息集合数量
     *
     * @param journeySearch 查询条件
     * @return 数量
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<Integer> countJourneyList(JourneySearch journeySearch);

    /**
     * 根据权限获取该账户下 所有设备离线信息集合
     *
     * @param offlineSearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<OfflineExport> findOfflineList(OfflineSearch offlineSearch);

    /**
     * 根据权限获取该账户下 获取所有设备数据拆除报警基本信息
     *
     * @param commonTearDownSearch
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<CommonTearDownModelExport> searchCommonTearDownAlarmList(CommonTearDownSearch commonTearDownSearch);

    /**
     * 根据权限获取该账户下 获取所有设备数据详细里程基本信息
     *
     * @param journeyDetailSearch
     * @return
     */
    @DataPerm(showSql = true)
    List<JourneyDetailExport> findJourneyDetailList(JourneyDetailSearch journeyDetailSearch);

    /**
     * 根据权限获取该账户下 获取所有设备数据详细里程基本信息 数量
     *
     * @param journeyDetailSearch 查询条件
     * @return 数量
     */
    @DataPerm(showSql = true)
    List<Integer> countJourneyDetailList(JourneyDetailSearch journeyDetailSearch);

    /**
     * 根据权限获取该账户下 获取设备激活数据
     *
     * @param appendSql 拼接SQl
     * @param period    日期类型
     * @return
     */
    @Deprecated
    @DataPerm(permTable = "temp", showSql = true)
    List<ActiveDeviceVo> getActiveDeviceInfoWithAuth(@Param("appendSql") String appendSql, @Param("period") Integer period);

    /**
     * 根据权限获取该账户下 获取设备绑定数据
     *
     * @param appendSql 拼接SQl
     * @return
     */
    @Deprecated
    @DataPerm(permTable = "temp", showSql = true)
    List<DeviceBindVo> getBindDeviceInfoWithAuth(@Param("appendSql") String appendSql);

    /**
     * 统计设备离线数
     *
     * @param
     * @param offlineSnStr 不计算离线的设备集合
     * @param offlineTime  离线时间
     * @return
     */
    @Deprecated
    @DataPerm(showSql = true)
    @DataPermShare(linkTable = "t_vehicle", showSql = true)
    List<StatCountModel> getOfflineNumber(@Param("offlineSnStr") String offlineSnStr, @Param("offlineTime") long offlineTime);

    /**
     * 查询行驶里程
     *
     * @param journeyDailySearch
     * @return
     */
    @DataPerm(showSql = true)
    List<JourneyDailyExport> findJourneyDailyList(JourneyDailySearch journeyDailySearch);

    /**
     * 统计设备离线报警
     *
     * @param lostBegin 离线时间
     * @return
     */
    @DataPerm(showSql = true)
    @DataPermShare(showSql = true)
    List<StatCountModel> getOffLineAlarmCount(@Param("lostBegin") String lostBegin);

    Vehicle selectByOrderId(@Param("workOrderId") Long workOrderId);

    /**
     * 查询任何车辆by工单id,删除的也可以查
     *
     * @param workOrderId
     * @return
     */
    Vehicle selectAnyByOrderId(@Param("workOrderId") Long workOrderId);

    List<Vehicle> selectByOrderIds(@Param("orderIds") Collection<Long> orderIds);

    /**
     * 获取车辆和设备绑定关系
     *
     * @return
     */
    List<VehicleDeviceMapDto> getVehicleAndDeviceMap();

    /**
     * 根据权限获取该用户下面的车架号
     *
     * @return
     */
    @DataPerm(showSql = true)
    List<String> getVehicleByPermission();

    /**
     * 根据工单业务号和车架号获取车辆
     *
     * @param bizOrderNo
     * @param vin
     * @return
     */
    Vehicle selectBizWorkNoAndVin(@Param("bizOrderNo") String bizOrderNo, @Param("vin") String vin);

    /**
     * 查询用户被分享的车辆数据
     *
     * @return
     */
    @DataOnlyShared
    List<Vehicle> selectAllShared();

    List<SimpleVehicleDTO> searchWithoutPermit(ApiVehicleSearch search);

    /**
     * @description: 通过车架号+工单ID查询唯一的车辆信息
     * @author: wangxw1
     * @date: 2022/4/25 17:19
     * @param: [vinValidCondition]
     * @return: cn.com.glsx.admin.modules.entity.Vehicle
     **/
    Vehicle selectVehicleUnique(Vehicle vinValidCondition);

    @DataPerm(showSql = true)
    @DataPermShare(showSql = true, permitTypeField = "permitType")
    List<ReportVehicleDTO> searchReportVehicle(ReportVehicleSearch search);

    @DataPerm(showSql = true)
    @DataPermShare(showSql = true, permitTypeField = "permitType")
    List<ReportVehicleExport> exportReportVehicle(ReportVehicleSearch search);

    /**
     * 修改车辆结清标识接口
     *
     * @param id
     * @param settleFlag
     * @return
     */
    int updateSettleFlagById(@Param("id") Long id, @Param("settleFlag") Integer settleFlag);

    int countByUserId(@Param("userId") Long userId);

    /**
     * 查询租户节点下面是否存在存在相同的车辆
     *
     * @param vin      车架号
     * @param tenantId 租户ID
     * @return
     */
    List<Vehicle> getVehicleListByVinAndTenantId(@Param("vin") String vin, @Param("tenantId") Long tenantId);

    @DataPerm(permTable = "tv", showSql = true)
    @DataPermShare(linkTable = "t_vehicle", showSql = true)
    List<RegionalSearchVO> getVehicleInfoListBySns(@Param("sns") String sns);

    @DataPerm(permTable = "tv", showSql = true)
    List<VehicleLocationDTO> findVehicleInfoListByOrg(@Param("sns") String sns);

    /**
     * 通过车辆ID获取车辆基本信息
     *
     * @param vehicleId 车辆ID
     * @return
     */
    BasicInformationDTO getBasicInformationByVehicleId(@Param("vehicleId") Long vehicleId);

    /**
     * 通过车架号获取设备离线数据
     *
     * @param vehicleId        车架号ID
     * @param OfflineStartTime 离线时间
     * @return 设备离线数据
     */
    List<OfflineExport> findOfflineDataByVehicleId(@Param("vehicleId") Long vehicleId, @Param("offlineStartTime") String OfflineStartTime);

    /**
     * 获取车辆(设备)激活时间(因为车辆绑定设备的激活时间取值顺序是:工单完成时间、车辆入库时间)
     *
     * @param vehicleId
     * @return
     */
    Date getActiveDate(@Param("vehicleId") Long vehicleId);

    /**
     * 批量更新车辆的所属组织层级
     *
     * @param orgId
     * @param vehicleIds
     */
    void orgBatchUpdate(@Param("orgId") Long orgId, @Param("vehicleIds") List<Long> vehicleIds);

    /**
     * 批量更新车辆的是否已结清状态
     *
     * @param settleFlag
     * @param vehicleIds
     */
    void settleFlagBatchUpdate(@Param("settleFlag") Integer settleFlag, @Param("vehicleIds") List<Long> vehicleIds);
}