修改SQL兼容Oracle和Pgsql
This commit is contained in:
parent
67d73bc824
commit
8141aa72e8
|
|
@ -3,65 +3,116 @@
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT samp.SAMPLE_ID,
|
DISTINCT samp.SAMPLE_ID,
|
||||||
nucl.NUCLIDENAME,
|
nucl.NUCLIDENAME,
|
||||||
nucl.CONCENTRATION AS CONC,
|
nucl.CONCENTRATION AS CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN
|
||||||
FROM
|
FROM RNAUTO.GARDS_NUCL_IDED nucl
|
||||||
RNAUTO.GARDS_NUCL_IDED nucl
|
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
ON ana.IDANALYSIS = nucl.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||||
INNER JOIN RNAUTO.GARDS_QC_CHECK qc ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
||||||
<trim prefix="where" suffixOverrides="or">
|
INNER JOIN RNAUTO.GARDS_QC_CHECK qc
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
|
||||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
<trim prefix="WHERE" suffixOverrides="AND">
|
||||||
|
<choose>
|
||||||
|
|
||||||
|
<!-- Oracle -->
|
||||||
|
<when test="_databaseId == 'oracle'">
|
||||||
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
|
TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
|
AND TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
|
</when>
|
||||||
|
|
||||||
|
<!-- PostgreSQL -->
|
||||||
|
<when test="_databaseId == 'postgresql'">
|
||||||
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
|
TO_TIMESTAMP(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
|
AND TO_TIMESTAMP(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
AND samp.DATA_TYPE = 'S'
|
||||||
|
AND samp.STATUS IN ('P', 'R')
|
||||||
AND samp.STATION_ID = #{stationId}
|
AND samp.STATION_ID = #{stationId}
|
||||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||||
|
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND nucl.NUCLIDENAME IN
|
AND nucl.NUCLIDENAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName"
|
||||||
|
item="item"
|
||||||
|
open="("
|
||||||
|
close=")"
|
||||||
|
separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="(colTime != null and colTime.size() > 0) || (acqTime != null and acqTime.size() > 0) ||
|
|
||||||
airFlow != null || decayTime != null || sampVol != null || be7FWHM != null || ba140MDC != null || xe133MDC != null">
|
<if test="(colTime != null and colTime.size() > 0)
|
||||||
<trim prefix="and(" suffixOverrides="or" suffix=")">
|
|| (acqTime != null and acqTime.size() > 0)
|
||||||
|
|| airFlow != null
|
||||||
|
|| decayTime != null
|
||||||
|
|| sampVol != null
|
||||||
|
|| be7FWHM != null
|
||||||
|
|| ba140MDC != null
|
||||||
|
|| xe133MDC != null">
|
||||||
|
|
||||||
|
<trim prefix="AND (" suffix=")" suffixOverrides="OR">
|
||||||
|
|
||||||
<if test="colTime != null and colTime.size() > 0">
|
<if test="colTime != null and colTime.size() > 0">
|
||||||
(qc.qc_name = 'col_time' and qc.qc_value between #{colTime[0]} and #{colTime[1]} ) or
|
(qc.qc_name = 'col_time'
|
||||||
|
AND qc.qc_value BETWEEN #{colTime[0]}
|
||||||
|
AND #{colTime[1]}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="acqTime != null and acqTime.size() > 0">
|
<if test="acqTime != null and acqTime.size() > 0">
|
||||||
(qc.qc_name = 'acq_time' and qc.qc_value = #{acqTime[0]}) or
|
(qc.qc_name = 'acq_time'
|
||||||
|
AND qc.qc_value = #{acqTime[0]}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="airFlow != null">
|
<if test="airFlow != null">
|
||||||
(qc.qc_name = 'airFlow' and qc.qc_value < #{airFlow} ) or
|
(qc.qc_name = 'airFlow'
|
||||||
|
AND qc.qc_value < #{airFlow}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="decayTime != null">
|
<if test="decayTime != null">
|
||||||
(qc.qc_name = 'decay_time' and qc.qc_value < #{decayTime} ) or
|
(qc.qc_name = 'decay_time'
|
||||||
|
AND qc.qc_value < #{decayTime}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="sampVol != null">
|
<if test="sampVol != null">
|
||||||
(qc.qc_name = 'samp_vol' and qc.qc_value < #{sampVol} ) or
|
(qc.qc_name = 'samp_vol'
|
||||||
|
AND qc.qc_value < #{sampVol}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="be7FWHM != null">
|
<if test="be7FWHM != null">
|
||||||
(qc.qc_name = 'Be7-FWHM' and qc.qc_value < #{be7FWHM} ) or
|
(qc.qc_name = 'Be7-FWHM'
|
||||||
|
AND qc.qc_value < #{be7FWHM}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="ba140MDC != null">
|
<if test="ba140MDC != null">
|
||||||
(qc.qc_name = 'Ba140-MDC' and qc.qc_value < #{ba140MDC} ) or
|
(qc.qc_name = 'Ba140-MDC'
|
||||||
|
AND qc.qc_value < #{ba140MDC}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="xe133MDC != null">
|
<if test="xe133MDC != null">
|
||||||
(qc.qc_name = 'Xe133-MDC' and qc.qc_value < #{xe133MDC} ) or
|
(qc.qc_name = 'Xe133-MDC'
|
||||||
|
AND qc.qc_value < #{xe133MDC}) OR
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||||
SELECT
|
SELECT
|
||||||
n.SAMPLE_ID,
|
n.SAMPLE_ID,
|
||||||
n.NUCLIDENAME AS nuclideName
|
n.NUCLIDENAME AS nuclideName
|
||||||
FROM
|
FROM
|
||||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||||
INNER JOIN RNAUTO.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
INNER JOIN RNAUTO.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||||
|
|
@ -1,66 +1,143 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT samp.SAMPLE_ID,
|
samp.SAMPLE_ID,
|
||||||
nucl.NUCLIDENAME,
|
xe.NUCLIDE_NAME,
|
||||||
nucl.CONCENTRATION AS CONC,
|
xe.CONC,
|
||||||
ana.ANALYSISBEGIN
|
ana.ANALYSISBEGIN,
|
||||||
FROM
|
xe.NID_FLAG
|
||||||
RNMAN.GARDS_NUCL_IDED nucl
|
FROM RNAUTO.GARDS_XE_RESULTS xe
|
||||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
|
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
|
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||||
INNER JOIN RNMAN.GARDS_QC_CHECK qc ON samp.SAMPLE_ID = qc.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||||
|
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||||
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||||
|
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
<choose>
|
||||||
|
<when test="_databaseId == 'postgresql'">
|
||||||
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
|
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
|
AND
|
||||||
|
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
|
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
|
AND
|
||||||
|
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
AND samp.DATA_TYPE = 'S'
|
||||||
|
AND samp.STATUS IN ('P', 'R')
|
||||||
AND samp.STATION_ID = #{stationId}
|
AND samp.STATION_ID = #{stationId}
|
||||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||||
|
|
||||||
|
<!-- 动态核素 IN -->
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
AND nucl.NUCLIDENAME IN
|
AND xe.NUCLIDE_NAME IN
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="(colTime != null and colTime.size() > 0) || (acqTime != null and acqTime.size() > 0) ||
|
|
||||||
airFlow != null || decayTime != null || sampVol != null || be7FWHM != null || ba140MDC != null || xe133MDC != null">
|
<!-- 时间差兼容 Oracle 11g + PostgreSQL -->
|
||||||
<trim prefix="and(" suffixOverrides="or" suffix=")">
|
<if test="colTime != null and colTime.size() > 0">
|
||||||
<if test="colTime != null and colTime.size() > 0">
|
<choose>
|
||||||
(qc.qc_name = 'col_time' and qc.qc_value between #{colTime[0]} and #{colTime[1]} ) or
|
<when test="_databaseId == 'postgresql'">
|
||||||
</if>
|
AND (
|
||||||
<if test="acqTime != null and acqTime.size() > 0">
|
EXTRACT(EPOCH FROM (samp.COLLECT_STOP - samp.COLLECT_START)) / 3600
|
||||||
(qc.qc_name = 'acq_time' and qc.qc_value = #{acqTime[0]}) or
|
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||||
</if>
|
)
|
||||||
<if test="airFlow != null">
|
</when>
|
||||||
(qc.qc_name = 'airFlow' and qc.qc_value < #{airFlow} ) or
|
<otherwise>
|
||||||
</if>
|
AND (
|
||||||
<if test="decayTime != null">
|
(samp.COLLECT_STOP - samp.COLLECT_START) * 24
|
||||||
(qc.qc_name = 'decay_time' and qc.qc_value < #{decayTime} ) or
|
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||||
</if>
|
)
|
||||||
<if test="sampVol != null">
|
</otherwise>
|
||||||
(qc.qc_name = 'samp_vol' and qc.qc_value < #{sampVol} ) or
|
</choose>
|
||||||
</if>
|
|
||||||
<if test="be7FWHM != null">
|
|
||||||
(qc.qc_name = 'Be7-FWHM' and qc.qc_value < #{be7FWHM} ) or
|
|
||||||
</if>
|
|
||||||
<if test="ba140MDC != null">
|
|
||||||
(qc.qc_name = 'Ba140-MDC' and qc.qc_value < #{ba140MDC} ) or
|
|
||||||
</if>
|
|
||||||
<if test="xe133MDC != null">
|
|
||||||
(qc.qc_name = 'Xe133-MDC' and qc.qc_value < #{xe133MDC} ) or
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<!-- 采集活时间 -->
|
||||||
|
<if test="acqTime != null and acqTime.size() > 0">
|
||||||
|
AND (
|
||||||
|
samp.ACQUISITION_LIVE_SEC / 3600
|
||||||
|
BETWEEN #{acqTime[0]} AND #{acqTime[1]}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- Xe 体积 -->
|
||||||
|
<if test="XeVol != null">
|
||||||
|
AND aux.XE_VOLUME > #{XeVol}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- Xe133m MDC-->
|
||||||
|
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
|
||||||
|
AND (
|
||||||
|
xe.NUCLIDE_NAME = 'Xe133m'
|
||||||
|
AND xe.MDC BETWEEN #{Xe133MDC[0]} AND #{Xe133MDC[1]}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
|
) a
|
||||||
|
|
||||||
|
<!-- 去掉不合理条件 -->
|
||||||
|
<trim prefix="where" suffixOverrides="or">
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when test="Xe133mFlag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when test="Xe133Flag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when test="Xe131mFlag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when test="Xe135Flag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||||
SELECT
|
SELECT
|
||||||
n.SAMPLE_ID,
|
n.SAMPLE_ID,
|
||||||
n.NUCLIDENAME AS nuclideName
|
n.NUCLIDENAME AS nuclideName
|
||||||
FROM
|
FROM
|
||||||
ORIGINAL.GARDS_SAMPLE_DATA s
|
ORIGINAL.GARDS_SAMPLE_DATA s
|
||||||
INNER JOIN RNMAN.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
INNER JOIN RNMAN.GARDS_NUCL_IDED n ON s.SAMPLE_ID = n.SAMPLE_ID
|
||||||
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
WHERE s.STATION_ID = #{stationId} AND s.DETECTOR_ID = #{detectorId}
|
||||||
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
<if test="nuclideNames != null and nuclideNames.size() > 0">
|
||||||
|
|
|
||||||
|
|
@ -2,79 +2,137 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||||
SELECT * FROM (
|
SELECT *
|
||||||
SELECT
|
FROM (
|
||||||
samp.SAMPLE_ID,
|
SELECT
|
||||||
xe.NUCLIDE_NAME,
|
samp.SAMPLE_ID,
|
||||||
xe.CONC,
|
xe.NUCLIDE_NAME,
|
||||||
ana.ANALYSISBEGIN,
|
xe.CONC,
|
||||||
xe.NID_FLAG
|
ana.ANALYSISBEGIN,
|
||||||
FROM
|
xe.NID_FLAG
|
||||||
RNAUTO.GARDS_XE_RESULTS xe
|
FROM
|
||||||
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
RNAUTO.GARDS_XE_RESULTS xe
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
INNER JOIN RNAUTO.GARDS_ANALYSES ana
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||||
<where>
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||||
AND samp.STATION_ID = #{stationId}
|
<where>
|
||||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||||
AND xe.NUCLIDE_NAME IN
|
<choose>
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
<when test="_databaseId == 'postgresql'">
|
||||||
#{item}
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
</foreach>
|
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
</if>
|
AND
|
||||||
<if test="colTime != null and colTime.size() > 0">
|
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
and ((TO_NUMBER(samp.COLLECT_STOP - samp.COLLECT_START) * 24) between #{colTime[0]} and #{colTime[1]} )
|
</when>
|
||||||
</if>
|
<otherwise>
|
||||||
<if test="acqTime != null and acqTime.size() > 0">
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
and (samp.ACQUISITION_LIVE_SEC / 3600 between #{colTime[0]} and #{colTime[1]} )
|
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
</if>
|
AND
|
||||||
<if test="XeVol != null">
|
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
AND (aux.XE_VOLUME > #{XeVol} )
|
</otherwise>
|
||||||
</if>
|
</choose>
|
||||||
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
|
|
||||||
AND (xe.NUCLIDE_NAME = 'Xe133m' AND MDC between #{Xe133MDC[0]} AND #{Xe133MDC[1]} )
|
AND samp.DATA_TYPE = 'S'
|
||||||
</if>
|
AND samp.STATUS IN ('P', 'R')
|
||||||
</where>
|
AND samp.STATION_ID = #{stationId}
|
||||||
|
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||||
|
|
||||||
|
<!-- 动态核素 -->
|
||||||
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
|
AND xe.NUCLIDE_NAME IN
|
||||||
|
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 时间差兼容 Oracle 11g + PostgreSQL -->
|
||||||
|
<if test="colTime != null and colTime.size() > 0">
|
||||||
|
<choose>
|
||||||
|
<when test="_databaseId == 'postgresql'">
|
||||||
|
AND (
|
||||||
|
EXTRACT(EPOCH FROM (samp.COLLECT_STOP - samp.COLLECT_START)) / 3600
|
||||||
|
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
AND (
|
||||||
|
(samp.COLLECT_STOP - samp.COLLECT_START) * 24
|
||||||
|
BETWEEN #{colTime[0]} AND #{colTime[1]}
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 采集活时间-->
|
||||||
|
<if test="acqTime != null and acqTime.size() > 0">
|
||||||
|
AND (
|
||||||
|
samp.ACQUISITION_LIVE_SEC / 3600
|
||||||
|
BETWEEN #{acqTime[0]} AND #{acqTime[1]}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- Xe 体积 -->
|
||||||
|
<if test="XeVol != null">
|
||||||
|
AND aux.XE_VOLUME > #{XeVol}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- Xe133m MDC -->
|
||||||
|
<if test="Xe133MDC != null and Xe133MDC.size() > 0">
|
||||||
|
AND (
|
||||||
|
xe.NUCLIDE_NAME = 'Xe133m'
|
||||||
|
AND xe.MDC BETWEEN #{Xe133MDC[0]} AND #{Xe133MDC[1]}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</where>
|
||||||
) a
|
) a
|
||||||
<trim prefix="where" suffixOverrides="or">
|
|
||||||
<choose>
|
<!-- 核素 flag 过滤-->
|
||||||
<when test="Xe133mFlag != null">
|
<trim prefix="where" suffixOverrides="or">
|
||||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1 ) or
|
|
||||||
</when>
|
<choose>
|
||||||
<otherwise>
|
<when test="Xe133mFlag != null">
|
||||||
(a.NUCLIDE_NAME = 'Xe133m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||||
</otherwise>
|
</when>
|
||||||
</choose>
|
<otherwise>
|
||||||
<choose>
|
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||||
<when test="Xe133Flag != null">
|
</otherwise>
|
||||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1 ) or
|
</choose>
|
||||||
</when>
|
|
||||||
<otherwise>
|
<choose>
|
||||||
(a.NUCLIDE_NAME = 'Xe133' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
<when test="Xe133Flag != null">
|
||||||
</otherwise>
|
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||||
</choose>
|
</when>
|
||||||
<choose>
|
<otherwise>
|
||||||
<when test="Xe131mFlag != null">
|
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1 ) or
|
</otherwise>
|
||||||
</when>
|
</choose>
|
||||||
<otherwise>
|
|
||||||
(a.NUCLIDE_NAME = 'Xe131m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
<choose>
|
||||||
</otherwise>
|
<when test="Xe131mFlag != null">
|
||||||
</choose>
|
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||||
<choose>
|
</when>
|
||||||
<when test="Xe135Flag != null">
|
<otherwise>
|
||||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1 ) or
|
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||||
</when>
|
</otherwise>
|
||||||
<otherwise>
|
</choose>
|
||||||
(a.NUCLIDE_NAME = 'Xe135' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
|
||||||
</otherwise>
|
<choose>
|
||||||
</choose>
|
<when test="Xe135Flag != null">
|
||||||
</trim>
|
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||||
SELECT
|
SELECT
|
||||||
n.SAMPLE_ID,
|
n.SAMPLE_ID,
|
||||||
|
|
|
||||||
|
|
@ -2,67 +2,88 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
|
||||||
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDtoXe">
|
||||||
SELECT * FROM (
|
SELECT *
|
||||||
SELECT
|
FROM (
|
||||||
samp.SAMPLE_ID,
|
SELECT
|
||||||
xe.NUCLIDE_NAME,
|
samp.SAMPLE_ID,
|
||||||
xe.CONC,
|
xe.NUCLIDE_NAME,
|
||||||
ana.ANALYSISBEGIN,
|
xe.CONC,
|
||||||
xe.NID_FLAG
|
ana.ANALYSISBEGIN,
|
||||||
FROM
|
xe.NID_FLAG
|
||||||
RNMAN.GARDS_XE_RESULTS xe
|
FROM RNMAN.GARDS_XE_RESULTS xe
|
||||||
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
|
INNER JOIN RNMAN.GARDS_ANALYSES ana
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
ON ana.IDANALYSIS = xe.IDANALYSIS
|
||||||
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp
|
||||||
<where>
|
ON samp.SAMPLE_ID = xe.SAMPLE_ID
|
||||||
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
|
INNER JOIN ORIGINAL.GARDS_SAMPLE_AUX aux
|
||||||
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
|
ON samp.SAMPLE_ID = aux.SAMPLE_ID
|
||||||
AND samp.DATA_TYPE = 'S' AND samp.STATUS IN ('P', 'R')
|
<where>
|
||||||
AND samp.STATION_ID = #{stationId}
|
|
||||||
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
<!-- 日期兼容 Oracle 11g + PostgreSQL -->
|
||||||
<if test="nuclideName != null and nuclideName.size() > 0">
|
<choose>
|
||||||
AND xe.NUCLIDE_NAME IN
|
<when test="_databaseId == 'postgresql'">
|
||||||
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
#{item}
|
TO_TIMESTAMP(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
</foreach>
|
AND
|
||||||
</if>
|
TO_TIMESTAMP(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
</where>
|
</when>
|
||||||
)a
|
<otherwise>
|
||||||
<trim prefix="where" suffixOverrides="or">
|
ana.ANALYSISBEGIN BETWEEN
|
||||||
<choose>
|
TO_DATE(#{startDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
<when test="Xe133mFlag != null">
|
AND
|
||||||
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1 ) or
|
TO_DATE(#{endDate}, 'YYYY-MM-DD HH24:MI:SS')
|
||||||
</when>
|
</otherwise>
|
||||||
<otherwise>
|
</choose>
|
||||||
(a.NUCLIDE_NAME = 'Xe133m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
AND samp.DATA_TYPE = 'S'
|
||||||
</otherwise>
|
AND samp.STATUS IN ('P', 'R')
|
||||||
</choose>
|
AND samp.STATION_ID = #{stationId}
|
||||||
<choose>
|
AND samp.SPECTRAL_QUALIFIE = 'FULL'
|
||||||
<when test="Xe133Flag != null">
|
<!-- 动态核素 IN -->
|
||||||
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1 ) or
|
<if test="nuclideName != null and nuclideName.size() > 0">
|
||||||
</when>
|
AND xe.NUCLIDE_NAME IN
|
||||||
<otherwise>
|
<foreach collection="nuclideName" item="item" open="(" close=")" separator=",">
|
||||||
(a.NUCLIDE_NAME = 'Xe133' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
#{item}
|
||||||
</otherwise>
|
</foreach>
|
||||||
</choose>
|
</if>
|
||||||
<choose>
|
</where>
|
||||||
<when test="Xe131mFlag != null">
|
) a
|
||||||
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1 ) or
|
<!-- 去掉不合理条件 -->
|
||||||
</when>
|
<trim prefix="where" suffixOverrides="or">
|
||||||
<otherwise>
|
<choose>
|
||||||
(a.NUCLIDE_NAME = 'Xe131m' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
<when test="Xe133mFlag != null">
|
||||||
</otherwise>
|
(a.NUCLIDE_NAME = 'Xe133m' AND a.NID_FLAG = 1) OR
|
||||||
</choose>
|
</when>
|
||||||
<choose>
|
<otherwise>
|
||||||
<when test="Xe135Flag != null">
|
(a.NUCLIDE_NAME = 'Xe133m') OR
|
||||||
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1 ) or
|
</otherwise>
|
||||||
</when>
|
</choose>
|
||||||
<otherwise>
|
<choose>
|
||||||
(a.NUCLIDE_NAME = 'Xe135' AND (a.NID_FLAG = 1 AND a.NID_FLAG = 0) ) or
|
<when test="Xe133Flag != null">
|
||||||
</otherwise>
|
(a.NUCLIDE_NAME = 'Xe133' AND a.NID_FLAG = 1) OR
|
||||||
</choose>
|
</when>
|
||||||
</trim>
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe133') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when test="Xe131mFlag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe131m' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe131m') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when test="Xe135Flag != null">
|
||||||
|
(a.NUCLIDE_NAME = 'Xe135' AND a.NID_FLAG = 1) OR
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(a.NUCLIDE_NAME = 'Xe135') OR
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
<select id="sampNucl" resultType="org.jeecg.modules.base.dto.SampNucl">
|
||||||
SELECT
|
SELECT
|
||||||
n.SAMPLE_ID,
|
n.SAMPLE_ID,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user