|
@@ -1,14 +1,17 @@
|
|
package cn.rankin.userservice.service;
|
|
package cn.rankin.userservice.service;
|
|
|
|
|
|
|
|
+import cn.rankin.common.utils.api.model.APIResult;
|
|
|
|
+import cn.rankin.common.utils.api.page.Page;
|
|
|
|
+import cn.rankin.common.utils.enums.BaseOrderEnum;
|
|
|
|
+import cn.rankin.common.utils.util.JpaSortUtil;
|
|
import cn.rankin.data.api.user.dto.UserDeviceDTO;
|
|
import cn.rankin.data.api.user.dto.UserDeviceDTO;
|
|
import cn.rankin.data.api.user.entity.UserDevice;
|
|
import cn.rankin.data.api.user.entity.UserDevice;
|
|
-import cn.rankin.data.api.user.vo.UserDeviceVo;
|
|
|
|
-import cn.rankin.userservice.helper.RaStringHelper;
|
|
|
|
import cn.rankin.userservice.repository.UserDeviceRepository;
|
|
import cn.rankin.userservice.repository.UserDeviceRepository;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -20,7 +23,6 @@ public class UserDeviceService
|
|
/**
|
|
/**
|
|
* Find
|
|
* Find
|
|
*
|
|
*
|
|
- * @param userDeviceVo
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public int opUserDevice(UserDeviceDTO uerDeviceDTO)
|
|
public int opUserDevice(UserDeviceDTO uerDeviceDTO)
|
|
@@ -80,4 +82,23 @@ public class UserDeviceService
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public APIResult<Page<UserDevice>> search(UserDevice simple, Integer pageNo, Integer pageSize, LinkedHashMap<String,BaseOrderEnum> sort) {
|
|
|
|
+ Long count = userDeviceRepository.count(simple);
|
|
|
|
+ Page<UserDevice> page = new Page<>(count, pageNo, pageSize);
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ return APIResult.ok(page);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<UserDevice> result = userDeviceRepository.find(simple, page.getStart(), page.getPageSize(), JpaSortUtil.sort(sort));
|
|
|
|
+ page.setList(result);
|
|
|
|
+
|
|
|
|
+ return APIResult.ok(page);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public APIResult<UserDevice> searchDeviceModel(String deviceModel) {
|
|
|
|
+ List<UserDevice> deviceModels = userDeviceRepository.queryDeviceModel(deviceModel);
|
|
|
|
+ return APIResult.ok(deviceModels);
|
|
|
|
+ }
|
|
}
|
|
}
|