This commit is contained in:
ls
2025-04-03 00:13:06 +08:00
parent 9c438552a6
commit 21afc31d72
17 changed files with 176 additions and 3 deletions

View File

@@ -14,13 +14,13 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.database.dto.NasaDataRecordPage;
import org.jeecg.modules.database.entity.LocalDatabase;
import org.jeecg.modules.database.entity.*;
import org.jeecg.modules.database.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import java.util.*;
/**
* @Description: 当期数据库记录
@@ -62,6 +62,22 @@ public class LocalDatabaseController extends JeecgController<LocalDatabase, ILoc
return Result.OK(pageList);
}
@Operation(summary = "数据库全局搜索")
@GetMapping(value = "/search")
public Result<List<?>> search(@RequestParam(name = "kw") String keyWord, HttpServletRequest req) {
List<LocalDatabase> localDatabaseList = localDatabaseService.search(keyWord);
List<HistoricalDatabase> historicalDatabaseList = historicalDatabaseService.search(keyWord);
List<NasaDataRecord> nasaDataRecordList = nasaDataRecordService.search(keyWord);
List result = new ArrayList<>();
result.addAll(localDatabaseList);
result.addAll(historicalDatabaseList);
result.addAll(nasaDataRecordList);
return Result.OK(result);
}
/**
* 添加
*

View File

@@ -0,0 +1,20 @@
/*
* Ant Group
* Copyright (c) 2004-2025 All Rights Reserved.
*/
package org.jeecg.modules.database.dto;
import lombok.*;
/**
* @author lise
* @version DatabaseSearchDTO.java, v 0.1 2025年04月02日 22:21 lise
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DatabaseSearchDTO<E> {
private String id;
private String type;
private E result;
}

View File

@@ -32,6 +32,10 @@ public class HistoricalDatabase implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@TableField(exist = false)
private String dataType="historical";
/**
* 创建人
*/

View File

@@ -32,6 +32,9 @@ public class LocalDatabase implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@TableField(exist = false)
private String dataType="local";
/**
* 创建人
*/

View File

@@ -33,6 +33,8 @@ public class NasaDataRecord implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@TableField(exist = false)
private String dataType="nasa";
/**
* 创建人
*/

View File

@@ -1,9 +1,12 @@
package org.jeecg.modules.database.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.database.entity.HistoricalDatabase;
import java.util.List;
/**
* @Description: 历史一期记录
* @Author: jeecg-boot
@@ -18,4 +21,5 @@ public interface HistoricalDatabaseMapper extends BaseMapper<HistoricalDatabase>
@Select("SELECT SUM(total_count_xhy) FROM historical_database where total_count_xhy is not null")
Long sumXhy();
List<HistoricalDatabase> search(@Param("keyWord") String keyWord);
}

View File

@@ -1,9 +1,12 @@
package org.jeecg.modules.database.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.database.entity.LocalDatabase;
import java.util.List;
/**
* @Description: 当期数据库记录
* @Author: jeecg-boot
@@ -16,4 +19,6 @@ public interface LocalDatabaseMapper extends BaseMapper<LocalDatabase> {
@Select("SELECT SUM(total_count_xhy) FROM local_database where total_count_xhy is not null")
Long sumXhy();
List<LocalDatabase> search(@Param("keyWord") String keyWord);
}

View File

@@ -1,9 +1,12 @@
package org.jeecg.modules.database.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.database.entity.NasaDataRecord;
import java.util.List;
/**
* @Description: NASA数据管理
* @Author: jeecg-boot
@@ -17,4 +20,6 @@ public interface NasaDataRecordMapper extends BaseMapper<NasaDataRecord> {
@Select("SELECT SUM(total_count_nasa) FROM nasa_data_record where total_count_nasa is not null")
Long sumXhy();
List<NasaDataRecord> search(@Param("keyWord") String keyWord);
}

View File

@@ -2,4 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.database.mapper.HistoricalDatabaseMapper">
<select id="search" resultType="org.jeecg.modules.database.entity.HistoricalDatabase">
select * from historical_database
<where>
<if test="keyWord != null and keyWord != ''">
type like concat('%', #{keyWord}, '%')
or name like concat('%', #{keyWord}, '%')
or device_mode like concat('%', #{keyWord},'%')
or client_name like concat('%', #{keyWord}, '%')
or manufacturer like concat('%', #{keyWord}, '%')
or data_provider like concat('%', #{keyWord}, '%')
or data_entry like concat('%', #{keyWord},'%')
</if>
</where>
</select>
</mapper>

View File

@@ -1,5 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.database.mapper.LocalDatabaseMapper">
<select id="search" resultType="org.jeecg.modules.database.entity.LocalDatabase">
select distinct l.* from local_database l left join experiment e on l.experiment_id = e.id
left join experiment_sample_info s on e.id = s.experiment_id
left join experiment_deviation_equipment b on e.id = b.experiment_id
left join experiment_deviation_condition c on e.id = c.experiment_id
left join experiment_anneal_process ap on e.id = ap.experiment_id
left join experiment_radiation_process rp on e.id = rp.experiment_id
left join experiment_test_process tp on e.id = tp.experiment_id
<where>
<if test="keyWord != null and keyWord != ''">
l.experiment_no like concat('%', #{keyWord}, '%')
or l.name like concat('%', #{keyWord}, '%')
or l.client_name like concat('%', #{keyWord}, '%')
or l.type like concat('%', #{keyWord}, '%')
or s.sample_name like concat('%', #{keyWord}, '%')
or s.sample_type like concat('%', #{keyWord}, '%')
or s.sample_model like concat('%', #{keyWord}, '%')
or s.sample_batch like concat('%', #{keyWord}, '%')
or s.sample_manufacturer like concat('%', #{keyWord}, '%')
or b.equipment_model like concat('%', #{keyWord}, '%')
or b.equipment_name like concat('%', #{keyWord}, '%')
or b.equipment_type like concat('%', #{keyWord}, '%')
or b.equipment_no like concat('%', #{keyWord}, '%')
or c.offset_condition like concat('%', #{keyWord}, '%')
or c.offset_voltage like concat('%', #{keyWord}, '%')
or c.input_signal like concat('%', #{keyWord}, '%')
or c.load_capacity like concat('%', #{keyWord}, '%')
or c.offset_current like concat('%', #{keyWord}, '%')
or c.other_condition like concat('%', #{keyWord}, '%')
or c.duty_cycle like concat('%', #{keyWord}, '%')
or c.signal_amplitude like concat('%', #{keyWord}, '%')
or c.signal_frequency like concat('%', #{keyWord}, '%')
or c.signal_type like concat('%', #{keyWord}, '%')
or ap.comment like concat('%', #{keyWord}, '%')
or ap.exception_record like concat('%', #{keyWord}, '%')
or ap.deviation_equipment like concat('%', #{keyWord}, '%')
or rp.measurement_rate like concat('%', #{keyWord}, '%')
or rp.radiation_standard like concat('%', #{keyWord}, '%')
or rp.comment like concat('%', #{keyWord}, '%')
or rp.exception_record like concat('%', #{keyWord}, '%')
or rp.radiation_detail like concat('%', #{keyWord}, '%')
or tp.comment like concat('%', #{keyWord}, '%')
or tp.exception_record like concat('%', #{keyWord}, '%')
or tp.radiation_detail like concat('%', #{keyWord}, '%')
or tp.test_parameters like concat('%', #{keyWord}, '%')
or tp.test_equipment like concat('%', #{keyWord}, '%')
or tp.test_metering_point like concat('%', #{keyWord}, '%')
or tp.test_fluence_point like concat('%', #{keyWord}, '%')
or tp.annealing_duration like concat('%', #{keyWord}, '%')
or tp.test_data like concat('%', #{keyWord}, '%')
</if>
</where>
</select>
</mapper>

View File

@@ -2,4 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.database.mapper.NasaDataRecordMapper">
<select id="search" resultType="org.jeecg.modules.database.entity.NasaDataRecord">
select * from nasa_data_record
<where>
<if test="keyWord != null and keyWord != ''">
device_type like concat('%', #{keyWord}, '%')
or device_name like concat('%', #{keyWord}, '%')
or device_mode like concat('%', #{keyWord}, '%')
or device_function like concat('%', #{keyWord}, '%')
or device_batch like concat('%', #{keyWord}, '%')
or manufacturer like concat('%', #{keyWord}, '%')
or origin_data like concat('%', #{keyWord}, '%')
</if>
</where>
</select>
</mapper>

View File

@@ -2,6 +2,9 @@ package org.jeecg.modules.database.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.database.entity.HistoricalDatabase;
import org.jeecg.modules.database.entity.LocalDatabase;
import java.util.List;
/**
* @Description: 历史一期记录
@@ -13,4 +16,6 @@ public interface IHistoricalDatabaseService extends IService<HistoricalDatabase>
Long sumLhs();
Long sumXhy();
List<HistoricalDatabase> search(String keyWord);
}

View File

@@ -1,8 +1,11 @@
package org.jeecg.modules.database.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.database.dto.DatabaseSearchDTO;
import org.jeecg.modules.database.entity.LocalDatabase;
import java.util.List;
/**
* @Description: 当期数据库记录
* @Author: jeecg-boot
@@ -13,4 +16,6 @@ public interface ILocalDatabaseService extends IService<LocalDatabase> {
Long sumLhs();
Long sumXhy();
List<LocalDatabase> search(String keyWord);
}

View File

@@ -3,6 +3,8 @@ package org.jeecg.modules.database.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.database.entity.NasaDataRecord;
import java.util.List;
/**
* @Description: NASA数据管理
* @Author: jeecg-boot
@@ -14,4 +16,7 @@ public interface INasaDataRecordService extends IService<NasaDataRecord> {
Long sumLhs();
Long sumXhy();
List<NasaDataRecord> search(String keyWord);
}

View File

@@ -6,6 +6,7 @@ import org.jeecg.modules.database.mapper.HistoricalDatabaseMapper;
import org.jeecg.modules.database.service.IHistoricalDatabaseService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
@@ -27,4 +28,9 @@ public class HistoricalDatabaseServiceImpl extends ServiceImpl<HistoricalDatabas
public Long sumXhy() {
return Optional.ofNullable(baseMapper.sumXhy()).orElse(0L);
}
@Override
public List<HistoricalDatabase> search(String keyWord) {
return baseMapper.search(keyWord);
}
}

View File

@@ -6,6 +6,7 @@ import org.jeecg.modules.database.mapper.LocalDatabaseMapper;
import org.jeecg.modules.database.service.ILocalDatabaseService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
@@ -16,6 +17,7 @@ import java.util.Optional;
*/
@Service
public class LocalDatabaseServiceImpl extends ServiceImpl<LocalDatabaseMapper, LocalDatabase> implements ILocalDatabaseService {
@Override
public Long sumLhs() {
return Optional.ofNullable(baseMapper.sumLhs()).orElse(0L);
@@ -25,4 +27,9 @@ public class LocalDatabaseServiceImpl extends ServiceImpl<LocalDatabaseMapper, L
public Long sumXhy() {
return Optional.ofNullable(baseMapper.sumXhy()).orElse(0L);
}
@Override
public List<LocalDatabase> search(String keyWord) {
return baseMapper.search(keyWord);
}
}

View File

@@ -6,6 +6,7 @@ import org.jeecg.modules.database.mapper.NasaDataRecordMapper;
import org.jeecg.modules.database.service.INasaDataRecordService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
@@ -27,4 +28,9 @@ public class NasaDataRecordServiceImpl extends ServiceImpl<NasaDataRecordMapper,
public Long sumXhy() {
return Optional.ofNullable(baseMapper.sumXhy()).orElse(0L);
}
@Override
public List<NasaDataRecord> search(String keyWord) {
return baseMapper.search(keyWord);
}
}