修改Mapper文件

This commit is contained in:
duwenyuan 2026-01-07 20:43:54 +08:00
parent 0786fb99a8
commit 1007d7b724
4 changed files with 125 additions and 3 deletions

View File

@ -34,7 +34,7 @@
</select>
<select id="selectByRnAutoStationIds" resultType="org.jeecg.modules.base.entity.ThresholdMetric">
<select id="selectByRnAutoStationIds01" resultType="org.jeecg.modules.base.entity.ThresholdMetric">
SELECT
a.STATION_ID as STATION_ID,
a.SAMPLE_ID as SAMPLE_ID,
@ -63,7 +63,51 @@
AND a.TRANSMIT_DTG > TO_DATE(#{oneYearAgo}, 'yyyy-mm-dd hh24:mi:ss')
</where>
</select>
<select id="selectByRnAutoStationIds" resultType="org.jeecg.modules.base.entity.ThresholdMetric">
SELECT a.STATION_ID as stationId,
a.SAMPLE_ID as sampleId,
b.NUCLIDENAME as nuclideName,
a.COLLECT_STOP as collectStop,
b.CONCENTRATION as concentration
FROM ORIGINAL.GARDS_SAMPLE_DATA a
JOIN RNAUTO.GARDS_NUCL_IDED b
ON a.SAMPLE_ID = b.SAMPLE_ID
<where>
a.SAMPLE_TYPE IN ('P','G')
<if test="stationIds != null and stationIds.size() > 0">
AND a.STATION_ID IN
<foreach item="stationId" collection="stationIds" open="(" close=")" separator=",">
#{stationId}
</foreach>
</if>
<if test="oneYearAgo != null">
AND a.COLLECT_STOP &gt; TO_DATE(#{oneYearAgo}, 'yyyy-mm-dd hh24:mi:ss')
</if>
</where>
UNION ALL
SELECT a.STATION_ID as stationId,
a.SAMPLE_ID as sampleId,
c.NUCLIDE_NAME as nuclideName,
a.COLLECT_STOP as collectStop,
TO_CHAR(c.CONC, 'FM9999999990.999999') as concentration
FROM ORIGINAL.GARDS_SAMPLE_DATA a
JOIN RNAUTO.GARDS_XE_RESULTS c
ON a.SAMPLE_ID = c.SAMPLE_ID
<where>
a.SAMPLE_TYPE = 'B'
<if test="stationIds != null and stationIds.size() > 0">
AND a.STATION_ID IN
<foreach item="stationId" collection="stationIds" open="(" close=")" separator=",">
#{stationId}
</foreach>
</if>
<if test="oneYearAgo != null">
AND a.COLLECT_STOP &gt; TO_DATE(#{oneYearAgo}, 'yyyy-mm-dd hh24:mi:ss')
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,9 @@
<?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.mapper.ThresholdCalculatorMapper">
<select id="queryStationInfos" resultType="org.jeecg.modules.base.entity.configuration.GardsStations">
select stations.STATION_ID
from CONFIGURATION.GARDS_STATIONS stations
</select>
</mapper>

View File

@ -14,6 +14,7 @@ import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
import java.util.List;
import java.util.Map;
@Mapper
public interface SpectrumAnalysisMapper {
@ -91,7 +92,7 @@ public interface SpectrumAnalysisMapper {
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
@ -125,7 +126,7 @@ public interface SpectrumAnalysisMapper {
List<String> findNuclideList(@Param(value = "min") Double min, @Param(value = "max") Double max, @Param(value = "nuclides") List<String> nuclides);
List<GardsNuclLinesLib> getNuclideTable( @Param(value = "name") String name, @Param(value = "span") Long span);
List<GardsNuclLinesLib> getNuclideTable(@Param(value = "name") String name, @Param(value = "span") Long span);
List<String> getPossibleNuclide(@Param(value = "nuclides") List<String> nuclides, @Param(value = "min") double min, @Param(value = "max") double max);
@ -188,4 +189,10 @@ public interface SpectrumAnalysisMapper {
List<String> findNuclidesAnalysis();
List<Map<String, Object>> selectThresholdDataBySampleId(@Param("schemaName") String schemaName, @Param("sampleId") String sampleId);
List<ThresholdResultHistory> selectThresholdHistoryBySampleId(@Param("schemaName") String schemaName, @Param("sampleId") String sampleId);
List<NuclideAnalysisInfo> selectXeDataPastYear( @Param("schemaName") String schemaName, @Param("sampleId") String sampleId,@Param(value = "userName") String userName);
}

View File

@ -1175,4 +1175,66 @@
select NAME from CONFIGURATION.GARDS_NUCL_LIB
</select>
<select id="selectThresholdDataBySampleId" resultType="java.util.Map">
SELECT
gtr.NUCLIDENAME,
gtr.THRESHOLD_VALUE
FROM ORIGINAL.GARDS_SAMPLE_DATA osd
INNER JOIN ${schemaName}.GARDS_THRESHOLD_RESULT gtr
ON osd.STATION_ID = gtr.STATION_ID
WHERE osd.SAMPLE_ID = #{sampleId}
</select>
<select id="selectThresholdHistoryBySampleId" resultType="org.jeecg.modules.entity.vo.ThresholdResultHistory">
SELECT
gtr.NUCLIDENAME AS nuclideName,
gtr.THRESHOLD_VALUE AS thresholdValue,
gtr.COLLECT_STOP,
gtr.CATEGORY
FROM RNAUTO.GARDS_THRESHOLD_RESULT_HIS gtr
WHERE gtr.STATION_ID = (
SELECT osd.STATION_ID
FROM ORIGINAL.GARDS_SAMPLE_DATA osd
WHERE osd.SAMPLE_ID = #{sampleId,jdbcType=VARCHAR}
)
AND gtr.NUCLIDENAME IN ('Xe131m', 'Xe133', 'Xe133m', 'Xe135')
/*AND gtr.UPDATE_TIME >= DATEADD(YEAR, -1, CURRENT_TIMESTAMP) <!-- SQL Server -->*/
/* 如果你是 Oracle */
AND gtr.COLLECT_STOP >= SYSDATE - INTERVAL '1' YEAR
/* 如果是 MySQL换成下面这行 */
-- AND gtr.COLLECT_STOP >= DATE_SUB(NOW(), INTERVAL 1 YEAR)
/* 如果是 PostgreSQL换成下面这行 */
-- AND gtr.COLLECT_STOP >= CURRENT_TIMESTAMP - INTERVAL '1 year'
</select>
<select id="selectXeDataPastYear" resultType="org.jeecg.modules.entity.vo.NuclideAnalysisInfo">
SELECT a.SAMPLE_ID,
a.COLLECT_STOP,
b.CATEGORY,
xe.conc,
xe.conc_err,
xe.mdc,
xe.NUCLIDE_NAME,
xe.lc
FROM ${schemaName}.GARDS_XE_RESULTS xe
LEFT JOIN ${schemaName}.GARDS_ANALYSES b
ON xe.SAMPLE_ID = b.SAMPLE_ID
AND xe.IDANALYSIS = b.IDANALYSIS
LEFT JOIN ORIGINAL.GARDS_SAMPLE_DATA a
ON xe.SAMPLE_ID = a.SAMPLE_ID
WHERE a.SAMPLE_ID = #{sampleId}
AND b.ANALYST = #{userName}
AND (a.COLLECT_STOP IS NULL
OR TRUNC(a.COLLECT_STOP) BETWEEN
ADD_MONTHS(TRUNC(SYSDATE), -12)
AND
TRUNC(SYSDATE)
)
</select>
</mapper>