update
This commit is contained in:
@@ -25,9 +25,7 @@ import org.jeecg.modules.database.service.*;
|
|||||||
import org.jeecg.modules.system.entity.SysUser;
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
import org.jeecg.modules.system.service.ISysUserService;
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -81,7 +79,7 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
|
|||||||
DateUtils.formatDate(createTime, "yyyy-MM-dd"));
|
DateUtils.formatDate(createTime, "yyyy-MM-dd"));
|
||||||
}
|
}
|
||||||
Page<ExperimentReport> page = new Page<>(pageNo, pageSize);
|
Page<ExperimentReport> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<ExperimentReport> pageList = experimentReportService.page(page, queryWrapper);
|
IPage<ExperimentReport> pageList = experimentReportService.join(page, experimentReport, queryWrapper);
|
||||||
pageList.getRecords().forEach(v -> {
|
pageList.getRecords().forEach(v -> {
|
||||||
ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(v.getExperimentId(), ExperimentDocType.sybg.getType());
|
ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(v.getExperimentId(), ExperimentDocType.sybg.getType());
|
||||||
v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
|
v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null));
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package org.jeecg.modules.database.mapper;
|
package org.jeecg.modules.database.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.jeecg.modules.database.entity.ExperimentReport;
|
import org.jeecg.modules.database.entity.ExperimentReport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,4 +14,9 @@ import org.jeecg.modules.database.entity.ExperimentReport;
|
|||||||
*/
|
*/
|
||||||
public interface ExperimentReportMapper extends BaseMapper<ExperimentReport> {
|
public interface ExperimentReportMapper extends BaseMapper<ExperimentReport> {
|
||||||
|
|
||||||
|
@Select("SELECT r.* " +
|
||||||
|
"FROM experiment_report r LEFT JOIN experiment e ON r.experiment_id = e.id " +
|
||||||
|
"WHERE r.status = #{report.status}")
|
||||||
|
IPage<ExperimentReport> join(Page page, ExperimentReport report);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package org.jeecg.modules.database.service;
|
package org.jeecg.modules.database.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.jeecg.modules.database.entity.ExperimentLog;
|
|
||||||
import org.jeecg.modules.database.entity.ExperimentReport;
|
import org.jeecg.modules.database.entity.ExperimentReport;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,6 +16,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IExperimentReportService extends IService<ExperimentReport> {
|
public interface IExperimentReportService extends IService<ExperimentReport> {
|
||||||
List<ExperimentReport> getByExperimentId(String experimentId);
|
List<ExperimentReport> getByExperimentId(String experimentId);
|
||||||
|
|
||||||
ExperimentReport getLatestReport(String experimentId);
|
ExperimentReport getLatestReport(String experimentId);
|
||||||
|
|
||||||
|
IPage<ExperimentReport> join(Page page, ExperimentReport queryWrapper, QueryWrapper<ExperimentReport> wrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package org.jeecg.modules.database.service.impl;
|
package org.jeecg.modules.database.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.modules.database.constant.ExperimentReportStatus;
|
import org.jeecg.modules.database.constant.ExperimentReportStatus;
|
||||||
import org.jeecg.modules.database.entity.ExperimentReport;
|
import org.jeecg.modules.database.entity.ExperimentReport;
|
||||||
import org.jeecg.modules.database.mapper.ExperimentReportMapper;
|
import org.jeecg.modules.database.mapper.ExperimentReportMapper;
|
||||||
@@ -32,4 +36,13 @@ public class ExperimentReportServiceImpl extends ServiceImpl<ExperimentReportMap
|
|||||||
queryWrapper.orderByDesc(ExperimentReport::getCreateTime);
|
queryWrapper.orderByDesc(ExperimentReport::getCreateTime);
|
||||||
return getOne(queryWrapper, false);
|
return getOne(queryWrapper, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ExperimentReport> join(Page page, ExperimentReport report, QueryWrapper<ExperimentReport> wrapper) {
|
||||||
|
if (StringUtils.isBlank(report.getStatus())) {
|
||||||
|
return super.page(page, wrapper);
|
||||||
|
}
|
||||||
|
IPage<ExperimentReport> join = baseMapper.join(page, report);
|
||||||
|
return join;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user