fix:bug

This commit is contained in:
nieziyan 2023-11-08 10:28:16 +08:00
parent 85ee7e609a
commit bf5982b133
5 changed files with 38 additions and 7 deletions

View File

@ -25,9 +25,10 @@ public class GardsSampleDataController {
@GetMapping("findPage")
@ApiOperation(value = "分页查询DATA_BASE数据", notes = "分页查询DATA_BASE数据")
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest, GardsSampleDataSystem gardsSampleData){
Result<IPage<GardsSampleDataSystem>> result = gardsSampleDataService.findPage(queryRequest, gardsSampleData);
return result;
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest,
GardsSampleDataSystem gardsSampleData,
boolean collectStopCheck, boolean acqDotStartCheck){
return gardsSampleDataService.findPage(queryRequest, gardsSampleData, collectStopCheck, acqDotStartCheck);
}
@GetMapping("findStations")

View File

@ -16,6 +16,9 @@ public interface GardsSampleDataMapper extends BaseMapper<GardsSampleDataSystem>
void delTables(@Param("tableName") String tableName,
@Param("sampleId") Integer sampleId);
void delBatch(@Param("tableNames") List<String> tableNames,
@Param("sampleId") Integer sampleId);
AnalysesDto getAnalysis(@Param("owner") String owner,
@Param("sampleId") Integer sampleId);
}

View File

@ -5,6 +5,14 @@
DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId}
</delete>
<delete id="delBatch">
BEGIN
<foreach collection = "tableNames" item = "tableName" index = "index" >
DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId};
</foreach>
END;
</delete>
<select id="containSampleId" resultType="org.jeecg.modules.base.dto.OwnerDto">
SELECT
OWNER,
@ -14,6 +22,7 @@
WHERE
COLUMN_NAME = #{filed}
</select>
<select id="getAnalysis" resultType="org.jeecg.modules.base.dto.AnalysesDto">
SELECT
BASELINE_PATH,

View File

@ -17,7 +17,9 @@ public interface IGardsSampleDataService extends IService<GardsSampleDataSystem>
* @param gardsSampleData
* @return
*/
Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest, GardsSampleDataSystem gardsSampleData);
Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest,
GardsSampleDataSystem gardsSampleData,
boolean collectStopCheck, boolean acqDotStartCheck);
/**
* 删除DATA BASE数据

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.enums.FileTypeEnum;
@ -54,7 +55,9 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
private PlatformTransactionManager transactionManager;
@Override
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest, GardsSampleDataSystem gardsSampleData) {
public Result<IPage<GardsSampleDataSystem>> findPage(QueryRequest queryRequest,
GardsSampleDataSystem gardsSampleData,
boolean collectStopCheck, boolean acqDotStartCheck) {
//查询全部台站信息
HashMap<String, String> stationMap = (HashMap<String, String>) redisUtil.get("stationMap");
//查询全部监测器信息
@ -65,8 +68,18 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
queryWrapper.like(Objects.nonNull(gardsSampleData.getSampleId()) ,GardsSampleDataSystem::getSampleId, gardsSampleData.getSampleId());
queryWrapper.eq(Objects.nonNull(gardsSampleData.getStationId()) ,GardsSampleDataSystem::getStationId, gardsSampleData.getStationId());
queryWrapper.eq(Objects.nonNull(gardsSampleData.getDetectorId()) ,GardsSampleDataSystem::getDetectorId, gardsSampleData.getDetectorId());
queryWrapper.ge(Objects.nonNull(gardsSampleData.getCollectStart()) ,GardsSampleDataSystem::getCollectStart, gardsSampleData.getCollectStart());
queryWrapper.le(Objects.nonNull(gardsSampleData.getCollectStop()) ,GardsSampleDataSystem::getCollectStop, gardsSampleData.getCollectStop());
Date start = gardsSampleData.getCollectStart();
Date stop = gardsSampleData.getCollectStop();
boolean startNotNull = ObjectUtil.isNotNull(start);
boolean stopNotNull = ObjectUtil.isNotNull(stop);
if (collectStopCheck){
queryWrapper.ge(startNotNull ,GardsSampleDataSystem::getCollectStop, start);
queryWrapper.le(stopNotNull ,GardsSampleDataSystem::getCollectStop, stop);
}
if (acqDotStartCheck){
queryWrapper.ge(startNotNull ,GardsSampleDataSystem::getAcquisitionStart, start);
queryWrapper.le(stopNotNull ,GardsSampleDataSystem::getAcquisitionStart, stop);
}
queryWrapper.orderByAsc(GardsSampleDataSystem::getSampleId);
Page<GardsSampleDataSystem> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{
@ -119,6 +132,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
// 删除表数据
if (CollUtil.isNotEmpty(allTables))
delTables(allTables, sampleId);
// baseMapper.delBatch(allTables, sampleId);
}
else {
if (rnAuto){
@ -132,6 +146,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
// 删除表数据
if (CollUtil.isNotEmpty(autoTables))
delTables(autoTables, sampleId);
// baseMapper.delBatch(autoTables, sampleId);
}
if (rnMan){
// 收集人工交互库所有表名
@ -144,6 +159,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
// 删除表数据
if (CollUtil.isNotEmpty(manTables))
delTables(manTables, sampleId);
// baseMapper.delBatch(manTables, sampleId);
}
}
transactionManager.commit(txStatus);