Browse Source

# 风险点列表导出接口

zhongwei
haungxing 10 months ago
parent
commit
2b3a75a842
  1. 20
      hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java
  2. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java

20
hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java

@ -32,16 +32,18 @@ public class Condition extends org.springblade.core.mp.support.Condition {
QueryWrapper<T> queryWrapper = getQueryWrapper(query,clazz);
List<Field> fields = getFieldList(query);
// 填充排序字段
orderFields.forEach((fieldName,order) -> {
Optional<Field> existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny();
if(existField.isPresent()) {
if(Order.ASC.equals(order)) {
queryWrapper.orderByAsc(fieldName);
orderFields.forEach((fieldNames,order) -> {
Func.toStrList(",",fieldNames).stream().forEach(fieldName -> {
Optional<Field> existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny();
if(existField.isPresent()) {
if(Order.ASC.equals(order)) {
queryWrapper.orderByAsc(fieldName);
}
else if(Order.DESC.equals(order)) {
queryWrapper.orderByDesc(fieldName);
}
}
else if(Order.DESC.equals(order)) {
queryWrapper.orderByDesc(fieldName);
}
}
});
});
return queryWrapper.lambda();
}

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java

@ -60,7 +60,7 @@ public interface IDangerSourceService extends BaseService<DangerSourceEntity> {
default LambdaQueryWrapper<DangerSourceEntity> getQueryWrapper(Object req) {
Map<String, Order> param = new HashMap<>();
param.put("create_time",Order.DESC);
param.put("create_time,update_time",Order.DESC);
return Condition.getQueryWrapper(req,DangerSourceEntity.class,param);
}
}

Loading…
Cancel
Save