Commit 5e54a651 authored by zengtianlai3's avatar zengtianlai3

用户、设备、应用、操作日志和告警列表查询,使用倒叙排序

parent f21bd39d
......@@ -50,7 +50,7 @@ public class ApplyController {
@DynamicParameter(name = "appKey",value = "应用key",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "userId",value = "用户Id",required = true,dataTypeClass = Integer.class)
}))
public BaseResult addUser(@RequestBody JSONObject jsonObject) {
public BaseResult addApply(@RequestBody JSONObject jsonObject) {
String appName = jsonObject.getString("appName");
String appKey = jsonObject.getString("appKey");
int userId = jsonObject.getIntValue("userId");
......@@ -76,7 +76,7 @@ public class ApplyController {
@ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType = "int"),
@ApiImplicitParam(name = "appName",value = "应用名")
})
public PageResult<AppVo> getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
public PageResult<AppVo> getAppList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize,
@RequestParam(value = "appName",required = false) String appName) {
PageInfoModel<AppVo> records = applyService.getAppList(pageNo,pageSize,appName);
......
......@@ -10,7 +10,9 @@ import iot.sixiang.license.service.AlarmService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements AlarmService {
......@@ -25,8 +27,10 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
@Override
public List<AlarmVo> getAlarmList(int userId) {
if (userId == 0) {
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(),ResultCode.VALIDATE_FAILED.getMsg());
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(), ResultCode.VALIDATE_FAILED.getMsg());
}
return alarmMapper.getAlarmList(userId);
List<AlarmVo> alarmVos = alarmMapper.getAlarmList(userId);
alarmVos = alarmVos.stream().sorted(Comparator.comparing(AlarmVo::getId, Comparator.reverseOrder())).collect(Collectors.toList());
return alarmVos;
}
}
......@@ -57,7 +57,7 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(),ResultCode.VALIDATE_FAILED.getMsg());
}
List<AppVo> records = applyMapper.getAppList(appName);
records = records.stream().sorted(Comparator.comparing(AppVo::getAppId)).collect(Collectors.toList());
records = records.stream().sorted(Comparator.comparing(AppVo::getAppId, Comparator.reverseOrder())).collect(Collectors.toList());
List<AppVo> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize;
if (begin >= 0 && records.size() > 0) {
......
......@@ -39,7 +39,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(),ResultCode.VALIDATE_FAILED.getMsg());
}
List<DeviceVo> deviceTypes = deviceMapper.getDeviceList(appName,userName);
deviceTypes = deviceTypes.stream().sorted(Comparator.comparing(DeviceVo::getDeviceId)).collect(Collectors.toList());
deviceTypes = deviceTypes.stream().sorted(Comparator.comparing(DeviceVo::getDeviceId, Comparator.reverseOrder())).collect(Collectors.toList());
List<DeviceVo> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize;
if (begin >= 0 && deviceTypes.size() > 0) {
......
......@@ -42,7 +42,7 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(),ResultCode.VALIDATE_FAILED.getMsg());
}
List<SysOperLog> records = sysOperLogMapper.getOperLogList();
records = records.stream().sorted(Comparator.comparing(SysOperLog::getId)).collect(Collectors.toList());
records = records.stream().sorted(Comparator.comparing(SysOperLog::getId, Comparator.reverseOrder())).collect(Collectors.toList());
List<SysOperLog> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize;
if (begin >= 0 && records.size() > 0) {
......
......@@ -38,7 +38,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
throw new IotLicenseException(ResultCode.VALIDATE_FAILED.getCode(),ResultCode.VALIDATE_FAILED.getMsg());
}
List<UserVo> records = userMapper.getUserList(userName,company);
records = records.stream().sorted(Comparator.comparing(UserVo::getUserId)).collect(Collectors.toList());
records = records.stream().sorted(Comparator.comparing(UserVo::getUserId, Comparator.reverseOrder())).collect(Collectors.toList());
List<UserVo> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize;
if (begin >= 0 && records.size() > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment