ard-work/src/main/java/com/ruoyi/sy/controller/ArdTankLockController.java
@@ -278,13 +278,13 @@ String userId = SecurityUtils.getUserId(); List<Map<String,String>> result = ardTankLockService.getLockByCarPlate(userId,para.get("carPlate")); return getDataTable(result);*/ PageHelper.startPage((Integer) para.get("pageNum"), (Integer) para.get("pageSize")); //PageHelper.startPage((Integer) para.get("pageNum"), (Integer) para.get("pageSize")); String userId = SecurityUtils.getUserId(); List<Map<String,Object>> result = ardTankLockService.getLockByCarPlate(userId, (String) para.get("carPlate")); Map<String,Object> result = ardTankLockService.getLockByCarPlate(userId, (String) para.get("carPlate"),(Integer) para.get("pageNum"), (Integer) para.get("pageSize")); TableDataInfo dataTable = new TableDataInfo(); dataTable.setRows(result); dataTable.setTotal(result.size()); dataTable.setRows((List<Map<String,Object>>) result.get("list")); dataTable.setTotal((Long) result.get("total")); dataTable.setCode(200); dataTable.setMsg("查询成功"); return dataTable; ard-work/src/main/java/com/ruoyi/sy/mapper/ArdTankLockMapper.java
@@ -73,4 +73,10 @@ public int deleteArdTankLockByIdSet(@Param("idSet") Set<String> idSet); public Long selectArdTankLockTotal(); public List<ArdTankLock> getLockByCarIdList(@Param("carIdList") List<String> carIdList); public Long selectArdTankLockAllTotal(); public Long selectArdTankLockTotalByCarIdList(@Param("carIdList") List<String> carIdList); } ard-work/src/main/java/com/ruoyi/sy/service/IArdTankLockService.java
@@ -71,5 +71,5 @@ public int updateLockByCarId(Map<String,Object> para); public List<Map<String, Object>> getLockByCarPlate(String usersId, String carPlate); public Map<String,Object> getLockByCarPlate(String usersId, String carPlate, Integer pageNum, Integer pageSize); } ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankLockServiceImpl.java
@@ -2,6 +2,7 @@ import java.util.*; import com.github.pagehelper.PageHelper; import com.ruoyi.common.core.domain.entity.SysConfig; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.sy.domain.ArdSyUser; @@ -324,36 +325,38 @@ } @Override public List<Map<String, Object>> getLockByCarPlate(String usersId, String carPlate) { List<ArdTankLock> ardTankLockList = ardTankLockMapper.getAll(); public Map<String,Object> getLockByCarPlate(String usersId, String carPlate, Integer pageNum, Integer pageSize) { ArdSyUser ardSyUser = ardSyUserMapper.userById(usersId); if(ardSyUser == null){ return new ArrayList(); return new HashMap(); } List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT"); String syURL = ""; if(syURLResult.size() != 0){ syURL = syURLResult.get(0).getConfigValue(); }else{ return new ArrayList(); return new HashMap(); } String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword()); Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, ardSyUser.getUserId()); String sessionId = (String) LogInResult.get("sessionId"); //List<ArdTankLock> ardTankLockList = ardTankLockMapper.getAll(); List<ArdTankLock> ardTankLockList = new ArrayList(); List<Map<String,Object>> result = new ArrayList(); List<String> carIdList = new ArrayList();//记录三一车辆主键 if(!carPlate.equals("")){ Map<String,Object> carMap = sYClient.getCarListByPlate(syURL,carPlate,ardSyUser.getUserId(),sessionId);//车牌号模糊搜索车辆 List<Map<String,Object>> carList = new ArrayList(); if(((String)carMap.get("rspCode")).equals("1")){ carList = (List<Map<String, Object>>) carMap.get("list"); }else{ return new ArrayList(); return new HashMap(); } List<String> carIdList = new ArrayList();//记录三一车辆主键 //List<String> carIdList = new ArrayList();//记录三一车辆主键 for(Map<String,Object> map : carList){ carIdList.add((String) map.get("carId")); } PageHelper.startPage(pageNum, pageSize);//分页 ardTankLockList = ardTankLockMapper.getLockByCarIdList(carIdList); for(ArdTankLock ardTankLock : ardTankLockList){ if(carIdList.contains(ardTankLock.getCarId())){//返回的车辆包含数据库录入的车辆 Map<String,Object> map = new HashMap(); @@ -382,6 +385,8 @@ } } }else{ PageHelper.startPage(pageNum, pageSize);//分页 ardTankLockList = ardTankLockMapper.getAll(); for(ArdTankLock ardTankLock : ardTankLockList){ Map<String,Object> map = new HashMap(); map.put("id",ardTankLock.getId()); @@ -409,6 +414,15 @@ result.add(map); } } return result; Long total = Long.valueOf(0); if(!carPlate.equals("")){ total = ardTankLockMapper.selectArdTankLockTotalByCarIdList(carIdList); }else{ total = ardTankLockMapper.selectArdTankLockAllTotal(); } Map<String,Object> mapResult = new HashMap(); mapResult.put("list",result); mapResult.put("total",total); return mapResult; } } ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
@@ -126,4 +126,23 @@ <select id="selectArdTankLockTotal" resultType="java.lang.Long"> select count(distinct atl.car_id) from ard_tank_lock atl </select> <select id="getLockByCarIdList" > select * from ard_tank_lock where id in <foreach item="id" collection="carIdList" open="(" separator="," close=")"> #{id} </foreach> order by atl.car_id,lock_num </select> <select id="selectArdTankLockAllTotal" resultType="java.lang.Long"> select count(*) from ard_tank_lock atl </select> <select id="selectArdTankLockTotalByCarIdList" > select count(*) from ard_tank_lock where id in <foreach item="id" collection="carIdList" open="(" separator="," close=")"> #{id} </foreach> </select> </mapper>