|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -145,17 +146,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
|
|
|
}
|
|
|
- if (dto.getSortType() != null) {
|
|
|
- if (dto.getSortType().equals("1")) {
|
|
|
- queryWrapper.lambda().orderByAsc(TrialSelfInspectionRecord::getReportNo);
|
|
|
- } else if (dto.getSortType().equals("2")) {
|
|
|
- queryWrapper.lambda().orderByDesc(TrialSelfInspectionRecord::getReportNo);
|
|
|
- } else if (dto.getSortType().equals("3")) {
|
|
|
- queryWrapper.lambda().orderByAsc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
- } else if (dto.getSortType().equals("4")) {
|
|
|
- queryWrapper.lambda().orderByDesc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
- }
|
|
|
- }
|
|
|
+ queryWrapper.lambda().orderByAsc(TrialSelfInspectionRecord::getSort);
|
|
|
|
|
|
IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
@@ -2374,5 +2365,33 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
return record.getId();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateSort(TrialSelfInspectionRecordPageDTO dto) {
|
|
|
+ LambdaQueryWrapper<TrialSelfInspectionRecord> queryWrapper = Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
+ .eq(TrialSelfInspectionRecord::getNodeId, dto.getNodeId())
|
|
|
+ .eq(TrialSelfInspectionRecord::getType, dto.getType())
|
|
|
+ .eq(TrialSelfInspectionRecord::getContractId, dto.getContractId())
|
|
|
+ .eq(TrialSelfInspectionRecord::getIsDeleted, 0);
|
|
|
+ if (dto.getSortType() != null) {
|
|
|
+ if (dto.getSortType().equals("1")) {
|
|
|
+ queryWrapper.orderByAsc(TrialSelfInspectionRecord::getReportNo);
|
|
|
+ } else if (dto.getSortType().equals("2")) {
|
|
|
+ queryWrapper.orderByDesc(TrialSelfInspectionRecord::getReportNo);
|
|
|
+ } else if (dto.getSortType().equals("3")) {
|
|
|
+ queryWrapper.orderByAsc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
+ } else if (dto.getSortType().equals("4")) {
|
|
|
+ queryWrapper.orderByDesc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(queryWrapper);
|
|
|
+
|
|
|
+ if (CollectionUtil.isNotEmpty(trialSelfInspectionRecords)) {
|
|
|
+ for (int i = 0; i < trialSelfInspectionRecords.size(); i++) {
|
|
|
+ trialSelfInspectionRecords.get(i).setSort(i + 1);
|
|
|
+ }
|
|
|
+ //修改排序为连续排序
|
|
|
+ updateBatchById(trialSelfInspectionRecords);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|